1 # Copyright (C) 2015-2020 CEA/DEN, EDF R&D
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 testSettings.logScreenshotOnError = True
20 testSettings.logScreenshotOnFail = True
22 g_points = {"XY_plane": (320, 320)} # one of the construction planes
23 def help_points(name):
27 waitForObject(":OpenParts*_AppElements_MainWindow").resize(1024, 768)
29 def close_application():
30 sendEvent("QCloseEvent", waitForObject(":OpenParts*_AppElements_MainWindow"))
31 if object.exists(":Save current file.Discard_QPushButton"):
32 clickButton(waitForObject(":Save current file.Discard_QPushButton"))
34 def parameter_create(name, expression):
35 clickButton(waitForObject(":Parameters.Parameter_AppElements_Button"))
36 type(waitForObject(":Parameter_QLineEdit"), name)
37 type(waitForObject(":Parameter_ExpressionEditor"), expression)
38 clickButton(waitForObject(":Parameter.property_panel_ok_QToolButton"))
41 clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Part")
42 clickButton(waitForObject(":Operations.New part_AppElements_Button"))
44 def sketch_create(point, actions):
45 clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Sketch")
46 clickButton(waitForObject(":Basic.Sketch_AppElements_Button"))
47 mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point[0], point[1], 0, Qt.LeftButton)
51 clickButton(waitForObject(":Sketch.Ok_QToolButton"))
53 def point_create(point):
54 clickButton(waitForObject(":Basic.Point_AppElements_Button"))
56 type(waitForObject(":Point.X:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
57 type(waitForObject(":Point.X:_ModuleBase_ParamSpinBox"), point[0])
58 type(waitForObject(":Point.Y:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
59 type(waitForObject(":Point.Y:_ModuleBase_ParamSpinBox"), point[1])
61 clickButton(waitForObject(":Point.property_panel_ok_QToolButton"))
63 def line_create(start_point, end_point):
64 clickButton(waitForObject(":Basic.Line_AppElements_Button"))
66 type(waitForObject(":Start point.X:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
67 type(waitForObject(":Start point.X:_ModuleBase_ParamSpinBox"), start_point[0])
68 type(waitForObject(":Start point.Y:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
69 type(waitForObject(":Start point.Y:_ModuleBase_ParamSpinBox"), start_point[1])
71 type(waitForObject(":End point.X:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
72 type(waitForObject(":End point.X:_ModuleBase_ParamSpinBox"), end_point[0])
73 type(waitForObject(":End point.Y:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
74 type(waitForObject(":End point.Y:_ModuleBase_ParamSpinBox"), end_point[1])
76 clickButton(waitForObject(":Line.property_panel_ok_QToolButton"))
78 def line_create_in_view(start_point, end_point):
79 clickButton(waitForObject(":Basic.Line_AppElements_Button"))
81 mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), start_point[0], start_point[1], 0, Qt.LeftButton)
82 mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), end_point[0], end_point[1], 0, Qt.LeftButton)
84 def auxiliary_line_create(start_point, end_point):
85 clickButton(waitForObject(":Basic.Line_AppElements_Button"))
86 clickButton(waitForObject(":Line.Auxiliary_QCheckBox"))
88 type(waitForObject(":Start point.X:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
89 type(waitForObject(":Start point.X:_ModuleBase_ParamSpinBox"), start_point[0])
90 type(waitForObject(":Start point.Y:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
91 type(waitForObject(":Start point.Y:_ModuleBase_ParamSpinBox"), start_point[1])
93 type(waitForObject(":End point.X:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
94 type(waitForObject(":End point.X:_ModuleBase_ParamSpinBox"), end_point[0])
95 type(waitForObject(":End point.Y:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
96 type(waitForObject(":End point.Y:_ModuleBase_ParamSpinBox"), end_point[1])
98 #clickButton(waitForObject(":Line.property_panel_ok_QToolButton"))
100 def circle_create(x, y, radius):
101 clickButton(waitForObject(":Basic.Circle_AppElements_Button"))
103 type(waitForObject(":Center.X:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
104 type(waitForObject(":Center.X:_ModuleBase_ParamSpinBox"), x)
105 type(waitForObject(":Center.Y:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
106 type(waitForObject(":Center.Y:_ModuleBase_ParamSpinBox"), y)
108 type(waitForObject(":Circle.CircleRadius_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
109 type(waitForObject(":Circle.CircleRadius_ModuleBase_ParamSpinBox"), radius)
111 clickButton(waitForObject(":Circle.property_panel_ok_QToolButton"))
113 def circle_create_in_view(point_1, point_2):
114 clickButton(waitForObject(":Basic.Circle_AppElements_Button"))
116 mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_1[0], point_1[1], 0, Qt.LeftButton)
117 mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_2[0], point_2[1], 0, Qt.LeftButton)
119 clickButton(waitForObject(":Basic.Circle_AppElements_Button"))
121 def distance_create(point_1, point_2, annotaion_point, distance):
122 clickButton(waitForObject(":Constraints.Distance_AppElements_Button"))
124 mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_1[0], point_1[1], 0, Qt.LeftButton)
125 mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_2[0], point_2[1], 0, Qt.LeftButton)
126 mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), annotaion_point[0], annotaion_point[1], 0, Qt.LeftButton) # move annotation
128 type(waitForObject(":_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
129 type(waitForObject(":_ModuleBase_ParamSpinBox"), distance)
130 type(waitForObject(":_ModuleBase_ParamSpinBox"), "<Keypad_Enter>")
132 clickButton(waitForObject(":Constraints.Distance_AppElements_Button"))
134 def parallel_create(point_1, point_2):
135 clickButton(waitForObject(":Constraints.Parallel_AppElements_Button"))
137 mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_1[0], point_1[1], 0, Qt.LeftButton)
138 mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_2[0], point_2[1], 0, Qt.LeftButton)
140 clickButton(waitForObject(":Constraints.Parallel_AppElements_Button"))
142 def perpendicular_create(point_1, point_2):
143 clickButton(waitForObject(":Constraints.Perpendicular_AppElements_Button"))
145 mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_1[0], point_1[1], 0, Qt.LeftButton)
146 mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_2[0], point_2[1], 0, Qt.LeftButton)
148 clickButton(waitForObject(":Perpendicular.property_panel_cancel_QToolButton"))
150 def horizontal_create(point_1):
151 clickButton(waitForObject(":Constraints.Horizontal_AppElements_Button"))
153 mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_1[0], point_1[1], 0, Qt.LeftButton)
155 clickButton(waitForObject(":Constraints.Horizontal_AppElements_Button"))
157 def vertical_create(point_1):
158 cclickButton(waitForObject(":Constraints.Vertical_AppElements_Button"))
160 mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_1[0], point_1[1], 0, Qt.LeftButton)
162 clickButton(waitForObject(":Constraints.Vertical_AppElements_Button"))
164 def radius_create(point_1, point_2, radius):
165 clickButton(waitForObject(":Constraints.Radius_AppElements_Button"))
167 mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_1[0], point_1[1], 0, Qt.LeftButton)
168 mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_2[0], point_2[1], 0, Qt.LeftButton)
169 type(waitForObject(":_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
170 type(waitForObject(":_ModuleBase_ParamSpinBox"), radius)
171 type(waitForObject(":_ModuleBase_ParamSpinBox"), "<Keypad_Enter>")
173 clickButton(waitForObject(":Constraints.Radius_AppElements_Button"))
176 clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Part")
177 clickButton(waitForObject(":Operations.New part_AppElements_Button"))
179 def extrusion_feature(points, to_size=0, from_size=0):
180 clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Features")
181 clickButton(waitForObject(":Extrusion.Extrusion_AppElements_Button"))
183 mouseClick(waitForObject(":Extrusion.Select a sketch face_QListWidget"), 10, 10, 0, Qt.LeftButton)
185 mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point[0], point[1], 0, Qt.LeftButton)
187 type(waitForObject(":to_size_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
188 type(waitForObject(":to_size_ModuleBase_ParamSpinBox"), to_size)
190 type(waitForObject(":Extrusion.from_size_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
191 type(waitForObject(":Extrusion.from_size_ModuleBase_ParamSpinBox"), from_size)
193 clickButton(waitForObject(":Extrusion.property_panel_ok_QToolButton"))
195 def extrusion_cut_by_sizes_feature(point, actions, to_size, from_size):
196 clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Features")
197 clickButton(waitForObject(":Extrusion.ExtrusionCut_AppElements_Button"))
199 mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point[0], point[1], 0, Qt.LeftButton)
203 clickButton(waitForObject(":Sketch.Ok_QToolButton"))
205 type(waitForObject(":Extrusion.to_size_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
206 type(waitForObject(":Extrusion.to_size_ModuleBase_ParamSpinBox"), to_size)
208 type(waitForObject(":Extrusion.from_size_ModuleBase_ParamSpinBox_2"), "<Ctrl+A>")
209 type(waitForObject(":Extrusion.from_size_ModuleBase_ParamSpinBox_2"), from_size)
211 clickButton(waitForObject(":ExtrusionCut.property_panel_ok_QToolButton"))
212 #clickButton(waitForObject(":Sketch.property_panel_cancel_QToolButton"))
214 def extrusion_fuse_by_sizes_feature(point, actions, to_size, from_size):
216 clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Features")
217 clickButton(waitForObject(":Extrusion.ExtrusionFuse_AppElements_Button"))
219 mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point[0], point[1], 0, Qt.LeftButton)
223 clickButton(waitForObject(":Sketch.Ok_QToolButton"))
225 type(waitForObject(":Extrusion.to_size_ModuleBase_ParamSpinBox_2"), "<Ctrl+A>")
226 type(waitForObject(":Extrusion.to_size_ModuleBase_ParamSpinBox_2"), to_size)
228 type(waitForObject(":Extrusion.from_size_ModuleBase_ParamSpinBox_3"), "<Ctrl+A>")
229 type(waitForObject(":Extrusion.from_size_ModuleBase_ParamSpinBox_3"), from_size)
231 clickButton(waitForObject(":ExtrusionFuse.property_panel_ok_QToolButton"))
232 #clickButton(waitForObject(":Sketch.property_panel_cancel_QToolButton"))