From: asl Date: Wed, 21 Oct 2015 13:20:00 +0000 (+0300) Subject: refs #611: test for polylines extraction on immersible zone X-Git-Tag: v1.5~75^2~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b2a40977cfe1563834f4a3bb095988d90ec6f583;p=modules%2Fhydro.git refs #611: test for polylines extraction on immersible zone --- diff --git a/src/HYDRO_tests/reference_data/Extraction_ImmZone.png b/src/HYDRO_tests/reference_data/Extraction_ImmZone.png new file mode 100644 index 00000000..9e919787 Binary files /dev/null and b/src/HYDRO_tests/reference_data/Extraction_ImmZone.png differ diff --git a/src/HYDRO_tests/test_HYDROData_PolylineXY.cxx b/src/HYDRO_tests/test_HYDROData_PolylineXY.cxx index ff966ddc..cb3a5592 100644 --- a/src/HYDRO_tests/test_HYDROData_PolylineXY.cxx +++ b/src/HYDRO_tests/test_HYDROData_PolylineXY.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -116,3 +117,36 @@ void test_HYDROData_PolylineXY::testSplit_refs_624() aDoc->Close(); } +void test_HYDROData_PolylineXY::test_extraction_immersible_zone() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 ); + + Handle(HYDROData_PolylineXY) aPolyline = + Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); + aPolyline->SetName( "test" ); + + QList aCoords = QList() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20; + TopoDS_Wire aWire = Wire( aCoords, true ); + aPolyline->SetShape( aWire ); + + Handle(HYDROData_ImmersibleZone) aZone = + Handle(HYDROData_ImmersibleZone)::DownCast( aDoc->CreateObject( KIND_IMMERSIBLE_ZONE ) ); + aZone->SetName( "zone" ); + aZone->SetPolyline( aPolyline ); + aZone->Update(); + + CPPUNIT_ASSERT_EQUAL( false, (bool)aZone->GetTopShape().IsNull() ); + + HYDROData_PolylineOperator anOp; + CPPUNIT_ASSERT_EQUAL( true, anOp.Extract( aDoc, aZone ) ); + + Handle(HYDROData_PolylineXY) anOuter = + Handle(HYDROData_PolylineXY)::DownCast( aDoc->FindObjectByName( "zone_Outer_1", KIND_POLYLINEXY ) ); + CPPUNIT_ASSERT_EQUAL( false, (bool)anOuter.IsNull() ); + + TestViewer::show( aZone->GetTopShape(), 1, true, "Extraction_ImmZone" ); + TestViewer::show( anOuter->GetShape(), 0, true, Qt::red ); + CPPUNIT_ASSERT_IMAGES + + aDoc->Close(); +} diff --git a/src/HYDRO_tests/test_HYDROData_PolylineXY.h b/src/HYDRO_tests/test_HYDROData_PolylineXY.h index e67e36f3..829d7f3b 100644 --- a/src/HYDRO_tests/test_HYDROData_PolylineXY.h +++ b/src/HYDRO_tests/test_HYDROData_PolylineXY.h @@ -23,6 +23,7 @@ class test_HYDROData_PolylineXY : public CppUnit::TestFixture { CPPUNIT_TEST( testPolyline ); CPPUNIT_TEST( testCopy ); CPPUNIT_TEST( testSplit_refs_624 ); + CPPUNIT_TEST( test_extraction_immersible_zone ); CPPUNIT_TEST_SUITE_END(); private: @@ -40,6 +41,8 @@ public: void testCopy(); void testSplit_refs_624(); + + void test_extraction_immersible_zone(); }; CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_PolylineXY);