1 # Copyright (C) 2014-2021 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 email : webmaster.salome@opencascade.com
20 def set_parameter_value(name, value):
21 openContextMenu(waitForObject(":Parameters.%s = _QModelIndex" % name), 10, 10, 0)
22 activateItem(waitForObjectItem(":_QMenu", "Edit..."))
23 mouseClick(waitForObject(":Parameter_ExpressionEditor"), 10, 10, 0, Qt.LeftButton)
24 type(waitForObject(":Parameter_ExpressionEditor"), "<Ctrl+A>")
25 type(waitForObject(":Parameter_ExpressionEditor"), value)
26 type(waitForObject(":Parameter_ExpressionEditor"), "<Return>")
27 clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton"))
31 # [Scenario] 'Platine' model created by PythonAPI
32 # [Topic] PythonAPI functionality
33 # [Tested functionality]
34 # [Summary description]
38 source(findFile("scripts", "common.py"))
40 # [section] Application start
41 # [step] Launch SALOME
42 startApplication("salome_run.sh")
46 # [step] Activate Shaper module and create new file
49 # [step] In Python console type: import examples.Platine
50 type(waitForObject(":Python Console_PyConsole_EnhEditor"), "import examples.Platine")
51 type(waitForObject(":Python Console_PyConsole_EnhEditor"), "<Return>")
53 # [step] Check that the model is correct [vp VP_PLATINE]
54 clickButton(waitForObject(":SALOME*.Fit All_QToolButton"))
57 # [step] Check that the object browser contains all objects from the model [vp VP_TREE]
58 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Parameters (3)")
59 clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Parameters (3)", -10, 10, 0, Qt.LeftButton)
60 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Constructions (3)")
61 clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Constructions (3)", -10, 10, 0, Qt.LeftButton)
62 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Bodies (1)")
63 clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Bodies (1)", -10, 10, 0, Qt.LeftButton)
64 # Tree is under modification, so it can not be checked by a picture
65 # Moreover a mask for a text should be provided to check it on different platforms
68 # [step] Change parameter values: L = 64, E = 5, P = 80
69 set_parameter_value("L", 64)
70 set_parameter_value("E", 5)
71 set_parameter_value("P", 80)
72 clickButton(waitForObject(":SALOME*.Fit All_QToolButton"))
73 mouseMove(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 320, 240)
74 test.vp("VP_PLATINE_E")
76 # [step] Change parameter values: L = 90, E = 20, P = 80
77 set_parameter_value("L", 90)
78 set_parameter_value("E", 20)
79 set_parameter_value("P", 80)
80 clickButton(waitForObject(":SALOME*.Fit All_QToolButton"))
81 mouseMove(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 320, 240)
82 test.vp("VP_PLATINE_L")
84 # [step] Change parameter values: L = 64, E = 20, P = 120
85 set_parameter_value("L", 64)
86 set_parameter_value("E", 20)
87 set_parameter_value("P", 120)
88 clickButton(waitForObject(":SALOME*.Fit All_QToolButton"))
89 mouseMove(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 320, 240)
90 test.vp("VP_PLATINE_P")
92 # [step] Close application