Salome HOME
squish tests correction: processing on debian
[modules/shaper.git] / test.squish / suite_PYTHONAPI_SALOME / tst_Platine / test.py
1 def set_parameter_value(name, value):
2     openContextMenu(waitForObject(":Parameters.%s = _QModelIndex" % name), 10, 10, 0)
3     activateItem(waitForObjectItem(":_QMenu", "Edit..."))
4     mouseClick(waitForObject(":Parameter_ExpressionEditor"), 10, 10, 0, Qt.LeftButton)
5     type(waitForObject(":Parameter_ExpressionEditor"), "<Ctrl+A>")
6     type(waitForObject(":Parameter_ExpressionEditor"), value)
7     type(waitForObject(":Parameter_ExpressionEditor"), "<Return>")
8     clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton"))
9
10 def main():
11     # [project] SHAPER
12     # [Scenario] 'Platine' model created by PythonAPI
13     # [Topic] PythonAPI functionality
14     # [Tested functionality]
15     # [Summary description]
16     # [Expected results]
17     # [General comments]
18
19     source(findFile("scripts", "common.py"))
20
21     # [section] Application start
22     # [step] Launch SALOME
23     startApplication("salome_run.sh")
24
25     set_defaults()
26
27     # [step] Activate Shaper module and create new file
28     activate_SHAPER()
29
30     # [step] In Python console type: import examples.Platine
31     type(waitForObject(":Python Console_PyConsole_EnhEditor"), "import examples.Platine")
32     type(waitForObject(":Python Console_PyConsole_EnhEditor"), "<Return>")
33
34     # [step] Check that the model is correct [vp VP_PLATINE]
35     clickButton(waitForObject(":SALOME*.Fit All_QToolButton"))
36     test.vp("VP_PLATINE")
37
38     # [step] Check that the object browser contains all objects from the model [vp VP_TREE]
39     waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Parameters (3)")
40     clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Parameters (3)", -10, 10, 0, Qt.LeftButton)
41     waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Constructions (3)")
42     clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Constructions (3)", -10, 10, 0, Qt.LeftButton)
43     waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Bodies (1)")
44     clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Bodies (1)", -10, 10, 0, Qt.LeftButton)
45     # Tree is under modification, so it can not be checked by a picture
46     # Moreover a mask for a text should be provided to check it on different platforms
47     #test.vp("VP_TREE")
48
49     # [step] Change parameter values: L = 64, E = 5, P = 80
50     set_parameter_value("L", 64)
51     set_parameter_value("E", 5)
52     set_parameter_value("P", 80)
53     clickButton(waitForObject(":SALOME*.Fit All_QToolButton"))
54     mouseMove(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 320, 240)
55     test.vp("VP_PLATINE_E")
56
57     # [step] Change parameter values: L = 90, E = 20, P = 80
58     set_parameter_value("L", 90)
59     set_parameter_value("E", 20)
60     set_parameter_value("P", 80)
61     clickButton(waitForObject(":SALOME*.Fit All_QToolButton"))
62     mouseMove(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 320, 240)
63     test.vp("VP_PLATINE_L")
64
65     # [step] Change parameter values: L = 64, E = 20, P = 120
66     set_parameter_value("L", 64)
67     set_parameter_value("E", 20)
68     set_parameter_value("P", 120)
69     clickButton(waitForObject(":SALOME*.Fit All_QToolButton"))
70     mouseMove(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 320, 240)
71     test.vp("VP_PLATINE_P")
72
73     # [step] Close application
74     close_application()