1 #include<test_HYDROData_Iterator.h>
3 #include <HYDROData_Document.h>
4 #include <HYDROData_Iterator.h>
8 void test_HYDROData_Iterator::testOneKind()
10 static const QString aName1("test_name1");
11 static const QString aName2("test_name2");
12 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
14 Handle(HYDROData_Entity) anObj = aDoc->CreateObject(KIND_IMAGE); // image object
15 anObj->SetName(aName1);
16 // first HYDROData_Entity must be destroyed because there is no hander pointer naymore
17 anObj = aDoc->CreateObject(KIND_IMAGE); // second image object
18 anObj->SetName(aName2);
20 HYDROData_Iterator anIter(aDoc, KIND_IMAGE);
21 CPPUNIT_ASSERT(anIter.More());
22 CPPUNIT_ASSERT(!anIter.Current().IsNull());
23 CPPUNIT_ASSERT_EQUAL(aName1.toStdString(), anIter.Current()->GetName().toStdString());
26 CPPUNIT_ASSERT(anIter.More());
27 CPPUNIT_ASSERT(!anIter.Current().IsNull());
28 CPPUNIT_ASSERT_EQUAL(aName2.toStdString(), anIter.Current()->GetName().toStdString());
31 CPPUNIT_ASSERT(!anIter.More());
36 void test_HYDROData_Iterator::testAllKinds()
38 static const QString aName1("test_name1");
39 static const QString aName2("test_name2");
40 Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
42 Handle(HYDROData_Entity) anObj = aDoc->CreateObject(KIND_IMAGE); // image object
43 anObj->SetName(aName1);
44 // first HYDROData_Entity must be destroyed because there is no hander pointer naymore
45 anObj = aDoc->CreateObject(KIND_IMAGE); // second image object
46 anObj->SetName(aName2);
48 HYDROData_Iterator anIter(aDoc, KIND_UNKNOWN);
49 CPPUNIT_ASSERT(anIter.More());
50 CPPUNIT_ASSERT(!anIter.Current().IsNull());
51 CPPUNIT_ASSERT_EQUAL(aName1.toStdString(), anIter.Current()->GetName().toStdString());
54 CPPUNIT_ASSERT(anIter.More());
55 CPPUNIT_ASSERT(!anIter.Current().IsNull());
56 CPPUNIT_ASSERT_EQUAL(aName2.toStdString(), anIter.Current()->GetName().toStdString());
59 CPPUNIT_ASSERT(!anIter.More());