1 ## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
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.
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.
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
17 ## See http:##www.salome-platform.org/ or
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
23 # [Scenario] XAO-export
24 # [Topic] 'Exchange' functionality
25 # [Tested functionality]
26 # [Summary description]
30 source(findFile("scripts", "common.py"))
32 # [step] Launch SALOME
33 startApplication("salome_run.sh")
37 # [step] Activate NewGeom
40 # [step] Create new Part
41 activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part"))
42 activateItem(waitForObjectItem(":Part_QMenu", "New part"))
44 # [step] Import file 'exchange/xao/Box_1.brep'
45 export_file_path = os.path.join(DATA_PATH, 'exchange', 'xao', 'Box_1.brep');
47 activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part"))
48 activateItem(waitForObjectItem(":Part_QMenu", "Import"))
49 mouseClick(waitForObject(":property_panel_dock...._QPushButton"), 10, 10, 0, Qt.LeftButton)
50 mouseClick(waitForObjectItem(":property_panel_dock.fileTypeCombo_QComboBox", "BREP files (*\\.BREP *\\.BRP)"), 10, 10, 0, Qt.LeftButton)
51 type(waitForObject(":fileNameEdit_QLineEdit_3"), export_file_path)
52 type(waitForObject(":fileNameEdit_QLineEdit_3"), "<Return>")
53 clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton"))
55 # [step] Check that the body is visible in the view [vp BODY]
59 # [step] Create Group feature
60 activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Features"))
61 activateItem(waitForObjectItem(":_QMenu", "Group"))
63 # [step] Select type: Solids
64 mouseClick(waitForObjectItem(":property_panel_dock.Type_QComboBox", "Solids"), 10, 10, 0, Qt.LeftButton)
66 # [step] Select the imported box [vp SELECTED_SOLIDS]
67 mouseClick(waitForObject(":property_panel_dock.Selected objects:_QListWidget"), 10, 10, 0, Qt.LeftButton)
68 mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 310, 147, 0, Qt.LeftButton)
69 test.vp("SELECTED_SOLIDS")
71 # [step] Apply the feature
72 clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton"))
74 # [step] Rename the Group_1 result to: boite_1
76 # waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Group\\_1")
77 # clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Group\\_1", 10, 10, 0, Qt.LeftButton)
78 # openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Group\\_1", 49, 7, 0)
79 # activateItem(waitForObjectItem(":_QMenu", "Rename"))
80 # type(waitForObject(":_QExpandingLineEdit_2"), "boite_1")
81 # type(waitForObject(":_QExpandingLineEdit_2"), "<Return>")
83 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Groups (1)")
84 clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Groups (1)", -10, 10, 0, Qt.LeftButton)
85 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Groups (1).Group\\_1")
86 openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Groups (1).Group\\_1", 10, 10, 0)
87 activateItem(waitForObjectItem(":_QMenu", "Rename"))
88 type(waitForObject(":_QExpandingLineEdit"), "boite_1")
89 type(waitForObject(":_QExpandingLineEdit"), "<Return>")
91 # [step] Create Group feature
92 activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Features"))
93 activateItem(waitForObjectItem(":_QMenu", "Group"))
95 # [step] Select type: Faces
96 mouseClick(waitForObjectItem(":property_panel_dock.Type_QComboBox", "Faces"), 10, 10, 0, Qt.LeftButton)
98 # [step] Select the two faces [vp SELECTED_FACES]
99 mouseClick(waitForObject(":property_panel_dock.Selected objects:_QListWidget"), 10, 10, 0, Qt.LeftButton)
100 mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 469, 292, 0, Qt.LeftButton)
101 type(waitForObject(":property_panel_dock.Selected objects:_QListWidget"), "<Shift>")
102 mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 306, 296, 33554432, Qt.LeftButton)
103 test.vp("SELECTED_FACES")
105 # [step] Apply the feature
106 clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton"))
108 # [step] Check that the new Group result name is: Group_2
109 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Groups (2).Group\\_2")
111 # [step] Create Export feature
112 activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part"))
113 activateItem(waitForObjectItem(":Part_QMenu", "Export"))
115 # [step] Select export type: XAO
116 mouseClick(waitForObjectItem(":property_panel_dock_QComboBox", "XAO"), 10, 10, 0, Qt.LeftButton)
118 # [step] Set the file name 'Box-export.xao'
119 export_file_path = os.path.join(TMP_DIR, 'Box-export.xao')
120 clickButton(waitForObject(":property_panel_dock...._QPushButton"))
121 mouseClick(waitForObject(":fileNameEdit_QLineEdit_3"), 64, 7, 0, Qt.LeftButton)
122 type(waitForObject(":fileNameEdit_QLineEdit_3"), export_file_path)
123 clickButton(waitForObject(":property_panel_dock.Save_QPushButton"))
125 # [step] Set author: me
126 type(waitForObject(":property_panel_dock.Author_QLineEdit"), "me")
128 # [step] Set geometry name: mygeom
129 type(waitForObject(":property_panel_dock.Geometry name_QLineEdit"), "mygeom")
130 type(waitForObject(":property_panel_dock.Geometry name_QLineEdit"), "<Return>")
132 # [step] Apply the feature
133 clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton"))
136 # [step] Check that the exported file exists: 'exchange/xao/results/Box-export.xao'
137 example_file_path = os.path.join(DATA_PATH, 'exchange', 'xao-examples', 'Box-export.xao')
138 files = (export_file_path, example_file_path)
139 if filecmp.cmp(*files):
140 test.passes("File comparison of '%s' and '%s' passed" % files)
142 test.fail("Files '%s' and '%s' are not equal" % files)
146 # [step] Delete Part_1
147 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1")
148 clickItem(":Object browser_XGUI_DataTree", "Part\\_1", 10, 10, 0, Qt.LeftButton)
149 activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part"))
150 activateItem(waitForObjectItem(":Part_QMenu", "Remove part"))
152 # [step] Create new Part
153 activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part"))
154 activateItem(waitForObjectItem(":Part_QMenu", "New part"))
156 # [step] Create Import feature
157 activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part"))
158 activateItem(waitForObjectItem(":Part_QMenu", "Import"))
160 # [step] Select the exported file
161 mouseClick(waitForObject(":property_panel_dock...._QPushButton"), 10, 10, 0, Qt.LeftButton)
162 mouseClick(waitForObjectItem(":property_panel_dock.fileTypeCombo_QComboBox", "XAO files (*\\.XAO)"), 10, 10, 0, Qt.LeftButton)
163 type(waitForObject(":fileNameEdit_QLineEdit_3"), export_file_path)
164 type(waitForObject(":fileNameEdit_QLineEdit_3"), "<Return>")
166 # [step] Apply the feature
167 clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton"))
169 # [step] Check that the body is visible in the view [vp BODY]
170 openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Bodies (1).mygeom\\_1", 10, 10, 0)
171 activateItem(waitForObjectItem(":_QMenu", "Show only"))
173 test.vp("BODY_IMPORT")
175 # [step] In Object Browser check that the Import feature name is "mygeom"
176 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.mygeom")
178 # [step] In Object Browser check new body: mygeom_1
179 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Bodies (1).mygeom\\_1")
180 # [step] In Object Browser check new groups: boite_1, Group_2
181 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Groups (2).boite\\_1")
182 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Groups (2).Group\\_2")
184 # [step] Check the group boite_1 is a solid [vp GROUP_1]
185 openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Groups (2).boite\\_1", 10, 10, 0)
186 activateItem(waitForObjectItem(":_QMenu", "Show only"))
190 # [step] Check the group Group_2 is a list of 2 faces [vp GROUP_2]
191 openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Groups (2).Group\\_2", 10, 10, 0)
192 activateItem(waitForObjectItem(":_QMenu", "Show only"))
196 # [step] Close application without saving