From: asl Date: Tue, 17 Nov 2015 09:19:39 +0000 (+0300) Subject: refs #670: test on copy land cover map X-Git-Tag: v1.5~29^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d470864e30a45ef95c8933c0e65317158c8ec245;p=modules%2Fhydro.git refs #670: test on copy land cover map --- diff --git a/src/HYDRO_tests/reference_data/LCM_copied.png b/src/HYDRO_tests/reference_data/LCM_copied.png new file mode 100644 index 00000000..72382b9b Binary files /dev/null and b/src/HYDRO_tests/reference_data/LCM_copied.png differ diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx index b096850b..286767a6 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx @@ -1021,3 +1021,45 @@ void test_HYDROData_LandCoverMap::test_export_telemac() aDoc->Close(); } + +void test_HYDROData_LandCoverMap::test_copy() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + Handle(HYDROData_LandCoverMap) aMap = + Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); + aMap->SetName( "map_1" ); + + TopoDS_Face aLC1 = Face( QList() << 10 << 10 << 30 << 10 << 20 << 20 ); + CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "Zones de champs cultivé à végétation basse" ) ); + + TopoDS_Face aLC2 = Face( QList() << 110 << 10 << 130 << 10 << 120 << 20 ); + CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "Zones de champs cultivé à végétation haute" ) ); + + Handle(HYDROData_LandCoverMap) aMap2 = + Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); + aMap->CopyTo( aMap2, true ); + + CPPUNIT_ASSERT_EQUAL( QString( "map_2" ), aMap2->GetName() ); + HYDROData_LandCoverMap::Explorer anIt( aMap2 ); + CPPUNIT_ASSERT_EQUAL( true, anIt.More() ); + CPPUNIT_ASSERT_EQUAL( QString( "Zones de champs cultivé à végétation basse" ), anIt.StricklerType() ); + CPPUNIT_ASSERT( anIt.Face().TShape()!=aLC1.TShape() ); + anIt.Next(); + CPPUNIT_ASSERT_EQUAL( true, anIt.More() ); + CPPUNIT_ASSERT_EQUAL( QString( "Zones de champs cultivé à végétation haute" ), anIt.StricklerType() ); + CPPUNIT_ASSERT( anIt.Face().TShape()!=aLC2.TShape() ); + anIt.Next(); + CPPUNIT_ASSERT_EQUAL( false, anIt.More() ); + + TopoDS_Shape aShape1 = aMap->GetShape(); + TopoDS_Shape aShape2 = aMap2->GetShape(); + gp_Trsf aTr; + aTr.SetTranslation( gp_Vec( 0, 50, 0 ) ); + aShape2.Move( TopLoc_Location( aTr ) ); + TestViewer::show( aShape1, AIS_Shaded, /*0,*/ true, "LCM_copied" ); + TestViewer::show( aShape2, AIS_Shaded, /*0,*/ true, "" ); + CPPUNIT_ASSERT_IMAGES + + aDoc->Close(); +} diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h index 36c8f6bd..79eb35d3 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h @@ -43,6 +43,7 @@ class test_HYDROData_LandCoverMap : public CppUnit::TestFixture CPPUNIT_TEST( test_transparent_prs ); CPPUNIT_TEST( test_assign_to_calc_case ); CPPUNIT_TEST( test_export_telemac ); + CPPUNIT_TEST( test_copy ); #ifdef SHP_TESTS CPPUNIT_TEST( test_shp_import_cyp ); CPPUNIT_TEST( test_shp_import_clc_dec ); @@ -73,6 +74,7 @@ public: void test_shp_import_nld_areas(); void test_shp_loop_back(); void test_export_telemac(); + void test_copy(); }; CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_LandCoverMap );