Salome HOME
squish tests correction: EXTRUSION/REVOLUTION/PYTHON: highlight, text in VPs
[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"), 56, 5, 0, Qt.LeftButton)
80     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 209, 30, 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
100     mouseClick(waitForObject(":From_QLineEdit_3"), 32, 10, 0, Qt.LeftButton)
101     sendEvent("QMouseEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), QEvent.MouseButtonPress, 518, 361, Qt.LeftButton, 1, 0)
102     sendEvent("QMouseEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), QEvent.MouseButtonRelease, 518, 361, Qt.LeftButton, 0, 0)
103
104     # [check] Check that preview is updated [vp PLANE_FROM]
105     fit_all()
106     test.vp("PLANE_FROM")
107
108     # [step] Define offset for face 'From'
109     mouseClick(waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit_4"), 38, 4, 0, Qt.LeftButton)
110     type(waitForObject(":From.from_offset_ModuleBase_ParamSpinBox_3"), "<Ctrl+A>")
111     type(waitForObject(":From.from_offset_ModuleBase_ParamSpinBox_3"), 45)
112     type(waitForObject(":From.from_offset_ModuleBase_ParamSpinBox_3"), "<Return>")
113
114     # [check] Check that preview is updated [vp PLANE_FROM_45]
115     fit_all()
116     test.vp("PLANE_FROM_45")
117
118     # [step] Apply the feature
119     clickButton(waitForObject(":RevolutionFuse.property_panel_ok_QToolButton"))
120
121     # [step] Fit all
122     fit_all()
123     test.vp("REVOLUTION_FUSE")
124
125     # [step] Close application without saving
126     close_application()