]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
new test on problem in the land cover map's local partition
authorasl <asl@opencascade.com>
Fri, 23 Oct 2015 14:52:21 +0000 (17:52 +0300)
committerasl <asl@opencascade.com>
Fri, 23 Oct 2015 14:52:21 +0000 (17:52 +0300)
src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx
src/HYDRO_tests/test_HYDROData_LandCoverMap.h

index 1ae4bd40d0eb23d0ee5dcc620fec4370bbda463a..c8c12a84da8aca679faafa78bee81cc4dd016dd8 100644 (file)
@@ -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();
 }
index 609a1802e23f52050a097a6c517077accb8befda..8af209a0f7225a083a7887c1760248a1302c90d6 100644 (file)
@@ -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();