From bd64f3a5e266bee1ed10cec101692c7297ccd23f Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Wed, 28 Oct 2015 09:57:19 +0100 Subject: [PATCH] =?utf8?q?deux=20tests=20d'import=20de=20fichiers=20inexis?= =?utf8?q?tants,=20bug=20=C3=A0=20resoudre?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- doc/salome/examples/CMakeLists.txt | 2 + .../examples/CTestTestfileInstall.cmake | 2 + doc/salome/examples/h005_importImageBad.py | 38 +++++++++++++++++++ doc/salome/examples/h006_importBathyXYZBad.py | 32 ++++++++++++++++ 4 files changed, 74 insertions(+) create mode 100644 doc/salome/examples/h005_importImageBad.py create mode 100644 doc/salome/examples/h006_importBathyXYZBad.py diff --git a/doc/salome/examples/CMakeLists.txt b/doc/salome/examples/CMakeLists.txt index a5366abf..3b3d33e2 100644 --- a/doc/salome/examples/CMakeLists.txt +++ b/doc/salome/examples/CMakeLists.txt @@ -24,6 +24,8 @@ SET(EXAMPLES_TESTS h002_importImage.py h003_changeLCS.py h004_importBathyXYZ.py + h005_importImageBad.py + h006_importBathyXYZBad.py ) SET(HYDRO_SAMPLES diff --git a/doc/salome/examples/CTestTestfileInstall.cmake b/doc/salome/examples/CTestTestfileInstall.cmake index 42eaa35b..cbad141c 100644 --- a/doc/salome/examples/CTestTestfileInstall.cmake +++ b/doc/salome/examples/CTestTestfileInstall.cmake @@ -26,6 +26,8 @@ SET(EXAMPLES_TESTS h002_importImage h003_changeLCS h004_importBathyXYZ + h005_importImageBad + h006_importBathyXYZBad ) FOREACH(tfile ${EXAMPLES_TESTS}) diff --git a/doc/salome/examples/h005_importImageBad.py b/doc/salome/examples/h005_importImageBad.py new file mode 100644 index 00000000..e9ece758 --- /dev/null +++ b/doc/salome/examples/h005_importImageBad.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +import os +HYDRO_SAMPLES = os.path.join( os.environ["HYDRO_ROOT_DIR"], "bin/salome/test/HYDRO") + +import sys +import salome + +salome.salome_init() +theStudy = salome.myStudy + +from HYDROPy import * +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) + +hydro_doc.SetLocalCS( 0, 0 ) + +garonne_ign_inexistant = hydro_doc.CreateObject( KIND_IMAGE ) +garonne_ign_inexistant.SetName( "garonne_ign_inexistant" ) + +garonne_ign_inexistant.LoadImage( os.path.join(HYDRO_SAMPLES , "garonne_ign_inexistant.png" )) + +# TODO : ce chargement doit echouer avec un retour d'erreur à traiter +raise ValueError('file not found') + +garonne_ign_inexistant.SetLocalPoints( QPoint( 40, 817 ), + QPoint( 1325, 85 ) ) + +garonne_ign_inexistant.SetGlobalPoints( 1, + QPointF( 471562, 6.36775e+06 ), + QPointF( 489400, 6.37702e+06 ) ) + +garonne_ign_inexistant.Update() + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/h006_importBathyXYZBad.py b/doc/salome/examples/h006_importBathyXYZBad.py new file mode 100644 index 00000000..3a24a9f2 --- /dev/null +++ b/doc/salome/examples/h006_importBathyXYZBad.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- + +import os +HYDRO_SAMPLES = os.path.join( os.environ["HYDRO_ROOT_DIR"], "bin/salome/test/HYDRO") + +import sys +import salome + +salome.salome_init() +theStudy = salome.myStudy + +from HYDROPy import * +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) + +hydro_doc.SetLocalCS( 430000, 6.35e+06 ) + +Cloud_inexistant = hydro_doc.CreateObject( KIND_BATHYMETRY ) +Cloud_inexistant.SetName( "Cloud_inexistant" ) + +Cloud_inexistant.SetAltitudesInverted( 0 ); +Cloud_inexistant.ImportFromFile( os.path.join(HYDRO_SAMPLES, "Cloud_inexistant.xyz" )) + +# TODO : ce chargement doit echouer avec un retour d'erreur à traiter +raise ValueError('file not found') + +Cloud_inexistant.Update() + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) -- 2.39.2