Salome HOME
Copyright update 2022
[modules/shaper.git] / test.squish / suite_FEATURE_EXCHANGE / tst_XAO-import / 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 main():
21     # [project] NewGEOM
22     # [Scenario] XAO-import
23     # [Topic] 'Exchange' functionality
24     # [Tested functionality]
25     # [Summary description]
26     # [Expected results]
27     # [General comments]
28
29     source(findFile("scripts", "common.py"))
30
31     # [step] Launch SALOME
32     startApplication("salome_run.sh")
33
34     set_defaults()
35
36     # [step] Activate NewGeom
37     activate_newgeom()
38
39     # [step] Create new Part
40     activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part"))
41     activateItem(waitForObjectItem(":Part_QMenu", "New part"))
42
43     # [step] Create Import feature
44     activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part"))
45     activateItem(waitForObjectItem(":Part_QMenu", "Import"))
46
47     # [step] Select file 'exchange/xao/test.xao' and apply the feature
48     file_path = os.path.join(DATA_PATH, 'exchange', 'xao', 'test.xao');
49     mouseClick(waitForObject(":property_panel_dock...._QPushButton"), 10, 10, 0, Qt.LeftButton)
50     mouseClick(waitForObjectItem(":property_panel_dock.fileTypeCombo_QComboBox", "XAO files (*\\.XAO)"), 10, 10, 0, Qt.LeftButton)
51     type(waitForObject(":fileNameEdit_QLineEdit_3"), file_path)
52     type(waitForObject(":fileNameEdit_QLineEdit_3"), "<Return>")
53     clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton"))
54
55     # [step] Check that the body is visible in the view [vp BODY]
56     openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Bodies (1).mygeom\\_1", 10, 10, 0)
57     activateItem(waitForObjectItem(":_QMenu", "Show only"))
58     fit_all()
59     test.vp("BODY")
60
61     # [step] In Object Browser check that the Import feature name is "mygeom"
62     waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.mygeom")
63
64     # [step] In Object Browser check new body: mygeom_1
65     waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Bodies (1).mygeom\\_1")
66     # [step] In Object Browser check new groups: boite_1, Group_2
67     waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Groups (2).boite\\_1")
68     waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Groups (2).Group\\_2")
69
70     # [step] Check the group boite_1 is a solid [vp GROUP_1]
71     openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Groups (2).boite\\_1", 10, 10, 0)
72     activateItem(waitForObjectItem(":_QMenu", "Show only"))
73     fit_all()
74     test.vp("GROUP_1")
75
76     # [step] Check the group Group_2 is a list of 2 faces [vp GROUP_2]
77     openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Groups (2).Group\\_2", 10, 10, 0)
78     activateItem(waitForObjectItem(":_QMenu", "Show only"))
79     fit_all()
80     test.vp("GROUP_2")
81
82     # [step] Close application without saving
83     close_application()