]> SALOME platform Git repositories - modules/shaper.git/blob - test.squish/suite_PYTHONAPI_SALOME/tst_Platine/test.py
Salome HOME
NewGeom is renamed to SHAPER
[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     test.vp("VP_TREE")
46
47     # [step] Change parameter values: L = 64, E = 5, P = 80
48     set_parameter_value("L", 64)
49     set_parameter_value("E", 5)
50     set_parameter_value("P", 80)
51     clickButton(waitForObject(":SALOME*.Fit All_QToolButton"))
52     mouseMove(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 320, 240)
53     test.vp("VP_PLATINE_E")
54
55     # [step] Change parameter values: L = 90, E = 20, P = 80
56     set_parameter_value("L", 90)
57     set_parameter_value("E", 20)
58     set_parameter_value("P", 80)
59     clickButton(waitForObject(":SALOME*.Fit All_QToolButton"))
60     mouseMove(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 320, 240)
61     test.vp("VP_PLATINE_L")
62
63     # [step] Change parameter values: L = 64, E = 20, P = 120
64     set_parameter_value("L", 64)
65     set_parameter_value("E", 20)
66     set_parameter_value("P", 120)
67     clickButton(waitForObject(":SALOME*.Fit All_QToolButton"))
68     mouseMove(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 320, 240)
69     test.vp("VP_PLATINE_P")
70
71     # [step] Close application
72     close_application()