]> SALOME platform Git repositories - modules/hydro.git/blob - src/HYDROData/test_HYDROData_PolylineXY.cxx
Salome HOME
Access methods for object groups added.
[modules/hydro.git] / src / HYDROData / test_HYDROData_PolylineXY.cxx
1 #include<test_HYDROData_PolylineXY.h>
2
3 #include <HYDROData_Document.h>
4 #include <HYDROData_PolylineXY.h>
5
6 #include <QList>
7 #include <QPointF>
8
9 void test_HYDROData_PolylineXY::testPolyline()
10 {
11   Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
12
13   Handle(HYDROData_PolylineXY) aPolyline = 
14     Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
15
16   aPolyline->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, false );
17   aPolyline->AddSection( "Section_2", HYDROData_PolylineXY::SECTION_SPLINE, true );
18
19   int aNbSections = aPolyline->NbSections();
20   CPPUNIT_ASSERT( aNbSections == 2 );
21   
22   NCollection_Sequence<TCollection_AsciiString>           aSectNames;
23   NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
24   NCollection_Sequence<bool>                              aSectClosures;
25   aPolyline->GetSections( aSectNames, aSectTypes, aSectClosures );
26
27   CPPUNIT_ASSERT( aSectNames.Value( 0 ) == "Section_1" );
28   CPPUNIT_ASSERT( aSectTypes.Value( 0 ) == HYDROData_PolylineXY::SECTION_POLYLINE );
29   CPPUNIT_ASSERT( aSectClosures.Value( 0 ) == false );
30
31   CPPUNIT_ASSERT( aSectNames.Value( 1 ) == "Section_2" );
32   CPPUNIT_ASSERT( aSectTypes.Value( 1 ) == HYDROData_PolylineXY::SECTION_SPLINE );
33   CPPUNIT_ASSERT( aSectClosures.Value( 1 ) == true );
34
35   aDoc->Close();
36 }
37
38
39 void test_HYDROData_PolylineXY::testCopy()
40 {
41   Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
42   Handle(HYDROData_PolylineXY) aPolyline1 = 
43     Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
44
45
46 //  aPolyline1->setPoints(aPoints);
47
48   Handle(HYDROData_PolylineXY) aPolyline2 = 
49     Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
50
51   aPolyline1->CopyTo(aPolyline2);
52
53
54   aDoc->Close();
55 }