From b2a40977cfe1563834f4a3bb095988d90ec6f583 Mon Sep 17 00:00:00 2001 From: asl Date: Wed, 21 Oct 2015 16:20:00 +0300 Subject: [PATCH] refs #611: test for polylines extraction on immersible zone --- .../reference_data/Extraction_ImmZone.png | Bin 0 -> 6818 bytes src/HYDRO_tests/test_HYDROData_PolylineXY.cxx | 34 ++++++++++++++++++ src/HYDRO_tests/test_HYDROData_PolylineXY.h | 3 ++ 3 files changed, 37 insertions(+) create mode 100644 src/HYDRO_tests/reference_data/Extraction_ImmZone.png 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 0000000000000000000000000000000000000000..9e9197879742bc966e5eecd8dff67ea01321a589 GIT binary patch literal 6818 zcmbtYd0bORw4R#;5{Qt5T?izgASh+2Y@)y=qJpwSL`)PRAPBCkE+E1M0zy?liHZvv zDq4zI<65YeO;!b=F1UlTt6+&NBC@=>k@oey*Z0qR`Th7YXXeazzVn?kb8nKt^<1H( zsI3S9P;zs1@dkj%27th$$itaayOSf}KTc+x@$in!WTH)8cTGvo z!iBvd<;5e3ZI0(IJ+Nweo^*3}&&&4fqn-+o6#!!Er5`l`u+~|ly>7C7*3=|5rr#Bx z`O5F5ef}d;*Wvo7>CLa6I}V>)RRAu3>XAon4#?HoCzgcQJkJ|gI<0+#@VH(_6I^F# z4XK!*hwqpm5}TyeWhn;B&VWUGJCQdid0ART;YsibCcd+ z?=l!+DW^3B2Di^Iji|U&O?iA@i7GK#Ko$iu=5R>w-z=Bo9esmc<1Z5{@ASm>QLa_QO!AEthfw}2A$WIrkgnTe(|iz3*y$+V(5l>bf}RxrDh6HWLYADSC+*#7 zBc^8Z5HiDnUgsfib^irYyfVFF;*}p7U94MiQAla5^N_Que1SANr&kQWaz~#O>!Kum z!lOu4Fu4z`G;k5@->EGQgLsCj1`>N)Dwny9%+=8++>g!yHIm)n zrm8`Noh>>0*iB;C5qi>OsR?EZ@n{b|Za+vb5$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J zerVBti|mM6O0;r4#9au7(VK`?o`<-q=eElYM5hpATn=&PUm_3R^-yjxvE(QS$-{L` z%9xh^V*`6{6}^@@whlm3dbO<4IR;SM0C<+OR_KwTEHH1I1?)sxf$C>J0OgLu2zD%; zF&Z=gj&~~&u$vi2%Ak*Kn<>Z@YQ0P812)}vT1IUW(6{oJ-c_R;OneP(uotnaMDf0_mkrmbD8sKB_~-JtQ(2^r VU`ziU_{$IgZp%Dfe&Gm`{{x70+b944 literal 0 HcmV?d00001 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); -- 2.39.2