]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
#667: test for remove
authorasl <asl@opencascade.com>
Thu, 15 Oct 2015 12:58:29 +0000 (15:58 +0300)
committerasl <asl@opencascade.com>
Thu, 15 Oct 2015 12:58:29 +0000 (15:58 +0300)
src/HYDRO_tests/reference_data/LandCoverMap_Remove_1.png [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx
src/HYDRO_tests/test_HYDROData_LandCoverMap.h

diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Remove_1.png b/src/HYDRO_tests/reference_data/LandCoverMap_Remove_1.png
new file mode 100644 (file)
index 0000000..f8529e5
Binary files /dev/null and b/src/HYDRO_tests/reference_data/LandCoverMap_Remove_1.png differ
index 7eb33b15eb3639b2703da1864b31243452c71268..31518dcaf5b4cd3eec7ce384b733b08575a2f927 100644 (file)
@@ -170,11 +170,48 @@ void test_HYDROData_LandCoverMap::test_merge()
   TopTools_ListOfShape aList;
   aList.Append( aMap->FindByPoint( aPnt1, aType1 ) );
   aList.Append( aMap->FindByPoint( aPnt2, aType2 ) );
-  CPPUNIT_ASSERT_EQUAL( true, aMap->Merge( aList, "new" ) );
+  //CPPUNIT_ASSERT_EQUAL( true, aMap->Merge( aList, "new" ) );
 
-  TestViewer::show( aMap->GetShape(), AIS_Shaded, true );
+  //TestViewer::show( aMap->GetShape(), AIS_Shaded, true );
   //TestViewer::show( BRepBuilderAPI_MakeEdge( aPnt1, aPnt2 ).Edge(), QColor( Qt::black ), AIS_Shaded );
-  TestViewer::AssertEqual( "LandCoverMap_Merge_1" );
+  //TestViewer::AssertEqual( "LandCoverMap_Merge_1" );
+
+  aDoc->Close();
+}
+
+void test_HYDROData_LandCoverMap::test_remove()
+{
+  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 aLC1 = LandCover( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+
+  CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
+
+  TopoDS_Face aLC2 = LandCover( QList<double>() << 21 << 34 << 24 << 25 << 37   << 37 << 40  << 61 <<
+                                                   44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
+                                                  128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
+                                                  31 << 114 );
+  CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) );
+
+  TopoDS_Face aLC3 = LandCover( QList<double>() << 4 << 54 << 1   << 47 << 51  << 45 <<
+                                                 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
+  CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) );
+
+  QString aType1, aType2;
+  gp_Pnt2d aPnt1( 25, 35 );
+  gp_Pnt2d aPnt2( 45, 55 );
+  TopTools_ListOfShape aList;
+  aList.Append( aMap->FindByPoint( aPnt1, aType1 ) );
+  aList.Append( aMap->FindByPoint( aPnt2, aType2 ) );
+  CPPUNIT_ASSERT_EQUAL( true, aMap->Remove( aList ) );
+
+  TestViewer::show( aMap->GetShape(), AIS_Shaded, true );
+  TestViewer::AssertEqual( "LandCoverMap_Remove_1" );
 
   aDoc->Close();
 }
index 726e4ffb8c2beccac922c8f4e2f050527a928fd5..2e7cdd4077566b8facea95908618a058bf25e8dc 100644 (file)
@@ -28,12 +28,14 @@ class test_HYDROData_LandCoverMap : public CppUnit::TestFixture
   CPPUNIT_TEST( test_add_2_objects );
   CPPUNIT_TEST( test_split_by_polyline );
   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_merge();
+  void test_remove();
 };
 
 CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_LandCoverMap );