Salome HOME
updated copyright message
[modules/shaper.git] / test.squish / suite_FEATURE_REVOLUTION / tst_revolution_005 / test.py
1 # Copyright (C) 2014-2023  CEA, EDF
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 def main():
21     # [project] SHAPER
22     # [Scenario] Revolution_005
23     # [Topic] 'RevolutionFuse by planes and offsets' functionality
24     # [Tested functionality]
25     # [Summary description]
26     # [Expected results]
27     # [General comments]
28
29     source(findFile("scripts", "common.py"))
30
31     # [section] Application start
32     # [step] Launch SALOME
33     startApplication("salome_run.sh")
34
35     set_defaults()
36
37     # [step] Open 'for_revolution_005.hdf'
38     open(DATA_PATH + "/for_revolution_005.hdf")
39
40     # [step] Activate SHAPER
41     clickButton(waitForObject(":SALOME*.Shaper_QToolButton"))
42
43     # [step] Activate Part_1
44     waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)")
45     clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 71, 10, 0, Qt.LeftButton)
46     openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 70, 9, 0)
47     activateItem(waitForObjectItem(":_QMenu", "Activate"))
48
49     # [step] Fit all [vp INIT]
50     fit_all()
51     test.vp("INIT")
52
53     # [step] Execute RevolutionFuse operation
54     mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Features"))
55     mouseClick(waitForObjectItem(":_QMenu", "RevolutionFuse"))
56
57     # [step] Select sketch face
58     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 287, 236, 0, Qt.LeftButton)
59
60     # [step] Click "Set plane view" in property panel [vp PLANE]
61     clickButton(waitForObject(":Sketcher plane.Set plane view_QPushButton"))
62     test.vp("PLANE")
63
64     # [step] Create 2 circles on the plane [vp CIRCLES]
65     activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch"))
66     activateItem(waitForObjectItem(":Sketch_QMenu", "Circle"))
67     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 400, 340, 0, Qt.LeftButton)
68     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 400, 370, 0, Qt.LeftButton)
69     clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton"))
70
71     activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch"))
72     activateItem(waitForObjectItem(":Sketch_QMenu", "Circle"))
73     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 400, 130, 0, Qt.LeftButton)
74     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 400, 150, 0, Qt.LeftButton)
75     clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton"))
76
77     test.vp("CIRCLES")
78
79     # [step] Approve sketching
80     clickButton(waitForObject(":Sketch.property_panel_ok_QToolButton"))
81
82     # [step] Select axis for revolution
83     mouseClick(waitForObject(":Revolution_QLineEdit_2"), 10, 10, 0, Qt.LeftButton)
84     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 651, 219, 0, Qt.LeftButton)
85
86     # [step] Click 'Reset view' toolbar button [vp RESET]
87     clickButton(waitForObject(":SALOME*.Reset_QToolButton_2"))
88     mouseClick(waitForObject(":SALOME*_OCCViewer_ViewPort3d"), 10, 450, 0, Qt.LeftButton)  # close tool bar extension bar
89
90     fit_all()
91     test.vp("RESET")
92
93     # [step] Select revolution method 'By planes'
94     snooze(1)
95     clickButton(waitForObject(":Revolution_QToolButton_3"))
96
97     # [step] Select face 'To' (biggest one)
98     mouseClick(waitForObject(":To_QLineEdit_3"), 56, 5, 0, Qt.LeftButton)
99     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 209, 30, 0, Qt.LeftButton)
100
101     # [step] Fit all
102
103     # [check] Check that preview is updated [vp PLANE_TO]
104     fit_all()
105     test.vp("PLANE_TO")
106
107     # [step] Define offset for face 'To'
108     mouseClick(waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit_3"), 10, 10, 0, Qt.LeftButton)
109     type(waitForObject(":To.to_offset_ModuleBase_ParamSpinBox_3"), "<Ctrl+A>")
110     type(waitForObject(":To.to_offset_ModuleBase_ParamSpinBox_3"), 30)
111     type(waitForObject(":To.to_offset_ModuleBase_ParamSpinBox_3"), "<Return>")
112
113     # [check] Check that preview is updated [vp PLANE_TO]
114     fit_all()
115     test.vp("PLANE_TO_30")
116
117     # [step] Select face 'From' (smallest one)
118
119     mouseClick(waitForObject(":From_QLineEdit_3"), 32, 10, 0, Qt.LeftButton)
120     sendEvent("QMouseEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), QEvent.MouseButtonPress, 518, 361, Qt.LeftButton, 1, 0)
121     sendEvent("QMouseEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), QEvent.MouseButtonRelease, 518, 361, Qt.LeftButton, 0, 0)
122
123     # [check] Check that preview is updated [vp PLANE_FROM]
124     fit_all()
125     test.vp("PLANE_FROM")
126
127     # [step] Define offset for face 'From'
128     mouseClick(waitForObject(":Revolution.qt_spinbox_lineedit_QLineEdit_4"), 38, 4, 0, Qt.LeftButton)
129     type(waitForObject(":From.from_offset_ModuleBase_ParamSpinBox_3"), "<Ctrl+A>")
130     type(waitForObject(":From.from_offset_ModuleBase_ParamSpinBox_3"), 45)
131     type(waitForObject(":From.from_offset_ModuleBase_ParamSpinBox_3"), "<Return>")
132
133     # [check] Check that preview is updated [vp PLANE_FROM_45]
134     fit_all()
135     test.vp("PLANE_FROM_45")
136
137     # [step] Apply the feature
138     clickButton(waitForObject(":RevolutionFuse.property_panel_ok_QToolButton"))
139
140     # [step] Fit all
141     fit_all()
142     test.vp("REVOLUTION_FUSE")
143
144     # [step] Close application without saving
145     close_application()