Salome HOME
updated copyright message
[modules/shaper.git] / test.squish / suite_FEATURE_SKETCH / tst_sketch_003 / 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     circle_create_in_view((302, 221), (436, 287))
22
23 def main():
24     #[project] SHAPER
25     #[Scenario] Sketch_003
26     #[Topic]
27     #[Tested functionality] Saving and opening studies
28     #[Summary description]
29     #[Expected results]
30     #[General comments]
31
32     source(findFile("scripts", "common.py"))
33
34     #[section] Application start
35     #[step] Launch SALOME
36     startApplication("salome_run.sh")
37
38     set_defaults()
39     #[section] Creation of 3D model
40     #[step] Activate SHAPER
41     #[step]Click 'New' button
42
43     activate_SHAPER()
44     #[step] Create new part
45     part_create()
46     #[step] Create sketch, consisting from one circle
47     sketch_create(help_points("XZ_plane"), lambda: sketch())
48
49     #[step] Execute extrusion. Use parameters to size = 100 and from size = 50
50     extrusion((182, 140), 100, 50)
51
52     #[step] Rotate obtained model
53     type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "<Control>")
54     mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 425, 422, 20, -23, 67108865, Qt.LeftButton)
55     type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "<Control>")
56     mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 446, 411, -13, -137, 67108866, Qt.RightButton)
57     test.vp("VP1")
58
59     #[section] Save file
60     #[step] File - Save as
61     #[step] 'Save as' dialog appears
62     #[step] Type name of file
63     #[step] Click 'Save' button
64     save("RESULTS_PATH + sketch_003")
65     if object.exists(":Warning.Yes_QPushButton"):
66         clickButton(waitForObject(":Warning.Yes_QPushButton"))
67
68     #[step] Close document
69     clickButton(waitForObject(":SALOME*.Close_QToolButton"))
70
71     #[step] File - Open
72     #[step} Open just saved file
73     open("RESULTS_PATH + sketch_003.hdf")
74     #[step] Activate SHAPER
75     clickButton(waitForObject(":SALOME*.Shaper_QToolButton"))
76
77     #[step] Activate Part_1
78     waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)")
79     clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 50, 11, 0, Qt.LeftButton)
80     openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 50, 11, 0)
81     activateItem(waitForObjectItem(":_QMenu", "Activate"))
82
83     #[check] Check that file was loaded correct
84     test.vp("VP2")
85     #[step] Close application
86     close_application()