Salome HOME
Separate action "Find bottom" for context menu.
[modules/hydro.git] / src / HYDROData / test_HYDROData_PolylineXY.cxx
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #include<test_HYDROData_PolylineXY.h>
24
25 #include <HYDROData_Document.h>
26 #include <HYDROData_PolylineXY.h>
27
28 #include <QList>
29 #include <QPointF>
30
31 void test_HYDROData_PolylineXY::testPolyline()
32 {
33   Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
34
35   Handle(HYDROData_PolylineXY) aPolyline = 
36     Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
37
38   aPolyline->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, false );
39   aPolyline->AddSection( "Section_2", HYDROData_PolylineXY::SECTION_SPLINE, true );
40
41   int aNbSections = aPolyline->NbSections();
42   CPPUNIT_ASSERT( aNbSections == 2 );
43   
44   NCollection_Sequence<TCollection_AsciiString>           aSectNames;
45   NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
46   NCollection_Sequence<bool>                              aSectClosures;
47   aPolyline->GetSections( aSectNames, aSectTypes, aSectClosures );
48
49   CPPUNIT_ASSERT( aSectNames.Value( 0 ) == "Section_1" );
50   CPPUNIT_ASSERT( aSectTypes.Value( 0 ) == HYDROData_PolylineXY::SECTION_POLYLINE );
51   CPPUNIT_ASSERT( aSectClosures.Value( 0 ) == false );
52
53   CPPUNIT_ASSERT( aSectNames.Value( 1 ) == "Section_2" );
54   CPPUNIT_ASSERT( aSectTypes.Value( 1 ) == HYDROData_PolylineXY::SECTION_SPLINE );
55   CPPUNIT_ASSERT( aSectClosures.Value( 1 ) == true );
56
57   aDoc->Close();
58 }
59
60
61 void test_HYDROData_PolylineXY::testCopy()
62 {
63   Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
64   Handle(HYDROData_PolylineXY) aPolyline1 = 
65     Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
66
67
68 //  aPolyline1->setPoints(aPoints);
69
70   Handle(HYDROData_PolylineXY) aPolyline2 = 
71     Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
72
73   aPolyline1->CopyTo(aPolyline2);
74
75
76   aDoc->Close();
77 }