Add new Calculator tests for added buttons
New button were added to the Calculator's Basic view, which allow access to constants and functions. In this test, we check some of the constants and functions.
@ -176,6 +176,9 @@ for button in ("div", "divider", "zero", "one", "two", "three", "four", "five",
|
|||||||
"six","seven", "eight", "nine", "mod", "percent", "sub"):
|
"six","seven", "eight", "nine", "mod", "percent", "sub"):
|
||||||
testtags.append(f"calc_button_{button}")
|
testtags.append(f"calc_button_{button}")
|
||||||
testtags.append(f"kcalc_button_{button}")
|
testtags.append(f"kcalc_button_{button}")
|
||||||
|
for function in ("sqrt", "arg", "cos"):
|
||||||
|
testtags.append(f"calc_function_{function}")
|
||||||
|
testtags.append(f"calc_result_{function}")
|
||||||
for result in ("BokZw", "Czo4s", "O9qsL", "WIxiR", "b5y2B", "h7MfO", "qxuBK",
|
for result in ("BokZw", "Czo4s", "O9qsL", "WIxiR", "b5y2B", "h7MfO", "qxuBK",
|
||||||
"tWshx", "uC8Ul", "3LAG3"):
|
"tWshx", "uC8Ul", "3LAG3"):
|
||||||
testtags.append(f"calc_result_{result}")
|
testtags.append(f"calc_result_{result}")
|
||||||
|
Before Width: | Height: | Size: 518 KiB |
@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"area": [
|
|
||||||
{
|
|
||||||
"xpos": 313,
|
|
||||||
"ypos": 371,
|
|
||||||
"width": 32,
|
|
||||||
"height": 31,
|
|
||||||
"type": "match"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"properties": [],
|
|
||||||
"tags": [
|
|
||||||
"calc_button_bclose"
|
|
||||||
]
|
|
||||||
}
|
|
Before Width: | Height: | Size: 716 KiB |
Before Width: | Height: | Size: 230 KiB |
Before Width: | Height: | Size: 442 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 362,
|
||||||
|
"ypos": 467,
|
||||||
|
"width": 27,
|
||||||
|
"height": 28,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_button_clear"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_button_clear-20250717.png
Normal file
After Width: | Height: | Size: 431 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 555,
|
||||||
|
"ypos": 663,
|
||||||
|
"width": 52,
|
||||||
|
"height": 21,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_button_fxunified"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_button_fxunified-20250717.png
Normal file
After Width: | Height: | Size: 498 KiB |
@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"area": [
|
"area": [
|
||||||
{
|
{
|
||||||
"width": 32,
|
|
||||||
"height": 31,
|
|
||||||
"ypos": 471,
|
|
||||||
"xpos": 494,
|
"xpos": 494,
|
||||||
|
"ypos": 468,
|
||||||
|
"width": 34,
|
||||||
|
"height": 28,
|
||||||
"type": "match"
|
"type": "match"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"properties": [],
|
"properties": [],
|
||||||
"tags": [
|
"tags": [
|
||||||
"calc_button_bclose"
|
"calc_button_lower"
|
||||||
]
|
]
|
||||||
}
|
}
|
BIN
needles/gnome/apps/calculator/calc_button_lower-20250717.png
Normal file
After Width: | Height: | Size: 431 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 428,
|
||||||
|
"ypos": 471,
|
||||||
|
"width": 35,
|
||||||
|
"height": 23,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_button_upper"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_button_upper-20250717.png
Normal file
After Width: | Height: | Size: 430 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 430,
|
||||||
|
"ypos": 468,
|
||||||
|
"width": 31,
|
||||||
|
"height": 28,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_button_upper"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_button_upper-20250718.png
Normal file
After Width: | Height: | Size: 430 KiB |
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 494,
|
||||||
|
"ypos": 662,
|
||||||
|
"width": 43,
|
||||||
|
"height": 26,
|
||||||
|
"type": "match",
|
||||||
|
"click_point": {
|
||||||
|
"xpos": 15.5,
|
||||||
|
"ypos": 14
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_button_xunified"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_button_xunified-20250717.png
Normal file
After Width: | Height: | Size: 431 KiB |
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 458,
|
||||||
|
"ypos": 398,
|
||||||
|
"width": 65,
|
||||||
|
"height": 44,
|
||||||
|
"type": "match",
|
||||||
|
"match": 90
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_function_arg"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_function_arg-20250718.png
Normal file
After Width: | Height: | Size: 507 KiB |
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 458,
|
||||||
|
"ypos": 498,
|
||||||
|
"width": 60,
|
||||||
|
"height": 40,
|
||||||
|
"type": "match",
|
||||||
|
"match": 90
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_function_cos"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_function_cos-20250718.png
Normal file
After Width: | Height: | Size: 509 KiB |
@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"area": [
|
"area": [
|
||||||
{
|
{
|
||||||
"width": 22,
|
"xpos": 465,
|
||||||
|
"ypos": 471,
|
||||||
|
"width": 58,
|
||||||
"height": 25,
|
"height": 25,
|
||||||
"xpos": 434,
|
|
||||||
"ypos": 474,
|
|
||||||
"type": "match"
|
"type": "match"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"properties": [],
|
"properties": [],
|
||||||
"tags": [
|
"tags": [
|
||||||
"calc_button_bopen"
|
"calc_function_sqrt"
|
||||||
]
|
]
|
||||||
}
|
}
|
BIN
needles/gnome/apps/calculator/calc_function_sqrt-20250718.png
Normal file
After Width: | Height: | Size: 509 KiB |
15
needles/gnome/apps/calculator/calc_result_2997-20250717.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 344,
|
||||||
|
"ypos": 390,
|
||||||
|
"width": 118,
|
||||||
|
"height": 23,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_result_2997"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_result_2997-20250717.png
Normal file
After Width: | Height: | Size: 439 KiB |
15
needles/gnome/apps/calculator/calc_result_314-20250717.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 344,
|
||||||
|
"ypos": 389,
|
||||||
|
"width": 141,
|
||||||
|
"height": 24,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_result_314"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_result_314-20250717.png
Normal file
After Width: | Height: | Size: 506 KiB |
16
needles/gnome/apps/calculator/calc_result_6022-20250717.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 347,
|
||||||
|
"ypos": 390,
|
||||||
|
"width": 182,
|
||||||
|
"height": 25,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_result_6022",
|
||||||
|
"calc_result_6224"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_result_6022-20250717.png
Normal file
After Width: | Height: | Size: 445 KiB |
15
needles/gnome/apps/calculator/calc_result_9109-20250717.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 344,
|
||||||
|
"ypos": 389,
|
||||||
|
"width": 204,
|
||||||
|
"height": 19,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_result_9109"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_result_9109-20250717.png
Normal file
After Width: | Height: | Size: 443 KiB |
15
needles/gnome/apps/calculator/calc_result_9806-20250718.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 344,
|
||||||
|
"ypos": 388,
|
||||||
|
"width": 90,
|
||||||
|
"height": 22,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_result_9806"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_result_9806-20250718.png
Normal file
After Width: | Height: | Size: 447 KiB |
15
needles/gnome/apps/calculator/calc_result_arg-20250718.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 347,
|
||||||
|
"ypos": 385,
|
||||||
|
"width": 10,
|
||||||
|
"height": 32,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_result_arg"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_result_arg-20250718.png
Normal file
After Width: | Height: | Size: 506 KiB |
15
needles/gnome/apps/calculator/calc_result_cos-20250718.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 343,
|
||||||
|
"ypos": 386,
|
||||||
|
"width": 140,
|
||||||
|
"height": 27,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_result_cos"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_result_cos-20250718.png
Normal file
After Width: | Height: | Size: 514 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 344,
|
||||||
|
"ypos": 387,
|
||||||
|
"width": 23,
|
||||||
|
"height": 27,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_result_foursub"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_result_foursub-20250717.png
Normal file
After Width: | Height: | Size: 432 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 346,
|
||||||
|
"ypos": 385,
|
||||||
|
"width": 25,
|
||||||
|
"height": 32,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_result_sixteen"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_result_sixteen-20250717.png
Normal file
After Width: | Height: | Size: 500 KiB |
@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"area": [
|
"area": [
|
||||||
{
|
{
|
||||||
"xpos": 252,
|
"xpos": 347,
|
||||||
"ypos": 375,
|
"ypos": 387,
|
||||||
"width": 22,
|
"width": 135,
|
||||||
"height": 25,
|
"height": 25,
|
||||||
"type": "match"
|
"type": "match"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"properties": [],
|
"properties": [],
|
||||||
"tags": [
|
"tags": [
|
||||||
"calc_button_bopen"
|
"calc_result_sqrt"
|
||||||
]
|
]
|
||||||
}
|
}
|
BIN
needles/gnome/apps/calculator/calc_result_sqrt-20250718.png
Normal file
After Width: | Height: | Size: 437 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 405,
|
||||||
|
"ypos": 609,
|
||||||
|
"width": 132,
|
||||||
|
"height": 19,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_umenu_acceleration"
|
||||||
|
]
|
||||||
|
}
|
After Width: | Height: | Size: 522 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 405,
|
||||||
|
"ypos": 497,
|
||||||
|
"width": 121,
|
||||||
|
"height": 22,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_umenu_atomic"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_umenu_atomic-20250717.png
Normal file
After Width: | Height: | Size: 529 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 403,
|
||||||
|
"ypos": 605,
|
||||||
|
"width": 141,
|
||||||
|
"height": 22,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_umenu_avogadro"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_umenu_avogadro-20250717.png
Normal file
After Width: | Height: | Size: 453 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 403,
|
||||||
|
"ypos": 466,
|
||||||
|
"width": 131,
|
||||||
|
"height": 21,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_umenu_electromagnetic"
|
||||||
|
]
|
||||||
|
}
|
After Width: | Height: | Size: 528 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 403,
|
||||||
|
"ypos": 573,
|
||||||
|
"width": 100,
|
||||||
|
"height": 20,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_umenu_electronmass"
|
||||||
|
]
|
||||||
|
}
|
After Width: | Height: | Size: 446 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 404,
|
||||||
|
"ypos": 561,
|
||||||
|
"width": 77,
|
||||||
|
"height": 21,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_umenu_gravitation"
|
||||||
|
]
|
||||||
|
}
|
After Width: | Height: | Size: 537 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 402,
|
||||||
|
"ypos": 479,
|
||||||
|
"width": 88,
|
||||||
|
"height": 19,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_umenu_lightspeed"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_umenu_lightspeed-20250717.png
Normal file
After Width: | Height: | Size: 523 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 406,
|
||||||
|
"ypos": 432,
|
||||||
|
"width": 91,
|
||||||
|
"height": 23,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_umenu_mathematical"
|
||||||
|
]
|
||||||
|
}
|
After Width: | Height: | Size: 445 KiB |
15
needles/gnome/apps/calculator/calc_umenu_pi-20250717.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 401,
|
||||||
|
"ypos": 542,
|
||||||
|
"width": 34,
|
||||||
|
"height": 20,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_umenu_pi"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_umenu_pi-20250717.png
Normal file
After Width: | Height: | Size: 506 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 407,
|
||||||
|
"ypos": 531,
|
||||||
|
"width": 120,
|
||||||
|
"height": 18,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"calc_umenu_thermo"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/gnome/apps/calculator/calc_umenu_thermo-20250717.png
Normal file
After Width: | Height: | Size: 533 KiB |
@ -90,7 +90,7 @@ sub run {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub test_flags {
|
sub test_flags {
|
||||||
return {fatal => 1};
|
return {always_rollback => 1};
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
90
tests/applications/calculator/constants.pm
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
use base "installedtest";
|
||||||
|
use strict;
|
||||||
|
use testapi;
|
||||||
|
use utils;
|
||||||
|
|
||||||
|
# This script checks that Gnome Calculator
|
||||||
|
# can use pre-selected constants.
|
||||||
|
|
||||||
|
|
||||||
|
sub run {
|
||||||
|
my $self = shift;
|
||||||
|
# Wait until everything settles.
|
||||||
|
sleep 5;
|
||||||
|
|
||||||
|
# Check that upper index can be used
|
||||||
|
assert_and_click("calc_button_four");
|
||||||
|
assert_and_click("calc_button_upper");
|
||||||
|
assert_and_click("calc_button_two");
|
||||||
|
assert_and_click("calc_button_equals");
|
||||||
|
assert_screen("calc_result_sixteen");
|
||||||
|
assert_and_click("calc_button_clear");
|
||||||
|
|
||||||
|
# Check that lower index works
|
||||||
|
# I cannot think of a math expression that would use
|
||||||
|
# subscripts, so let's just check the button works.
|
||||||
|
assert_and_click("calc_button_four");
|
||||||
|
assert_and_click("calc_button_lower");
|
||||||
|
assert_and_click("calc_button_four");
|
||||||
|
assert_screen("calc_result_foursub");
|
||||||
|
assert_and_click("calc_button_clear");
|
||||||
|
|
||||||
|
# This will check the unified buttons that
|
||||||
|
# represents various mathematical expressions.
|
||||||
|
# We will only check a couple of them.
|
||||||
|
#
|
||||||
|
# Pi:
|
||||||
|
assert_and_click("calc_button_one");
|
||||||
|
assert_and_click("calc_button_xunified");
|
||||||
|
assert_and_click("calc_umenu_mathematical");
|
||||||
|
assert_and_click("calc_umenu_pi");
|
||||||
|
send_key("ret");
|
||||||
|
assert_screen("calc_result_314");
|
||||||
|
assert_and_click("calc_button_clear");
|
||||||
|
|
||||||
|
# Lightspeed
|
||||||
|
assert_and_click("calc_button_one");
|
||||||
|
assert_and_click("calc_button_multi");
|
||||||
|
assert_and_click("calc_button_xunified");
|
||||||
|
assert_and_click("calc_umenu_electromagnetic");
|
||||||
|
assert_and_click("calc_umenu_lightspeed");
|
||||||
|
send_key("ret");
|
||||||
|
assert_screen("calc_result_2997");
|
||||||
|
assert_and_click("calc_button_clear");
|
||||||
|
|
||||||
|
# Electron mass
|
||||||
|
assert_and_click("calc_button_one");
|
||||||
|
assert_and_click("calc_button_xunified");
|
||||||
|
assert_and_click("calc_umenu_atomic");
|
||||||
|
assert_and_click("calc_umenu_electronmass");
|
||||||
|
send_key("ret");
|
||||||
|
assert_screen("calc_result_9109");
|
||||||
|
assert_and_click("calc_button_clear");
|
||||||
|
|
||||||
|
# Avogadro
|
||||||
|
assert_and_click("calc_button_one");
|
||||||
|
assert_and_click("calc_button_xunified");
|
||||||
|
assert_and_click("calc_umenu_thermo");
|
||||||
|
assert_and_click("calc_umenu_avogadro");
|
||||||
|
send_key("ret");
|
||||||
|
assert_screen("calc_result_6022");
|
||||||
|
assert_and_click("calc_button_clear");
|
||||||
|
|
||||||
|
# Earth acceleration
|
||||||
|
assert_and_click("calc_button_one");
|
||||||
|
assert_and_click("calc_button_xunified");
|
||||||
|
assert_and_click("calc_umenu_gravitation");
|
||||||
|
assert_and_click("calc_umenu_acceleration");
|
||||||
|
send_key("ret");
|
||||||
|
assert_screen("calc_result_9806");
|
||||||
|
assert_and_click("calc_button_clear");
|
||||||
|
}
|
||||||
|
|
||||||
|
sub test_flags {
|
||||||
|
return {always_rollback => 1};
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
# vim: set sw=4 et:
|
||||||
|
|
37
tests/applications/calculator/functions.pm
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
use base "installedtest";
|
||||||
|
use strict;
|
||||||
|
use testapi;
|
||||||
|
use utils;
|
||||||
|
|
||||||
|
# This script checks that Gnome Calculator
|
||||||
|
# can use pre-selected functions.
|
||||||
|
|
||||||
|
sub use_function {
|
||||||
|
my $function = shift;
|
||||||
|
assert_and_click("calc_button_fxunified");
|
||||||
|
send_key_until_needlematch("calc_function_$function", "down", 50);
|
||||||
|
click_lastmatch();
|
||||||
|
assert_and_click("calc_button_five");
|
||||||
|
send_key("ret");
|
||||||
|
assert_screen("calc_result_$function");
|
||||||
|
assert_and_click("calc_button_clear");
|
||||||
|
}
|
||||||
|
|
||||||
|
sub run {
|
||||||
|
my $self = shift;
|
||||||
|
# Wait until everything settles.
|
||||||
|
sleep 5;
|
||||||
|
|
||||||
|
use_function("sqrt");
|
||||||
|
use_function("arg");
|
||||||
|
use_function("cos");
|
||||||
|
}
|
||||||
|
|
||||||
|
sub test_flags {
|
||||||
|
return {always_rollback => 1};
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
# vim: set sw=4 et:
|
||||||
|
|
@ -1,102 +0,0 @@
|
|||||||
use base "installedtest";
|
|
||||||
use strict;
|
|
||||||
use testapi;
|
|
||||||
use utils;
|
|
||||||
|
|
||||||
# This script checks that Gnome Calculator works in Basic mode.
|
|
||||||
|
|
||||||
# This subroutine rewrites the number into a word.
|
|
||||||
sub rewrite {
|
|
||||||
my $number = shift;
|
|
||||||
my %numbers = (
|
|
||||||
0 => 'zero',
|
|
||||||
1 => 'one',
|
|
||||||
2 => 'two',
|
|
||||||
3 => 'three',
|
|
||||||
4 => 'four',
|
|
||||||
5 => 'five',
|
|
||||||
6 => 'six',
|
|
||||||
7 => 'seven',
|
|
||||||
8 => 'eight',
|
|
||||||
9 => 'nine',
|
|
||||||
"." => 'divider',
|
|
||||||
"%" => 'percent',
|
|
||||||
"p" => 'pi',
|
|
||||||
"r" => 'root',
|
|
||||||
"s" => 'square'
|
|
||||||
);
|
|
||||||
my $rewritten = $numbers{$number};
|
|
||||||
return $rewritten;
|
|
||||||
}
|
|
||||||
|
|
||||||
# This subroutine performs the clicking of simple operations
|
|
||||||
# in the Calculator.
|
|
||||||
sub calculate {
|
|
||||||
my ($a, $b, $operation) = @_;
|
|
||||||
# Create lists of the numbers.
|
|
||||||
my @first = split('', $a);
|
|
||||||
my @second = split('', $b);
|
|
||||||
|
|
||||||
# For each digit of the first number, click on
|
|
||||||
# the corresponding button.
|
|
||||||
foreach (@first) {
|
|
||||||
my $word = rewrite($_);
|
|
||||||
assert_and_click("calc_button_$word");
|
|
||||||
}
|
|
||||||
# Click the operation button.
|
|
||||||
assert_and_click("calc_button_$operation");
|
|
||||||
# For each digit of the second number, click on
|
|
||||||
# the corresponding button.
|
|
||||||
foreach (@second) {
|
|
||||||
my $word = rewrite($_);
|
|
||||||
assert_and_click("calc_button_$word");
|
|
||||||
}
|
|
||||||
# Click on the Equals button
|
|
||||||
assert_and_click("calc_button_equals");
|
|
||||||
# Assert the result has appeared on the screen.
|
|
||||||
my $identifier = hashed_string("$a-$operation-$b");
|
|
||||||
assert_screen("calc_result_$identifier");
|
|
||||||
# Clear the display.
|
|
||||||
send_key("esc");
|
|
||||||
}
|
|
||||||
|
|
||||||
sub run {
|
|
||||||
my $self = shift;
|
|
||||||
# Wait until everything settles.
|
|
||||||
sleep 5;
|
|
||||||
# Check that two numbers can be added.
|
|
||||||
calculate("10", "23", "add");
|
|
||||||
# Check that two numbers can be subtracted.
|
|
||||||
calculate("67", "45", "sub");
|
|
||||||
# Check that two numbers can be multiplied.
|
|
||||||
calculate("9", "0.8", "multi");
|
|
||||||
# Check that two numbers can be divided.
|
|
||||||
calculate("77", "7", "div");
|
|
||||||
# Check that two numbers can be divided using modulo.
|
|
||||||
calculate("28", "5", "mod");
|
|
||||||
# Check that you can use percents
|
|
||||||
calculate("33%", "90", "multi");
|
|
||||||
|
|
||||||
# Check that you can use brackets
|
|
||||||
assert_and_click("calc_button_three");
|
|
||||||
assert_and_click("calc_button_multi");
|
|
||||||
assert_and_click("calc_button_bopen");
|
|
||||||
assert_and_click("calc_button_two");
|
|
||||||
assert_and_click("calc_button_add");
|
|
||||||
assert_and_click("calc_button_three");
|
|
||||||
assert_and_click("calc_button_bclose");
|
|
||||||
assert_and_click("calc_button_equals");
|
|
||||||
my $identifier = hashed_string("3*(3+2)");
|
|
||||||
assert_screen("calc_result_$identifier");
|
|
||||||
send_key("esc");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
sub test_flags {
|
|
||||||
return {fatal => 1};
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
|
||||||
|
|
||||||
# vim: set sw=4 et:
|
|
||||||
|
|