Salome HOME
Update copyrights
[modules/shaper.git] / test.squish / shared / scripts / common.py
index 2c06c5eed618be6108b944ff70ed498bd7af290d..cd6f8ac1c5603172c6f7626e2e1043b4a71d2c59 100644 (file)
@@ -1,9 +1,31 @@
+# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import filecmp
 import os
+import shutil
 
 testSettings.logScreenshotOnError = True
 testSettings.logScreenshotOnFail = True
-# RESULTS_PATH = "/dn48/newgeom/eso/sources/test.squish/shared/testresults/"
+# RESULTS_PATH = "/dn48/SHAPER/eso/sources/test.squish/shared/testresults/"
 DATA_PATH = os.getenv('TEST_DATA_DIR')
+TMP_DIR = os.path.join(DATA_PATH, 'tmp')
 
 g_points = {"XY_plane": (332, 250), "XZ_plane": (355, 207)}  # one of the construction planes
 def help_points(name):
@@ -25,12 +47,22 @@ def getPropertyPanelRealName():
 def getSpinBoxRealName(name):
     return "{container=%s name='%s' type='ModuleBase_ParamSpinBox' visible='1'}" % (getPropertyPanelRealName(), name)
 
+#---------------------------------------------------------------------------------------------
+def create_tmp():
+    remove_tmp()
+    os.makedirs(TMP_DIR)
+
+def remove_tmp():
+    if os.path.exists(TMP_DIR):
+        shutil.rmtree(TMP_DIR)
+
 #---------------------------------------------------------------------------------------------
 def set_defaults():
     waitForObject(":SALOME*_STD_TabDesktop").resize(1024, 768)
+    create_tmp()
 
-def activate_newgeom():
-    clickButton(waitForObject(":SALOME*.NewGeom_QToolButton"))
+def activate_SHAPER():
+    clickButton(waitForObject(":SALOME*.Shaper_QToolButton"))
     clickButton(waitForObject(":Activate module.New_QPushButton"))
 
 def close_application():
@@ -38,11 +70,13 @@ def close_application():
     clickButton(waitForObject(":Exit.Ok_QPushButton"))
     clickButton(waitForObject(":Close active study.Close w/o saving_QPushButton"))
 #     snooze(10)
+    remove_tmp()
 
 def close_application_wo_saving():
     sendEvent("QCloseEvent", waitForObject(":SALOME*_STD_TabDesktop"))
     clickButton(waitForObject(":Exit.Ok_QPushButton"))
     clickButton(waitForObject(":Close active study.Close w/o saving_QPushButton"))
+    remove_tmp()
 
 def part_create():
     activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part"))
@@ -401,9 +435,9 @@ def partition(main_objects, tool_object):
     for main_object in main_objects:
         mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), main_object[0], main_object[1], 33554432, Qt.LeftButton)
 
-    mouseClick(waitForObject(":Partition.Tool object_QListWidget"), 116, 69, 0, Qt.LeftButton)
+    mouseClick(waitForObject(":Boolean.Tool object_QListWidget"), 83, 132, 0, Qt.LeftButton)
     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), tool_object[0], tool_object[1], 0, Qt.LeftButton)
-    clickButton(waitForObject(":Partition.property_panel_ok_QToolButton"))
+    clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton"))
 
 def plane(point, distance):
     mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Construction"))