Salome HOME
9b593873fc58fd37cdcb91d0f3ba07046f6ebe87
[modules/shaper.git] / test.squish / suite_FEATURE_REVOLUTION / tst_revolution_005 / test.py
1 def main():
2     # [project] SHAPER
3     # [Scenario] Revolution_005
4     # [Topic] 'RevolutionFuse by planes and offsets' functionality
5     # [Tested functionality]
6     # [Summary description]
7     # [Expected results]
8     # [General comments]
9
10     source(findFile("scripts", "common.py"))
11
12     # [section] Application start
13     # [step] Launch SALOME
14     startApplication("salome_run.sh")
15
16     set_defaults()
17
18     # [step] Open 'for_revolution_005.hdf'
19     open(DATA_PATH + "/for_revolution_005.hdf")
20
21     # [step] Activate SHAPER
22     clickButton(waitForObject(":SALOME*.SHAPER_QToolButton"))
23
24     # [step] Activate Part_1
25     waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)")
26     clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 71, 10, 0, Qt.LeftButton)
27     openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 70, 9, 0)
28     activateItem(waitForObjectItem(":_QMenu", "Activate"))
29
30     # [step] Fit all [vp INIT]
31     fit_all()
32     test.vp("INIT")
33
34     # [step] Execute RevolutionFuse operation
35     mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Features"))
36     mouseClick(waitForObjectItem(":_QMenu", "RevolutionFuse"))
37
38     # [step] Select sketch face
39     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 287, 236, 0, Qt.LeftButton)
40
41     # [step] Click "Set plane view" in property panel [vp PLANE]
42     clickButton(waitForObject(":Sketcher plane.Set plane view_QPushButton"))
43     test.vp("PLANE")
44
45     # [step] Create 2 circles on the plane [vp CIRCLES]
46     activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch"))
47     activateItem(waitForObjectItem(":Sketch_QMenu", "Circle"))
48     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 400, 340, 0, Qt.LeftButton)
49     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 400, 370, 0, Qt.LeftButton)
50     clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton"))
51
52     activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch"))
53     activateItem(waitForObjectItem(":Sketch_QMenu", "Circle"))
54     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 400, 130, 0, Qt.LeftButton)
55     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 400, 150, 0, Qt.LeftButton)
56     clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton"))
57
58     test.vp("CIRCLES")
59
60     # [step] Approve sketching
61     clickButton(waitForObject(":Sketch.property_panel_ok_QToolButton"))
62
63     # [step] Select axis for revolution
64     mouseClick(waitForObject(":Revolution_QLineEdit_2"), 10, 10, 0, Qt.LeftButton)
65     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 651, 219, 0, Qt.LeftButton)
66
67     # [step] Click 'Reset view' toolbar button [vp RESET]
68     clickButton(waitForObject(":SALOME*.Reset_QToolButton_2"))
69     mouseClick(waitForObject(":SALOME*_OCCViewer_ViewPort3d"), 10, 450, 0, Qt.LeftButton)  # close tool bar extension bar
70
71     fit_all()
72     test.vp("RESET")
73
74     # [step] Select revolution method 'By planes'
75     snooze(1)
76     clickButton(waitForObject(":Revolution_QToolButton_3"))
77
78     # [step] Select face 'To' (biggest one)
79     mouseClick(waitForObject(":To_QLineEdit_3"), 10, 10, 0, Qt.LeftButton)
80     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 463, 171, 0, Qt.LeftButton)
81
82     # [step] Fit all
83
84     # [check] Check that preview is updated [vp PLANE_TO]
85     fit_all()
86     test.vp("PLANE_TO")
87
88     # [step] Define offset for face 'To'
89     mouseClick(waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit_3"), 10, 10, 0, Qt.LeftButton)
90     type(waitForObject(":To.to_offset_ModuleBase_ParamSpinBox_3"), "<Ctrl+A>")
91     type(waitForObject(":To.to_offset_ModuleBase_ParamSpinBox_3"), 30)
92     type(waitForObject(":To.to_offset_ModuleBase_ParamSpinBox_3"), "<Return>")
93
94     # [check] Check that preview is updated [vp PLANE_TO]
95     fit_all()
96     test.vp("PLANE_TO_30")
97
98     # [step] Select face 'From' (smallest one)
99     mouseClick(waitForObject(":From_QLineEdit_3"), 10, 10, 0, Qt.LeftButton)
100     sendEvent("QMouseEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), QEvent.MouseButtonPress, 504, 252, Qt.LeftButton, 1, 0)
101     sendEvent("QMouseEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), QEvent.MouseButtonRelease, 504, 252, Qt.LeftButton, 0, 0)
102
103     # [check] Check that preview is updated [vp PLANE_FROM]
104     fit_all()
105     test.vp("PLANE_FROM")
106
107     # [step] Define offset for face 'From'
108     mouseClick(waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit_4"), 38, 4, 0, Qt.LeftButton)
109     type(waitForObject(":From.from_offset_ModuleBase_ParamSpinBox_3"), "<Ctrl+A>")
110     type(waitForObject(":From.from_offset_ModuleBase_ParamSpinBox_3"), 45)
111     type(waitForObject(":From.from_offset_ModuleBase_ParamSpinBox_3"), "<Return>")
112
113     # [check] Check that preview is updated [vp PLANE_FROM_45]
114     fit_all()
115     test.vp("PLANE_FROM_45")
116
117     # [step] Apply the feature
118     clickButton(waitForObject(":RevolutionFuse.property_panel_ok_QToolButton"))
119
120     # [step] Fit all
121     fit_all()
122     test.vp("REVOLUTION_FUSE")
123
124     # [step] Close application without saving
125     close_application()