Salome HOME
Copyright update 2022
[modules/shaper.git] / test.squish / suite_ISSUES_SALOME / tst_532 / test.py
1 # Copyright (C) 2014-2022  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 email : webmaster.salome@opencascade.com
18 #
19
20 def sketch_circle():
21     circle_create((0, 0), 300)
22
23 def sketch_lines():
24     clickButton(waitForObject(":SALOME*.Line_QToolButton"))
25     points = [(647, 441), (419, 214), (725, 140), (578, 243), (647, 441)]
26     for point in points:
27         mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), point[0], point[1], 0, Qt.LeftButton)
28
29 def main():
30     source(findFile("scripts", "common.py"))
31
32     startApplication("salome_run.sh")
33     set_defaults()
34
35     activate_SHAPER()
36
37     sketch_create(help_points("XY_plane"), lambda: sketch_circle())
38     sketch_create(help_points("XY_plane"), lambda: sketch_lines())
39     test.vp("VP_SKETCHES")
40
41     part_create()
42
43     #[step] Create circle sketch
44     extrusion((299, 159), 10, 0)
45     #[step] Create V-shape sketch
46     extrusion((642, 176), 10, 0)
47
48     test.vp("VP_EXTRUSIONS")
49
50     #[step] Create plane: inner right for V-shape
51     activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Construction"))
52     activateItem(waitForObjectItem(":_QMenu", "Plane"))
53     type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "<Control>")
54     mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 305, 263, -2, -165, 67108866, Qt.RightButton)
55     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 651, 229, 0, Qt.LeftButton)
56     clickButton(waitForObject(":Plane.property_panel_ok_QToolButton"))
57     test.vp("VP_INNER_RIGHT_PLANE")
58
59     #[step] Create plane: outer right for V-shape
60     activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Construction"))
61     activateItem(waitForObjectItem(":_QMenu", "Plane"))
62     type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "<Control>")
63     mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 467, 171, -6, 319, 67108866, Qt.RightButton)
64     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 641, 209, 0, Qt.LeftButton)
65     type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "<Control>")
66     mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 515, 402, -7, -305, 67108866, Qt.RightButton)
67     clickButton(waitForObject(":Plane.property_panel_ok_QToolButton"))
68     test.vp("VP_OUTER_RIGHT_PLANE")
69
70     #[step] Activate Partition feature
71     activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Features"))
72     activateItem(waitForObjectItem(":_QMenu", "Partition"))
73     #[step] Select circle and V-shape
74     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 304, 293, 0, Qt.LeftButton)
75     type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "<Shift>")
76     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 541, 265, 33554432, Qt.LeftButton)
77     #[step] Select inner right and outer right V-shape planes
78     mouseClick(waitForObject(":Partition.Tool object_QListWidget"), 201, 90, 0, Qt.LeftButton)
79     type(waitForObject(":Partition.Tool object_QListWidget"), "<Shift>")
80     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 667, 217, 33554432, Qt.LeftButton)
81     type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "<Control>")
82     mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 655, 270, 8, 353, 67108866, Qt.RightButton)
83     type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "<Shift>")
84     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 639, 210, 33554432, Qt.LeftButton)
85     type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "<Control>")
86     mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 567, 436, -11, -351, 67108866, Qt.RightButton)
87
88     #[step] Apply Partition
89     clickButton(waitForObject(":Partition.property_panel_ok_QToolButton"))
90
91     test.vp("VP_PARTITION")
92
93     close_application()