From: asl Date: Fri, 23 Oct 2015 14:52:21 +0000 (+0300) Subject: new test on problem in the land cover map's local partition X-Git-Tag: v1.5~72 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9d4c1feb9d434d7d98d02a7a291ccf41c3bcb4c8;p=modules%2Fhydro.git new test on problem in the land cover map's local partition --- diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx index 1ae4bd40..c8c12a84 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx @@ -412,7 +412,6 @@ void test_HYDROData_LandCoverMap::test_merge_faces_circles() CPPUNIT_ASSERT_IMAGES CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL); } - } void test_HYDROData_LandCoverMap::test_import_dbf() @@ -450,6 +449,8 @@ void test_HYDROData_LandCoverMap::test_import_dbf() CPPUNIT_ASSERT_EQUAL( QString( "forest" ), anIt.StricklerType() ); anIt.Next(); CPPUNIT_ASSERT_EQUAL( QString( "road" ), anIt.StricklerType() ); + + aDoc->Close(); } void test_HYDROData_LandCoverMap::test_land_cover_prs_by_types() @@ -550,6 +551,8 @@ void test_HYDROData_LandCoverMap::test_dump_python() CPPUNIT_ASSERT_EQUAL( true, aDoc->DumpToPython( aTmpPath, false ) ); //TODO: compare files + + aDoc->Close(); } void test_HYDROData_LandCoverMap::test_transparent_prs() @@ -587,4 +590,75 @@ void test_HYDROData_LandCoverMap::test_transparent_prs() TestViewer::show( aPrs, AIS_Shaded, 0, true, "" ); CPPUNIT_ASSERT_IMAGES + aDoc->Close(); +} + +void test_HYDROData_LandCoverMap::test_add_triangles() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + Handle(HYDROData_PolylineXY) Polyline_1 = + Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); + + Polyline_1->SetName( "Polyline_1" ); + Polyline_1->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, true ); + Polyline_1->AddPoint( 0, gp_XY( -264.84, 323.44 ) ); + Polyline_1->AddPoint( 0, gp_XY( 254.45, 301.19 ) ); + Polyline_1->AddPoint( 0, gp_XY( -291.54, -47.48 ) ); + Polyline_1->Update(); + + Handle(HYDROData_PolylineXY) Polyline_2 = + Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); + Polyline_2->SetName( "Polyline_2" ); + Polyline_2->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, false ); + Polyline_2->AddPoint( 0, gp_XY( -42.28, -351.63 ) ); + Polyline_2->AddPoint( 0, gp_XY( 218.84, -146.88 ) ); + Polyline_2->AddPoint( 0, gp_XY( 413.20, -235.91 ) ); + Polyline_2->AddPoint( 0, gp_XY( 466.62, -388.72 ) ); + Polyline_2->Update(); + + Handle(HYDROData_PolylineXY) Polyline_3 = + Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); + Polyline_3->SetName( "Polyline_3" ); + Polyline_3->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, true ); + Polyline_3->AddPoint( 0, gp_XY( -108.31, 213.65 ) ); + Polyline_3->AddPoint( 0, gp_XY( 127.60, 382.79 ) ); + Polyline_3->AddPoint( 0, gp_XY( 192.88, -91.99 ) ); + Polyline_3->Update(); + + Handle(HYDROData_PolylineXY) Polyline_4 = + Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); + Polyline_4->SetName( "Polyline_4" ); + Polyline_4->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, true ); + Polyline_4->AddPoint( 0, gp_XY( 215.52, 344.61 ) ); + Polyline_4->AddPoint( 0, gp_XY( 68.25, 258.52 ) ); + Polyline_4->AddPoint( 0, gp_XY( 200.58, 154.65 ) ); + Polyline_4->Update(); + + Handle(HYDROData_PolylineXY) Polyline_5 = + Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); + Polyline_5->SetName( "Polyline_5" ); + Polyline_5->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, false ); + Polyline_5->AddPoint( 0, gp_XY( 16.15, -58.08 ) ); + Polyline_5->AddPoint( 0, gp_XY( 116.47, 84.21 ) ); + Polyline_5->AddPoint( 0, gp_XY( 266.59, 29.43 ) ); + Polyline_5->Update(); + + Handle(HYDROData_LandCoverMap) aMap = + Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); + + CPPUNIT_ASSERT_EQUAL( true, aMap->Add( Polyline_1, "" ) ); + CPPUNIT_ASSERT_EQUAL( true, aMap->Add( Polyline_3, "" ) ); + CPPUNIT_ASSERT_EQUAL( true, aMap->Add( Polyline_4, "" ) ); + + Handle(HYDROGUI_LandCoverMapPrs) aPrs = new HYDROGUI_LandCoverMapPrs( aMap ); + TestViewer::show( aPrs, AIS_Shaded, 0, true, "LandCover_Triangles" ); + CPPUNIT_ASSERT_IMAGES + + CPPUNIT_ASSERT_EQUAL( true, aMap->Split( Polyline_5 ) ); + Handle(HYDROGUI_LandCoverMapPrs) aPrs2 = new HYDROGUI_LandCoverMapPrs( aMap ); + TestViewer::show( aPrs2, AIS_Shaded, 0, true, "LandCover_Triangles_Split" ); + CPPUNIT_ASSERT_IMAGES + + aDoc->Close(); } diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h index 609a1802..8af209a0 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h @@ -26,6 +26,7 @@ class test_HYDROData_LandCoverMap : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( test_HYDROData_LandCoverMap ); CPPUNIT_TEST( test_add_2_objects ); + CPPUNIT_TEST( test_add_triangles ); CPPUNIT_TEST( test_split ); CPPUNIT_TEST( test_incomplete_split ); CPPUNIT_TEST( test_merge ); @@ -41,6 +42,7 @@ class test_HYDROData_LandCoverMap : public CppUnit::TestFixture public: void test_add_2_objects(); + void test_add_triangles(); void test_split(); void test_incomplete_split(); void test_merge();