Salome HOME
updated copyright message
[modules/shaper.git] / test.squish / suite_STANDALONE / tst_common_1 / 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 sketch():
21
22     clickButton(waitForObject(":Basic.Line_AppElements_Button"))
23     mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 256, 202, 0, Qt.LeftButton)
24     mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 256, 462, 0, Qt.LeftButton)
25     mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 472, 466, 0, Qt.LeftButton)
26     mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 467, 205, 0, Qt.LeftButton)
27     mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 256, 202, 0, Qt.LeftButton)
28
29     perpendicular_create((354, 204),(469, 309))
30     perpendicular_create((470, 314),(357, 464))
31     perpendicular_create((354, 463),(255, 321))
32
33     horizontal_create((358, 203))
34
35     distance_create((256, 205), (473, 202), (446, 141), 330)
36     distance_create((258, 205), (256, 470), (208, 459), 400)
37
38 def sketch_1():
39
40     mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 365, 324, 0, Qt.LeftButton)
41
42     circle_create_in_view((265, 190), (278, 205))
43     circle_create_in_view((460, 194), (476, 209))
44     circle_create_in_view((264, 465), (272, 487))
45     circle_create_in_view((465, 467), (472, 482))
46
47     radius_create((282, 203), (299, 177), 15)
48     radius_create((456, 174), (402, 157), 15)
49     radius_create((284, 454), (304, 438), 15)
50     radius_create((467, 484), (472, 486), 15)
51
52     distance_create((269, 191), (463,198), (433, 101), 170)
53     distance_create((265, 463), (445, 404), (328, 545), 170)
54     distance_create((223, 193), (220, 483), (153, 457), 240)
55     distance_create((496, 196), (467, 394), (564, 375), 240)
56
57     distance_create((187, 645), (202, 532), (168, 560), 80)
58     distance_create((113, 598), (199, 517), (197, 424), 80)
59     distance_create((509, 64), (643, 63), (579, 160), 80)
60     distance_create((512, 62), (529, 3), (443, 119), 80)
61
62 def sketch_2():
63
64     mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 365, 324, 0, Qt.LeftButton)
65
66     line_create_in_view((112, 185), (643, 193))
67     line_create_in_view((643, 193), (641, 288))
68     line_create_in_view((641, 288), (111, 285))
69     line_create_in_view((111, 285), (112, 185))
70
71     horizontal_create((344, 187))
72     horizontal_create((349, 286))
73
74
75 def main():
76     source(findFile("scripts", "common.py"))
77
78     startApplication("linux_run.sh")
79     set_defaults()
80
81     test.log("TODO: Make test more stable."); return
82
83     part_create()
84     waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1")
85     clickItem(":Object browser_XGUI_DataTree", "Part\\_1", 46, 8, 0, Qt.LeftButton)
86
87     sketch_create(help_points("XY_plane"), lambda: sketch())
88
89     #extrusion
90     clickTab(waitForObject(":General.qt_tabwidget_tabbar_QTabBar"), "Features")
91     clickButton(waitForObject(":Extrusion.Extrusion_AppElements_Button"))
92     mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 295, 253, 0, Qt.LeftButton)
93     mouseClick(waitForObject(":Extrusion.qt_spinbox_lineedit_QLineEdit"), 28, 8, 0, Qt.LeftButton)
94     type(waitForObject(":to_size_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
95     type(waitForObject(":to_size_ModuleBase_ParamSpinBox"), "50")
96     mouseClick(waitForObject(":Extrusion.qt_spinbox_lineedit_QLineEdit_2"), 29, 10, 0, Qt.LeftButton)
97     type(waitForObject(":Extrusion.from_size_ModuleBase_ParamSpinBox"), "<Ctrl+A>")
98     type(waitForObject(":Extrusion.from_size_ModuleBase_ParamSpinBox"), "50")
99     clickButton(waitForObject(":Extrusion.property_panel_ok_QToolButton"))
100
101     #extrusion_feature((361, 391), 50, 50)
102     #sketch_create(help_points("XY_plane"), lambda: sketch_1())
103
104     extrusion_cut_by_sizes_feature((365, 324), lambda: sketch_1(), 100, 150)
105     extrusion_fuse_by_sizes_feature((185, 213), lambda: sketch_2(), 150, 0)
106
107     mouseDrag(waitForObject(":OpenParts*_AppElements_ViewPort"), 89, 518, 13, -86, 67108865, Qt.LeftButton)
108     mouseDrag(waitForObject(":OpenParts*_AppElements_ViewPort"), 181, 514, -21, -144, 67108866, Qt.RightButton)
109     mouseDrag(waitForObject(":OpenParts*_AppElements_ViewPort"), 662, 541, -368, -221, 67108866, Qt.RightButton)
110     mouseDrag(waitForObject(":OpenParts*_AppElements_ViewPort"), 609, 270, -48, 320, 67108866, Qt.RightButton)
111     mouseDrag(waitForObject(":OpenParts*_AppElements_ViewPort"), 483, 423, 123, 11, 67108866, Qt.RightButton)
112
113     clickButton(waitForObject(":OpenParts*.Fit all_QToolButton"))
114     test.vp("VP1")#Detail in axonometric view
115
116     mouseClick(waitForObject(":OpenParts*_AppElements_ViewPort"), 391, 374, 0, Qt.LeftButton)
117     test.vp("VP2")#Detail is selected
118
119     sendEvent("QCloseEvent", waitForObject(":OpenParts*_AppElements_MainWindow"))