Salome HOME
updated copyright message
[modules/shaper.git] / src / ExchangePlugin / Test / TestImportImage_1.py
index 2c974d6bf62b120f40eceafef99e78f590806537..96478a1f40f2b0b33fb7b0645e0678d838059fd1 100755 (executable)
@@ -1,4 +1,4 @@
-# Copyright (C) 2021  CEA/DEN, EDF R&D
+# Copyright (C) 2021-2023  CEA, EDF
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-import os
+import os, inspect
 from salome.shaper import model
 
+from PyQt5.Qt import QApplication
+
 import salome
+salome.salome_init_without_session()
 salome.salome_init(1)
+if QApplication.instance() is None:
+  app = QApplication([])
 
-data_dir = os.path.join(os.path.dirname(sys.argv[0]), "data")
+data_dir = os.path.join(os.path.dirname(inspect.getfile(lambda: None)), "data")
 
 model.begin()
 partSet = model.moduleDocument()
@@ -61,6 +66,9 @@ tol=1e-06
 assert(abs(dx-400) <= tol)
 assert(abs(dy-258.5) <= tol)
 assert(abs(dz-0) <= tol)
+assert(ImportImage_1.result().resultSubShapePair()[0].hasTexture())
+assert(Translation_1.result().resultSubShapePair()[0].hasTexture())
+assert(Scale_1.result().resultSubShapePair()[0].hasTexture())
 
 #=============================================================================
 # Change the image :
@@ -90,10 +98,16 @@ tol=1e-06
 assert(abs(dx-448) <= tol)
 assert(abs(dy-296.8) <= tol)
 assert(abs(dz-0) <= tol)
+assert(ImportImage_1.result().resultSubShapePair()[0].hasTexture())
+assert(Translation_1.result().resultSubShapePair()[0].hasTexture())
+assert(Scale_1.result().resultSubShapePair()[0].hasTexture())
 
+assert(model.checkPythonDump())
 
 # Close SALOME GUI
 import salome_utils
-import subprocess
-port = salome_utils.getPortNumber()
-proc = subprocess.Popen(["killSalomeWithPort.py", "{}".format(port)])
+import killSalomeWithPort
+
+port = salome_utils.getPortNumber(False)
+if port:
+  killSalomeWithPort.killMyPort(port)