]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #691: the automatic test covering the bug #691
authorasl <asl@opencascade.com>
Tue, 17 Nov 2015 14:52:12 +0000 (17:52 +0300)
committerasl <asl@opencascade.com>
Wed, 18 Nov 2015 04:52:29 +0000 (07:52 +0300)
src/HYDROData/HYDROData_PolylineXY.cxx
src/HYDRO_tests/reference_data/LandCoverMap_Merge_2.png [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx
src/HYDRO_tests/test_HYDROData_LandCoverMap.h

index 5127c91b7d84b4a8421bfe7ad5f25f58e2ee68d0..ea4eaf09f91f4959bbffc31f3c6b3e88f0995aa7 100644 (file)
@@ -541,7 +541,7 @@ void HYDROData_PolylineXY::Update()
   aBB.MakeCompound(aCmp);
   if(aSeqEdges->Length() >1)
   {
-    ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdges,1E-5,Standard_False,aSeqWires);
+    ShapeAnalysis_FreeBounds::ConnectEdgesToWires( aSeqEdges, 1E-5, Standard_True, aSeqWires );
 
     if( aSeqWires->Length()==1 )
       aResult = aSeqWires->Value( 1 );
diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Merge_2.png b/src/HYDRO_tests/reference_data/LandCoverMap_Merge_2.png
new file mode 100644 (file)
index 0000000..e4ff080
Binary files /dev/null and b/src/HYDRO_tests/reference_data/LandCoverMap_Merge_2.png differ
index 286767a636c6bb8756086eaef4d60787adcd1d28..83345f84f23a6bc5c5116caba53b76c7e9b8bae6 100644 (file)
@@ -35,6 +35,7 @@
 #include <TopTools_ListOfShape.hxx>
 #include <AIS_DisplayMode.hxx>
 #include <Aspect_ColorScale.hxx>
+#include <BRepMesh_IncrementalMesh.hxx>
 #include <QString>
 #include <QColor>
 #include <QMap>
@@ -188,6 +189,66 @@ void test_HYDROData_LandCoverMap::test_merge()
   aDoc->Close();
 }
 
+void test_HYDROData_LandCoverMap::test_merge_refs_691()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+  Handle(HYDROData_PolylineXY) Polyline_4 =
+    Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+  Polyline_4->SetName( "test_Polyline_4" );
+  Polyline_4->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, true );
+  Polyline_4->AddPoint( 0, gp_XY( -242.741935, -16.129032 ) );
+  Polyline_4->AddPoint( 0, gp_XY( -339.516129, -95.161290 ) );
+  Polyline_4->AddPoint( 0, gp_XY( -204.032258, -167.740000 ) );
+  Polyline_4->AddPoint( 0, gp_XY( -86.290000, -158.060000 ) );
+  Polyline_4->AddPoint( 0, gp_XY( -83.064516, -37.096774 ) );
+  Polyline_4->AddPoint( 0, gp_XY( -116.935484, 17.741935 ) );
+  Polyline_4->AddSection( "Section_2", HYDROData_PolylineXY::SECTION_POLYLINE, true );
+  Polyline_4->AddPoint( 1, gp_XY( -239.516129, -295.161290 ) );
+  Polyline_4->AddPoint( 1, gp_XY( -204.030000, -167.740000 ) );
+  Polyline_4->AddPoint( 1, gp_XY( -86.290000, -158.060000 ) );
+  Polyline_4->AddPoint( 1, gp_XY( -2.419355, -288.709677 ) );
+  Polyline_4->AddPoint( 1, gp_XY( -165.322581, -351.612903 ) );
+  Polyline_4->Update();
+
+  Handle(HYDROData_LandCoverMap) aMap =
+    Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+
+  CPPUNIT_ASSERT_EQUAL( true, aMap->Add( Polyline_4, "test" ) );
+
+  TopTools_ListOfShape aList;
+  HYDROData_LandCoverMap::Explorer anIt( aMap );
+  CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+  CPPUNIT_ASSERT_EQUAL( QString( "test" ), anIt.StricklerType() );
+  aList.Append( anIt.Face() );
+  anIt.Next();
+  CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+  CPPUNIT_ASSERT_EQUAL( QString( "test" ), anIt.StricklerType() );
+  aList.Append( anIt.Face() );
+  anIt.Next();
+  CPPUNIT_ASSERT_EQUAL( false, anIt.More() );
+
+  BRepCheck_Analyzer aCheck1( aMap->GetShape() );
+  CPPUNIT_ASSERT_EQUAL( true, (bool)aCheck1.IsValid() );
+  
+  CPPUNIT_ASSERT_EQUAL( true, aMap->Merge( aList, "test" ) );
+
+  BRepCheck_Analyzer aCheck2( aMap->GetShape() );
+  CPPUNIT_ASSERT_EQUAL( true, (bool)aCheck2.IsValid() );
+
+  // we try construct the triangulation to check that it is correct
+  BRepMesh_IncrementalMesh anIncMesh( aMap->GetShape(), 0.01 );
+  CPPUNIT_ASSERT_EQUAL( true, (bool)anIncMesh.IsDone() );
+  BRepCheck_Analyzer aCheck3( aMap->GetShape() );
+  CPPUNIT_ASSERT_EQUAL( true, (bool)aCheck3.IsValid() );
+
+  Handle(HYDROGUI_LandCoverMapPrs) aPrs = new HYDROGUI_LandCoverMapPrs( aMap );
+  TestViewer::show( aPrs, AIS_Shaded, 0, true, "LandCoverMap_Merge_2" );
+  CPPUNIT_ASSERT_IMAGES
+
+  aDoc->Close();
+}
+
 void test_HYDROData_LandCoverMap::test_remove()
 {
   Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
@@ -481,7 +542,6 @@ void test_HYDROData_LandCoverMap::test_import_dbf()
   QList<int> Inds = QList<int>() << 1 << 2 << 3;
   aMap->ImportDBF(aFileName, "TESTFIELD1", aDBFV, aST, Inds);
   HYDROData_LandCoverMap::Explorer anIt( aMap );
   CPPUNIT_ASSERT_EQUAL( QString( "forest" ), anIt.StricklerType() );
   anIt.Next();
   CPPUNIT_ASSERT_EQUAL( QString( "road" ), anIt.StricklerType() );
index 79eb35d365663346f95d23071533c6018f341793..85d34bc750777bbf0467e9ec53003ff74dbd349b 100644 (file)
@@ -33,6 +33,7 @@ class test_HYDROData_LandCoverMap : public CppUnit::TestFixture
   CPPUNIT_TEST( test_split_2 );
   CPPUNIT_TEST( test_incomplete_split );
   CPPUNIT_TEST( test_merge );
+  CPPUNIT_TEST( test_merge_refs_691 );
   CPPUNIT_TEST( test_remove );
   CPPUNIT_TEST( test_merge_faces_boxes );
   CPPUNIT_TEST( test_merge_faces_circles );
@@ -60,6 +61,7 @@ public:
   void test_split_2();
   void test_incomplete_split();
   void test_merge();
+  void test_merge_refs_691();
   void test_remove();
   void test_merge_faces_boxes();
   void test_merge_faces_circles();