From: asl Date: Thu, 15 Oct 2015 13:29:56 +0000 (+0300) Subject: #668: additional split test X-Git-Tag: v1.5~109^2~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1834187d193fa93a6ac31967ae2fbebf15853888;p=modules%2Fhydro.git #668: additional split test --- diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Split_1.png b/src/HYDRO_tests/reference_data/LandCoverMap_Split_1.png index 24d4ac8c..d76a7f7e 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Split_1.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Split_1.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Split_2.png b/src/HYDRO_tests/reference_data/LandCoverMap_Split_2.png new file mode 100644 index 00000000..1a2e977b Binary files /dev/null and b/src/HYDRO_tests/reference_data/LandCoverMap_Split_2.png differ diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx index 31518dca..2f077e16 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx @@ -101,7 +101,7 @@ void test_HYDROData_LandCoverMap::test_add_2_objects() aDoc->Close(); } -void test_HYDROData_LandCoverMap::test_split_by_polyline() +void test_HYDROData_LandCoverMap::test_split() { Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); @@ -136,6 +136,38 @@ void test_HYDROData_LandCoverMap::test_split_by_polyline() aDoc->Close(); } +void test_HYDROData_LandCoverMap::test_incomplete_split() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + Handle(HYDROData_LandCoverMap) aMap = + Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); + + CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() ); + + TopoDS_Face aLC = LandCover( QList() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 ); + CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC, "test1" ) ); + + Handle(HYDROData_PolylineXY) aPolyline = + Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); + TopoDS_Wire aWire = BRepBuilderAPI_MakeWire( Spline( QList() << 10 << 40 << 30 << 10 << 40 << 10 ) ).Wire(); + aPolyline->SetShape( aWire ); + + CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) ); + + TestViewer::show( aMap->GetShape(), AIS_Shaded, true ); + TestViewer::show( aWire, QColor(), 0 ); + TestViewer::AssertEqual( "LandCoverMap_Split_2" ); + + HYDROData_LandCoverMap::Iterator anIt( aMap ); + CPPUNIT_ASSERT_EQUAL( true, anIt.More() ); + CPPUNIT_ASSERT_EQUAL( QString( "test1" ), anIt.StricklerType() ); + anIt.Next(); + CPPUNIT_ASSERT_EQUAL( false, anIt.More() ); + + aDoc->Close(); +} + void test_HYDROData_LandCoverMap::test_merge() { Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h index 2e7cdd40..f054a687 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h @@ -26,14 +26,16 @@ class test_HYDROData_LandCoverMap : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( test_HYDROData_LandCoverMap ); CPPUNIT_TEST( test_add_2_objects ); - CPPUNIT_TEST( test_split_by_polyline ); + CPPUNIT_TEST( test_split ); + CPPUNIT_TEST( test_incomplete_split ); CPPUNIT_TEST( test_merge ); CPPUNIT_TEST( test_remove ); CPPUNIT_TEST_SUITE_END(); public: void test_add_2_objects(); - void test_split_by_polyline(); + void test_split(); + void test_incomplete_split(); void test_merge(); void test_remove(); };