]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
HYDRO_tests reference data on install directory
authorPaul RASCLE <paul.rascle@edf.fr>
Wed, 18 May 2016 18:29:59 +0000 (20:29 +0200)
committerPaul RASCLE <paul.rascle@edf.fr>
Wed, 18 May 2016 18:29:59 +0000 (20:29 +0200)
src/HYDROData/HYDROData_LandCoverMap.cxx
src/HYDRO_tests/CMakeLists.txt
src/HYDRO_tests/TestViewer.cxx
src/HYDRO_tests/reference_data/CMakeLists.txt [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx
src/HYDRO_tests/test_HYDROData_Main.cxx
src/HYDRO_tests/test_HYDROData_ShapeFile.cxx
src/HYDRO_tests/test_HYDROData_StricklerTable.cxx

index 4b577db8b69a924b3a4df0c096c3c3c00c16c408..a8325aef11efec83a32a606b7055c30b17261311 100644 (file)
@@ -68,6 +68,9 @@
 #include <QTextStream>
 #include <QFileInfo>
 
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
 const char TELEMAC_FORMAT = 'f';
 const int TELEMAC_PRECISION = 3;
 
@@ -826,13 +829,16 @@ bool HYDROData_LandCoverMap::LocalPartition( const TopoDS_Shape& theNewShape, co
     aShapesList.Append( anIt.Face() );
   aShapesList.Append( theNewShape );
 
+  DEBTRACE("theNewType " << theNewType);
   if( aShapesList.Size()==1 && theNewShape.ShapeType()==TopAbs_FACE )
   {
+    DEBTRACE("---");
     aNewFaces.Add( TopoDS::Face( theNewShape ), theNewType );
     StoreLandCovers( aNewFaces );
     return true;
   }
 
+  DEBTRACE("---");
   // prepare pave filler
   aPaveFiller.SetArguments( aShapesList );
   aPaveFiller.Perform();
@@ -840,6 +846,7 @@ bool HYDROData_LandCoverMap::LocalPartition( const TopoDS_Shape& theNewShape, co
   if( anError )
     return false;
 
+  DEBTRACE("---");
   // add faces to builder
   BOPAlgo_Builder aBuilder;
   anIt.Init( *this );
@@ -863,6 +870,7 @@ bool HYDROData_LandCoverMap::LocalPartition( const TopoDS_Shape& theNewShape, co
   for( ; aMIt.More(); aMIt.Next() )
   {
     //std::cout << "   " << aMIt.Value() << std::endl;
+    DEBTRACE(aMIt.Value());
     int aKey = (int)(uintptr_t)aMIt.Value().TShape().operator->();
     aShapesFromNewFace.Add( aKey );
   }
@@ -872,6 +880,7 @@ bool HYDROData_LandCoverMap::LocalPartition( const TopoDS_Shape& theNewShape, co
   for( ; anIt.More(); anIt.Next() )
   {
     QString aSType = anIt.StricklerType();
+    DEBTRACE(anIt.StricklerType());
     //std::cout << "from " << anIt.Face() << ": " << anIt.StricklerType() << std::endl;
     TopTools_ListOfShape aModified = aBuilder.Modified( anIt.Face() );
     //
@@ -890,7 +899,7 @@ bool HYDROData_LandCoverMap::LocalPartition( const TopoDS_Shape& theNewShape, co
         aNewFaces.Add( TopoDS::Face( aShape ), aSType );
     }
   }
-
+  DEBTRACE("---");
   //     c. add the new shape if it is face with its type
   if( theNewShape.ShapeType()==TopAbs_FACE )
     aNewFaces.Add( TopoDS::Face( theNewShape ), theNewType );
index b77ef9533554eaac2674d228bfb81643535cbac3..1e95d072c54be64b51620bf55bad8a4a2ae8a1ce 100644 (file)
@@ -1,3 +1,4 @@
+ADD_SUBDIRECTORY(reference_data)
 
 include(../../CMake/Common.cmake)
 include(ExternalFiles.cmake)
index d3e997c67f1aa4c09cd87700be9f9ed285e77a8b..75fcaeb3d93a77d8e19a49ddd6d7bcd49dd76726 100644 (file)
@@ -242,7 +242,7 @@ bool TestViewer::AssertImages( QString& theMessage )
 {
   QImage anActualImage = viewWindow()->dumpView();
 
-  QString anExpectedRefFilePath = qgetenv( "HYDRO_DIR" ) + "/../../src/HYDRO/src/HYDRO_tests/reference_data";
+  QString anExpectedRefFilePath = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO";
   anExpectedRefFilePath += "/" + myKey + ".png";
   QImage anExpectedRefImage; 
   anExpectedRefImage.load( anExpectedRefFilePath );
@@ -342,7 +342,7 @@ bool TestViewer::areScriptsEqual( const QString& theBaseName,
                                   int theLinesToOmit,
                                   QString& theMsg )
 {
-  QString anExpectedRefFilePath = qgetenv( "HYDRO_DIR" ) + "/../../src/HYDRO/src/HYDRO_tests/reference_data";
+  QString anExpectedRefFilePath = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO";
   anExpectedRefFilePath += "/" + theBaseName;
   
   QString anActualFilePath = QDir::tempPath() + "/" + theBaseName;
diff --git a/src/HYDRO_tests/reference_data/CMakeLists.txt b/src/HYDRO_tests/reference_data/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e1b18f9
--- /dev/null
@@ -0,0 +1,110 @@
+# Copyright (C) 2012-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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
+#
+
+# examples that cant be used for testing because they use external mesher plug-ins
+
+
+SET(REFERENCE_DATA
+    Channel.png
+    CLC06.cst
+    CLC06-cut_1.dbf
+    CLC06-cut_1_res.png
+    CLC06-cut_1_res.shx
+    CLC06-cut_1.shp
+    CLC06-cut_1.shx
+    CLC06.dbf
+    CLC06.prj
+    CLC06.shp
+    CLC06.shx
+    clc_dec_150_350.png
+    CLC_decoupe.prj
+    CLC_decoupe.qpj
+    CLC_decoupe.shp
+    CLC_decoupe.shx
+    cyprus_natural_all.png
+    cyprus_natural.dbf
+    cyprus_natural.prj
+    cyprus_natural.shp
+    cyprus_natural.shx
+    Extraction_Channel.png
+    Extraction_ImmZone.png
+    ff1.brep
+    ff2.brep
+    ff3.brep
+    LandCoverMap_Add_2_Objects.png
+    LandCoverMap_Merge_1.png
+    LandCoverMap_Merge_2.png
+    LandCoverMap_PrsByCoeff.png
+    LandCoverMap_PrsByTypes.png
+    LandCoverMap_Remove_1.png
+    LandCoverMap_Split_1.png
+    LandCoverMap_Split_2.png
+    LandCoverMap_Split_Polyline.png
+    LandCoverMap_TransparentPrs.png
+    LandCover_Triangles.png
+    LandCover_Triangles_Split.png
+    lc_dump.dbf
+    lc_dump.py
+    LCM_copied.png
+    lcm_poly_2_sections.png
+    LCM_split_2a.png
+    LCM_split_2b.png
+    merge_faces_boxes_11.png
+    merge_faces_boxes_12.png
+    merge_faces_boxes_13.png
+    merge_faces_boxes_14.png
+    merge_faces_boxes_21.png
+    merge_faces_boxes_22.png
+    merge_faces_boxes_23.png
+    merge_faces_boxes_24.png
+    merge_faces_circles_11.png
+    merge_faces_circles_12.png
+    merge_faces_circles_13.png
+    merge_faces_circles_14.png
+    merge_faces_circles_21.png
+    merge_faces_circles_22.png
+    merge_faces_circles_23.png
+    merge_faces_circles_24.png
+    Merge_Polylines.png
+    NLD_water_areas_dcw.dbf
+    NLD_water_areas_dcw.png
+    NLD_water_areas_dcw.prj
+    NLD_water_areas_dcw.shp
+    NLD_water_areas_dcw.shx
+    Polyline_Presentation.png
+    pp1.brep
+    pp2.brep
+    pp3.brep
+    pp4.brep
+    ref_dbf1.dbf
+    ref_dbf2.dbf
+    ref_dbf3.dbf
+    Shape_preview_im_zone.png
+    Split_Polylines_Colors.png
+    Split_Straight.png
+    st_dump.py
+    t1.dbf
+    test_LCM.dbf
+    test.telemac
+)
+
+# Application tests
+
+SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test)
+INSTALL(FILES ${REFERENCE_DATA} DESTINATION ${TEST_INSTALL_DIRECTORY})
index 5adf002a7c73ed8bee3a81546c7a684d4e1a33fa..c7e3b4c7dc0568e790435d11eeb20c3af8622d72 100644 (file)
@@ -47,9 +47,8 @@
 #define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 
-//const QString REF_DATA_PATH = qgetenv( "HYDRO_REFERENCE_DATA" );
-const QString REF_DATA_PATH = qgetenv( "HYDRO_DIR" ) + "/../../src/HYDRO/src/HYDRO_tests/reference_data";
-const QString DEF_STR_PATH = qgetenv( "HYDRO_DIR" ) + "/../../src/HYDRO/src/HYDROGUI/resources/def_strickler_table.txt";
+const QString REF_DATA_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO";
+const QString DEF_STR_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/share/salome/resources/hydro/def_strickler_table.txt";
 
 void test_HYDROData_LandCoverMap::test_add_2_objects()
 {
index 7382740c31ce9975aa9747a43fe9c7ca1349dc0c..4c6741aa320793c2086c21e830bb1d244f0ebc43 100644 (file)
@@ -65,8 +65,8 @@ int main( int argc, char* argv[] )
     CppUnit::TestFactoryRegistry::getRegistry();
   // Add the top suite to the test runner
   TestLib_Runner runner;
-  QString aPath = qgetenv( "HYDRO_SRC_DIR" ) + "/src/tests.cfg";
-  runner.Load( aPath.toStdString() );
+  //QString aPath = qgetenv( "HYDRO_SRC_DIR" ) + "/src/tests.cfg";
+  //runner.Load( aPath.toStdString() );
   runner.addTest( registry.makeTest() );   
   try
   {
index e9a878df755dacaa2c9fe4eb8b602876fa22854f..b4007ceaab6b03cbaab3386bb72d37b7f12274aa 100644 (file)
@@ -21,7 +21,7 @@
 #include <QStringList>
 #include <vector>
 
-const QString REF_PATH = qgetenv( "HYDRO_DIR" ) + "/../../src/HYDRO/src/HYDRO_tests/reference_data";
+const QString REF_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO";
 
 bool test_HYDROData_ShapeFile::compare_two_files(const QString& File1, const QString& File2)
 {
index 928018bc77eded6a3e561849cebd47684a89108b..b58f0f2d38e22d66326f3cab3851e78c9a45845b 100644 (file)
@@ -28,7 +28,7 @@
 #include <QStringList>
 #include <QTableWidget>
 
-const QString DEF_STR_PATH = qgetenv( "HYDRO_SRC_DIR" ) + "/src/HYDROGUI/resources/def_strickler_table.txt";
+const QString DEF_STR_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/share/salome/resources/hydro/def_strickler_table.txt";
 
 void test_HYDROData_StricklerTable::test_import()
 {
@@ -43,12 +43,12 @@ void test_HYDROData_StricklerTable::test_import()
   CPPUNIT_ASSERT_EQUAL( 8, aTypes.size() );
   CPPUNIT_ASSERT_EQUAL( QString( "CODE_06" ), aTable->GetAttrName() );
 
-  QString aType = "Zones de champs cultivé à végétation basse";
+  QString aType = "Zones de champs cultivé à végétation basse";
   CPPUNIT_ASSERT_EQUAL( aType, aTypes[3] );
   CPPUNIT_ASSERT_EQUAL( QColor( 255, 255, 0 ), aTable->GetColor( aType ) );
   CPPUNIT_ASSERT_EQUAL( QString( "512" ), aTable->GetAttrValue( aType ) );
 
-  aType = "Zones à forte urbanization (agglomération)";
+  aType = "Zones à forte urbanization (agglomération)";
   CPPUNIT_ASSERT_EQUAL( aType, aTypes[7] );
   CPPUNIT_ASSERT_EQUAL( QColor( 18, 52, 86 ), aTable->GetColor( aType ) );
   CPPUNIT_ASSERT_EQUAL( QString( "" ), aTable->GetAttrValue( aType ) );
@@ -96,7 +96,7 @@ void test_HYDROData_StricklerTable::test_type_by_attr()
 
   CPPUNIT_ASSERT_EQUAL( true, aTable->Import( DEF_STR_PATH ) );
 
-  CPPUNIT_ASSERT_EQUAL( QString( "Zones de champs cultivé à végétation basse" ), aTable->GetType( "512" ) );
+  CPPUNIT_ASSERT_EQUAL( QString( "Zones de champs cultivé à végétation basse" ), aTable->GetType( "512" ) );
   CPPUNIT_ASSERT_EQUAL( QString( "" ), aTable->GetType( "123" ) );
   CPPUNIT_ASSERT_EQUAL( QString( "" ), aTable->GetType( "" ) );