From d470864e30a45ef95c8933c0e65317158c8ec245 Mon Sep 17 00:00:00 2001 From: asl Date: Tue, 17 Nov 2015 12:19:39 +0300 Subject: [PATCH] refs #670: test on copy land cover map --- src/HYDRO_tests/reference_data/LCM_copied.png | Bin 0 -> 4822 bytes .../test_HYDROData_LandCoverMap.cxx | 42 ++++++++++++++++++ src/HYDRO_tests/test_HYDROData_LandCoverMap.h | 2 + 3 files changed, 44 insertions(+) create mode 100644 src/HYDRO_tests/reference_data/LCM_copied.png diff --git a/src/HYDRO_tests/reference_data/LCM_copied.png b/src/HYDRO_tests/reference_data/LCM_copied.png new file mode 100644 index 0000000000000000000000000000000000000000..72382b9bb0d469a5eb50faf5d558cfae11e19563 GIT binary patch literal 4822 zcmeH}c~n!^*1%5yNdO@USU?3bM^K7VDgwqBAWT-7v?I*?0eT zjJ2hitn?OX0D!E8Inx#ZaXbKG_9#g>^HX5tIe3%sGqN~>f+Gy&!GZs!&Y3&-0U*a0 zU5KO|a$5nA54K<$9tr+=vd`u2$v5GZvjIPT^#Ac*Z>+?_1o^{5QSId;(dEa!*%XFJ z`qp3hEB8pfBgU21UXO@b=-hCxJI}0JWQHrG#G4Lo=dpYcswYq(Qc04rQRZ_A7W!7F zz0+P_86?;4U0HSUo}M556jCzUf2*`}@Z*(%#m8mMQV3|(-{ZfJz}*4Qu?^4MrrY{G z`kQN3-1Ec%BX?mz>s5w$?aHfHmtO4~>{7gJa*((I;CIGV5pQ=BbMJ3^eWg6oeY2q$ zXvrvdbN?zAY0(;I^>s>@{bf7?a7cH$>`hJ^+P1qL-l3uQ9!mt^!;Y^FN_g@_6U}dO zw`94iX^VkfF0!qyltoPa1>bw^DymLw6sX)?Xlj_KVBbHb#mtIBE!ioVNBbeVA#NM>qKQ{guT#&G1@VZ?F)|OwXL0cvn z0oKnb?z-SBf&)6W%3aS$0w~{@Q8vY4Z@f#;pv~c-K)DomFgHHoq2$5A>o}-UU>H0? zIm!0Wc9iD6h`|8-SA*B{j$pqTbJd_V5a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{+a7<^>vxqbk4HTME-Ce&R&g-kv6t{39m0%Z@>6NUJ~CZJ6d z13;q-0UPx!hoU$t!@S0F3*c41J1Q6~0ovcfw>|coo(3`?n)^{-xGcubacqNCUK64V z2uxYY*DfecJlD%Qx$ zFNgsT7UW-hytP%yITEG`=yq57H@bDyrnzjC#zTLF5)tGRQG}vGD|MfH4OFHk;Q90; ze|t&1LJA!I#hQ~Z2ThsB5Fe6`iQueBf^eoAvA-uvC1?=-AUDPI=C;!;6{`773Vf*= z$-d_-KC;WOO$##atO9v*%eNxF>Ov3S?y_l%{`iI5TnJb@!hwmyOcB;kLZDVsB`lU= zWfQcra#X}50LO&K8$K7twhk5vgvdkU9>^kF9g=`efk!ZG3X~(&H#;XH+Dv$Y?_hk2 zF_blVybR}tKg`ku9h)1bM@48=l&AD4Kpe*~>lY-<$ypxzpzgbu@D9x{geXH6lW?FU z1`RTQ$ja%-5>1d_e?f7kNfwjkk)4Z&C8w20j1J39X$H#ccaM?`K0eR(7AP_}!r;S+4CWNa4z>OHqF$&+;9 z(f%I{&%T#0U+x(Q8BL40wboysxNZ8^u%)?D^#0YEX>_3$Yzl2pHK(sNeH`AF9z2BR z;`XnH8b3k;aJSbxuWTW>vl9S@6J19jW`r8-IPSBS(c@FG_B{RK^7s|2pY?pb#^#|H zNueu~&p%HU)T))bj|IR9+2Gk~B`)khVVC+S?H46D^~{(Bf6F$@ma&j(!EZk;_WCuK z1@(uF9;FN4M&aUXhchzte1~vXoJG=q4aSGS{+?Ux!zaEG7{Kr4qU@ZOeRitp2|@A8 z=?G}%v2y|?vu%6A&P9ouS8fk0T>&?mP58L5q^DDjK%69Cs+FX>X@6YpKt&p)sicD8!X4SLA0JNo~Xw*TvQ28zJ` YjKq6y)rgE7O%kcMFtKDlHgb*pCzClose(); } + +void test_HYDROData_LandCoverMap::test_copy() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + Handle(HYDROData_LandCoverMap) aMap = + Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); + aMap->SetName( "map_1" ); + + TopoDS_Face aLC1 = Face( QList() << 10 << 10 << 30 << 10 << 20 << 20 ); + CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "Zones de champs cultivé à végétation basse" ) ); + + TopoDS_Face aLC2 = Face( QList() << 110 << 10 << 130 << 10 << 120 << 20 ); + CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "Zones de champs cultivé à végétation haute" ) ); + + Handle(HYDROData_LandCoverMap) aMap2 = + Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); + aMap->CopyTo( aMap2, true ); + + CPPUNIT_ASSERT_EQUAL( QString( "map_2" ), aMap2->GetName() ); + HYDROData_LandCoverMap::Explorer anIt( aMap2 ); + CPPUNIT_ASSERT_EQUAL( true, anIt.More() ); + CPPUNIT_ASSERT_EQUAL( QString( "Zones de champs cultivé à végétation basse" ), anIt.StricklerType() ); + CPPUNIT_ASSERT( anIt.Face().TShape()!=aLC1.TShape() ); + anIt.Next(); + CPPUNIT_ASSERT_EQUAL( true, anIt.More() ); + CPPUNIT_ASSERT_EQUAL( QString( "Zones de champs cultivé à végétation haute" ), anIt.StricklerType() ); + CPPUNIT_ASSERT( anIt.Face().TShape()!=aLC2.TShape() ); + anIt.Next(); + CPPUNIT_ASSERT_EQUAL( false, anIt.More() ); + + TopoDS_Shape aShape1 = aMap->GetShape(); + TopoDS_Shape aShape2 = aMap2->GetShape(); + gp_Trsf aTr; + aTr.SetTranslation( gp_Vec( 0, 50, 0 ) ); + aShape2.Move( TopLoc_Location( aTr ) ); + TestViewer::show( aShape1, AIS_Shaded, /*0,*/ true, "LCM_copied" ); + TestViewer::show( aShape2, AIS_Shaded, /*0,*/ true, "" ); + CPPUNIT_ASSERT_IMAGES + + aDoc->Close(); +} diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h index 36c8f6bd..79eb35d3 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h @@ -43,6 +43,7 @@ class test_HYDROData_LandCoverMap : public CppUnit::TestFixture CPPUNIT_TEST( test_transparent_prs ); CPPUNIT_TEST( test_assign_to_calc_case ); CPPUNIT_TEST( test_export_telemac ); + CPPUNIT_TEST( test_copy ); #ifdef SHP_TESTS CPPUNIT_TEST( test_shp_import_cyp ); CPPUNIT_TEST( test_shp_import_clc_dec ); @@ -73,6 +74,7 @@ public: void test_shp_import_nld_areas(); void test_shp_loop_back(); void test_export_telemac(); + void test_copy(); }; CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_LandCoverMap ); -- 2.39.2