1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include<test_HYDROData_Iterator.h>
25 #include <HYDROData_Document.h>
26 #include <HYDROData_Iterator.h>
30 void test_HYDROData_Iterator::testOneKind()
32 static const QString aName1("test_name1");
33 static const QString aName2("test_name2");
34 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
36 Handle(HYDROData_Entity) anObj = aDoc->CreateObject(KIND_IMAGE); // image object
37 anObj->SetName(aName1);
38 // first HYDROData_Entity must be destroyed because there is no hander pointer naymore
39 anObj = aDoc->CreateObject(KIND_IMAGE); // second image object
40 anObj->SetName(aName2);
42 HYDROData_Iterator anIter(aDoc, KIND_IMAGE);
43 CPPUNIT_ASSERT(anIter.More());
44 CPPUNIT_ASSERT(!anIter.Current().IsNull());
45 CPPUNIT_ASSERT_EQUAL(aName1.toStdString(), anIter.Current()->GetName().toStdString());
48 CPPUNIT_ASSERT(anIter.More());
49 CPPUNIT_ASSERT(!anIter.Current().IsNull());
50 CPPUNIT_ASSERT_EQUAL(aName2.toStdString(), anIter.Current()->GetName().toStdString());
53 CPPUNIT_ASSERT(!anIter.More());
58 void test_HYDROData_Iterator::testAllKinds()
60 static const QString aName1("test_name1");
61 static const QString aName2("test_name2");
62 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
64 Handle(HYDROData_Entity) anObj = aDoc->CreateObject(KIND_IMAGE); // image object
65 anObj->SetName(aName1);
66 // first HYDROData_Entity must be destroyed because there is no hander pointer naymore
67 anObj = aDoc->CreateObject(KIND_IMAGE); // second image object
68 anObj->SetName(aName2);
70 HYDROData_Iterator anIter(aDoc, KIND_UNKNOWN);
71 CPPUNIT_ASSERT(anIter.More());
72 CPPUNIT_ASSERT(!anIter.Current().IsNull());
73 CPPUNIT_ASSERT_EQUAL(aName1.toStdString(), anIter.Current()->GetName().toStdString());
76 CPPUNIT_ASSERT(anIter.More());
77 CPPUNIT_ASSERT(!anIter.Current().IsNull());
78 CPPUNIT_ASSERT_EQUAL(aName2.toStdString(), anIter.Current()->GetName().toStdString());
81 CPPUNIT_ASSERT(!anIter.More());