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