1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #include<test_HYDROData_Iterator.h>
21 #include <HYDROData_Document.h>
22 #include <HYDROData_Iterator.h>
26 void test_HYDROData_Iterator::testOneKind()
28 static const QString aName1("test_name1");
29 static const QString aName2("test_name2");
30 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
32 Handle(HYDROData_Entity) anObj = aDoc->CreateObject(KIND_IMAGE); // image object
33 anObj->SetName(aName1);
34 // first HYDROData_Entity must be destroyed because there is no hander pointer naymore
35 anObj = aDoc->CreateObject(KIND_IMAGE); // second image object
36 anObj->SetName(aName2);
38 HYDROData_Iterator anIter(aDoc, KIND_IMAGE);
39 CPPUNIT_ASSERT(anIter.More());
40 CPPUNIT_ASSERT(!anIter.Current().IsNull());
41 CPPUNIT_ASSERT_EQUAL(aName1.toStdString(), anIter.Current()->GetName().toStdString());
44 CPPUNIT_ASSERT(anIter.More());
45 CPPUNIT_ASSERT(!anIter.Current().IsNull());
46 CPPUNIT_ASSERT_EQUAL(aName2.toStdString(), anIter.Current()->GetName().toStdString());
49 CPPUNIT_ASSERT(!anIter.More());
54 void test_HYDROData_Iterator::testAllKinds()
56 static const QString aName1("test_name1");
57 static const QString aName2("test_name2");
58 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
60 Handle(HYDROData_Entity) anObj = aDoc->CreateObject(KIND_IMAGE); // image object
61 anObj->SetName(aName1);
62 // first HYDROData_Entity must be destroyed because there is no hander pointer naymore
63 anObj = aDoc->CreateObject(KIND_IMAGE); // second image object
64 anObj->SetName(aName2);
66 HYDROData_Iterator anIter(aDoc, KIND_UNKNOWN);
67 CPPUNIT_ASSERT(anIter.More());
68 CPPUNIT_ASSERT(!anIter.Current().IsNull());
69 CPPUNIT_ASSERT_EQUAL(aName1.toStdString(), anIter.Current()->GetName().toStdString());
72 CPPUNIT_ASSERT(anIter.More());
73 CPPUNIT_ASSERT(!anIter.Current().IsNull());
74 CPPUNIT_ASSERT_EQUAL(aName2.toStdString(), anIter.Current()->GetName().toStdString());
77 CPPUNIT_ASSERT(!anIter.More());