]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
#668: additional split test
authorasl <asl@opencascade.com>
Thu, 15 Oct 2015 13:29:56 +0000 (16:29 +0300)
committerasl <asl@opencascade.com>
Thu, 15 Oct 2015 13:29:56 +0000 (16:29 +0300)
src/HYDRO_tests/reference_data/LandCoverMap_Split_1.png
src/HYDRO_tests/reference_data/LandCoverMap_Split_2.png [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx
src/HYDRO_tests/test_HYDROData_LandCoverMap.h

index 24d4ac8c15446e59a2ea2bb8e73d1482d6b80846..d76a7f7e848083ab27c3d36fe1c1245e055feaf4 100644 (file)
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 (file)
index 0000000..1a2e977
Binary files /dev/null and b/src/HYDRO_tests/reference_data/LandCoverMap_Split_2.png differ
index 31518dcaf5b4cd3eec7ce384b733b08575a2f927..2f077e1684553642d3ca233087a107dc47174d65 100644 (file)
@@ -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<double>() << 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<double>() << 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);
index 2e7cdd4077566b8facea95908618a058bf25e8dc..f054a6879fb0deb8f3dfae1ce0890ebcb6f0ac22 100644 (file)
@@ -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();
 };