From b53bfa8e9a1483539ee14f785b316390b3d13484 Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Wed, 18 May 2016 20:29:59 +0200 Subject: [PATCH] HYDRO_tests reference data on install directory --- src/HYDROData/HYDROData_LandCoverMap.cxx | 11 +- src/HYDRO_tests/CMakeLists.txt | 1 + src/HYDRO_tests/TestViewer.cxx | 4 +- src/HYDRO_tests/reference_data/CMakeLists.txt | 110 ++++++++++++++++++ .../test_HYDROData_LandCoverMap.cxx | 5 +- src/HYDRO_tests/test_HYDROData_Main.cxx | 4 +- src/HYDRO_tests/test_HYDROData_ShapeFile.cxx | 2 +- .../test_HYDROData_StricklerTable.cxx | 8 +- 8 files changed, 132 insertions(+), 13 deletions(-) create mode 100644 src/HYDRO_tests/reference_data/CMakeLists.txt diff --git a/src/HYDROData/HYDROData_LandCoverMap.cxx b/src/HYDROData/HYDROData_LandCoverMap.cxx index 4b577db8..a8325aef 100644 --- a/src/HYDROData/HYDROData_LandCoverMap.cxx +++ b/src/HYDROData/HYDROData_LandCoverMap.cxx @@ -68,6 +68,9 @@ #include #include +#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 ); diff --git a/src/HYDRO_tests/CMakeLists.txt b/src/HYDRO_tests/CMakeLists.txt index b77ef953..1e95d072 100644 --- a/src/HYDRO_tests/CMakeLists.txt +++ b/src/HYDRO_tests/CMakeLists.txt @@ -1,3 +1,4 @@ +ADD_SUBDIRECTORY(reference_data) include(../../CMake/Common.cmake) include(ExternalFiles.cmake) diff --git a/src/HYDRO_tests/TestViewer.cxx b/src/HYDRO_tests/TestViewer.cxx index d3e997c6..75fcaeb3 100644 --- a/src/HYDRO_tests/TestViewer.cxx +++ b/src/HYDRO_tests/TestViewer.cxx @@ -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 index 00000000..e1b18f95 --- /dev/null +++ b/src/HYDRO_tests/reference_data/CMakeLists.txt @@ -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}) diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx index 5adf002a..c7e3b4c7 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx @@ -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() { diff --git a/src/HYDRO_tests/test_HYDROData_Main.cxx b/src/HYDRO_tests/test_HYDROData_Main.cxx index 7382740c..4c6741aa 100644 --- a/src/HYDRO_tests/test_HYDROData_Main.cxx +++ b/src/HYDRO_tests/test_HYDROData_Main.cxx @@ -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 { diff --git a/src/HYDRO_tests/test_HYDROData_ShapeFile.cxx b/src/HYDRO_tests/test_HYDROData_ShapeFile.cxx index e9a878df..b4007cea 100644 --- a/src/HYDRO_tests/test_HYDROData_ShapeFile.cxx +++ b/src/HYDRO_tests/test_HYDROData_ShapeFile.cxx @@ -21,7 +21,7 @@ #include #include -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) { diff --git a/src/HYDRO_tests/test_HYDROData_StricklerTable.cxx b/src/HYDRO_tests/test_HYDROData_StricklerTable.cxx index 928018bc..b58f0f2d 100644 --- a/src/HYDRO_tests/test_HYDROData_StricklerTable.cxx +++ b/src/HYDRO_tests/test_HYDROData_StricklerTable.cxx @@ -28,7 +28,7 @@ #include #include -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( "" ) ); -- 2.39.2