Salome HOME
Set standard window size
[modules/shaper.git] / test.squish / suite_ISSUES / shared / scripts / common.py
1 testSettings.logScreenshotOnError = True
2 testSettings.logScreenshotOnFail = True
3
4 g_points = {"XY_plane": (320, 320)} # one of the construction planes
5 def help_points(name):
6     return g_points[name] 
7
8 def set_defaults():
9     waitForObject(":OpenParts*_AppElements_MainWindow").resize(1024, 768)
10
11 def parameter_create(name, expression):
12     clickButton(waitForObject(":Parameters.Parameter_AppElements_Button"))
13     type(waitForObject(":Parameter_QLineEdit"), name)
14     type(waitForObject(":Parameter_ExpressionEditor"), expression)
15     clickButton(waitForObject(":Parameter.property_panel_ok_QToolButton"))
16
17 def part_create():
18     clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Part")
19     clickButton(waitForObject(":Operations.New part_AppElements_Button"))
20     
21 def sketch_create(point, actions):
22     clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Sketch")
23     clickButton(waitForObject(":Basic.Sketch_AppElements_Button"))
24     mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point[0], point[1], 0, Qt.LeftButton)
25     
26     actions()
27     
28     clickButton(waitForObject(":Sketch.Ok_QToolButton"))
29
30 def point_create(point):
31     clickButton(waitForObject(":Basic.Point_AppElements_Button"))
32
33     type(waitForObject(":Point.X:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
34     type(waitForObject(":Point.X:_ModuleBase_ParamSpinBox"), point[0])
35     type(waitForObject(":Point.Y:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
36     type(waitForObject(":Point.Y:_ModuleBase_ParamSpinBox"), point[1])
37
38     clickButton(waitForObject(":Point.property_panel_ok_QToolButton"))       
39
40 def line_create(start_point, end_point):
41     clickButton(waitForObject(":Basic.Line_AppElements_Button"))
42
43     type(waitForObject(":Start point.X:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
44     type(waitForObject(":Start point.X:_ModuleBase_ParamSpinBox"), start_point[0])
45     type(waitForObject(":Start point.Y:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
46     type(waitForObject(":Start point.Y:_ModuleBase_ParamSpinBox"), start_point[1])
47
48     type(waitForObject(":End point.X:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
49     type(waitForObject(":End point.X:_ModuleBase_ParamSpinBox"), end_point[0])
50     type(waitForObject(":End point.Y:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
51     type(waitForObject(":End point.Y:_ModuleBase_ParamSpinBox"), end_point[1])
52
53     clickButton(waitForObject(":Line.property_panel_ok_QToolButton"))    
54
55 def circle_create(x, y, radius):
56     clickButton(waitForObject(":Basic.Circle_AppElements_Button"))
57     
58     type(waitForObject(":Center.X:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
59     type(waitForObject(":Center.X:_ModuleBase_ParamSpinBox"), x)
60     type(waitForObject(":Center.Y:_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
61     type(waitForObject(":Center.Y:_ModuleBase_ParamSpinBox"), y)
62     
63     type(waitForObject(":Circle.CircleRadius_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
64     type(waitForObject(":Circle.CircleRadius_ModuleBase_ParamSpinBox"), radius)
65     
66     clickButton(waitForObject(":Circle.property_panel_ok_QToolButton"))
67     
68 def circle_create_in_view(point_1, point_2):
69     clickButton(waitForObject(":Basic.Circle_AppElements_Button"))
70     
71     mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_1[0], point_1[1], 0, Qt.LeftButton)
72     mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_2[0], point_2[1], 0, Qt.LeftButton)
73     
74     clickButton(waitForObject(":Basic.Circle_AppElements_Button"))
75
76 def distance_create(point_1, point_2, annotaion_point, distance):
77     clickButton(waitForObject(":Constraints.Distance_AppElements_Button"))
78     
79     mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_1[0], point_1[1], 0, Qt.LeftButton)
80     mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_2[0], point_2[1], 0, Qt.LeftButton)
81     mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), annotaion_point[0], annotaion_point[1], 0, Qt.LeftButton) # move annotation
82
83     type(waitForObject(":_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
84     type(waitForObject(":_ModuleBase_ParamSpinBox"), distance)
85     type(waitForObject(":_ModuleBase_ParamSpinBox"), "<Return>")
86
87     clickButton(waitForObject(":Constraints.Distance_AppElements_Button"))    
88
89 def radius_create(point_1, point_2, radius):
90     clickButton(waitForObject(":Constraints.Radius_AppElements_Button"))
91     
92     mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_1[0], point_1[1], 0, Qt.LeftButton)
93     mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point_2[0], point_2[1], 0, Qt.LeftButton)
94     type(waitForObject(":_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
95     type(waitForObject(":_ModuleBase_ParamSpinBox"), radius)
96     type(waitForObject(":_ModuleBase_ParamSpinBox"), "<Keypad_Enter>")
97     
98     clickButton(waitForObject(":Constraints.Radius_AppElements_Button"))
99
100 def extrusion_feature(points, to_size):
101     clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Features")
102     clickButton(waitForObject(":Extrusion.Extrusion_AppElements_Button"))    
103
104     mouseClick(waitForObject(":Extrusion.Select a sketch face_QListWidget"), 10, 10, 0, Qt.LeftButton)
105     for point in points:
106         mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), point[0], point[1], 0, Qt.LeftButton)
107     
108     type(waitForObject(":to_size_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
109     type(waitForObject(":to_size_ModuleBase_ParamSpinBox"), to_size)
110
111     clickButton(waitForObject(":Extrusion.property_panel_ok_QToolButton"))