Salome HOME
Issue #19036: Can't use a parameter with 1e-5 value in the sketcher
[modules/shaper.git] / test.squish / shared / scripts / common.py
index 06ce67bfa82b1812f4ba2f6f6ccf5fe17e98534f..e775b3ff41da4c7087e3b8c5ec1fe90496efce05 100644 (file)
@@ -1,9 +1,31 @@
+# Copyright (C) 2014-2020  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/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,9 +47,19 @@ 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_SHAPER():
     clickButton(waitForObject(":SALOME*.Shaper_QToolButton"))
@@ -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"))