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