1 #include<test_HYDROData_Polyline.h>
3 #include <HYDROData_Document.h>
4 #include <HYDROData_Polyline.h>
9 void test_HYDROData_Polyline::testPolyline()
11 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
13 Handle(HYDROData_Polyline) aPolyline =
14 Handle(HYDROData_Polyline)::DownCast(aDoc->CreateObject(KIND_POLYLINE));
17 int aDim = aPolyline->GetDimension();
18 CPPUNIT_ASSERT(aDim == 0 );
20 aPolyline->SetDimension(2);
21 aDim = aPolyline->GetDimension();
22 CPPUNIT_ASSERT( aDim == 2 );
24 aPolyline->SetDimension(3);
25 aDim = aPolyline->GetDimension();
26 CPPUNIT_ASSERT( aDim == 3 );
28 PolylineSection aSect1;
29 aSect1.mySectionName = "Section_1";
30 aSect1.myType = PolylineSection::SECTION_POLYLINE;
31 aSect1.myIsClosed = false;
33 QList<PolylineSection> aSections;
36 PolylineSection aSect2;
37 aSect1.mySectionName = "Section_2";
38 aSect1.myType = PolylineSection::SECTION_SPLINE;
39 aSect1.myIsClosed = true;
42 aPolyline->SetPolylineData( aSections );
43 QList<PolylineSection> aRestoredSect = aPolyline->GetPolylineData();
44 int aRestSize = aRestoredSect.size();
45 CPPUNIT_ASSERT( aRestSize == 2 );
47 // printf("Sect1.Name=%s RestName=%s\n", aSect1.mySectionName, aRestoredSect[0].mySectionName );
48 CPPUNIT_ASSERT( aRestoredSect[0].myType == PolylineSection::SECTION_POLYLINE );
49 CPPUNIT_ASSERT( aRestoredSect[0].myIsClosed == false );
50 CPPUNIT_ASSERT( aRestoredSect[0].mySectionName.IsLess( aSect1.mySectionName ) == false );
51 CPPUNIT_ASSERT( aRestoredSect[0].mySectionName.IsGreater( aSect1.mySectionName ) == false );
52 CPPUNIT_ASSERT( aRestoredSect[0].myCoords.size() == 0 );
54 CPPUNIT_ASSERT( aRestoredSect[1].myType == PolylineSection::SECTION_SPLINE );
55 CPPUNIT_ASSERT( aRestoredSect[1].myIsClosed == true );
56 CPPUNIT_ASSERT( aRestoredSect[1].mySectionName.IsLess( aSect2.mySectionName ) == false );
57 CPPUNIT_ASSERT( aRestoredSect[1].mySectionName.IsGreater( aSect2.mySectionName ) == false );
58 CPPUNIT_ASSERT( aRestoredSect[1].myCoords.size() == 0 );
64 void test_HYDROData_Polyline::testCopy()
66 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
67 Handle(HYDROData_Polyline) aPolyline1 =
68 Handle(HYDROData_Polyline)::DownCast(aDoc->CreateObject(KIND_POLYLINE));
71 // aPolyline1->setPoints(aPoints);
73 Handle(HYDROData_Polyline) aPolyline2 =
74 Handle(HYDROData_Polyline)::DownCast(aDoc->CreateObject(KIND_POLYLINE));
76 aPolyline1->CopyTo(aPolyline2);