diff options
Diffstat (limited to 'qt4/tests/check_optcontent.cpp')
-rw-r--r-- | qt4/tests/check_optcontent.cpp | 114 |
1 files changed, 38 insertions, 76 deletions
diff --git a/qt4/tests/check_optcontent.cpp b/qt4/tests/check_optcontent.cpp index 22b14a45..2de29952 100644 --- a/qt4/tests/check_optcontent.cpp +++ b/qt4/tests/check_optcontent.cpp @@ -101,66 +101,57 @@ void TestOptionalContent::checkIsVisible() // AnyOn, one element array: // 22 0 obj<</Type/OCMD/OCGs[21 0 R]/P/AnyOn>>endobj - xref->fetch( 22, 0, &obj ); + obj = xref->fetch( 22, 0 ); QVERIFY( obj.isDict() ); QVERIFY( ocgs->optContentIsVisible( &obj ) ); - obj.free(); // Same again, looking for any leaks or dubious free()'s - xref->fetch( 22, 0, &obj ); + obj = xref->fetch( 22, 0 ); QVERIFY( obj.isDict() ); QVERIFY( ocgs->optContentIsVisible( &obj ) ); - obj.free(); // AnyOff, one element array: // 29 0 obj<</Type/OCMD/OCGs[21 0 R]/P/AnyOff>>endobj - xref->fetch( 29, 0, &obj ); + obj = xref->fetch( 29, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), false ); - obj.free(); // AllOn, one element array: // 36 0 obj<</Type/OCMD/OCGs[28 0 R]/P/AllOn>>endobj - xref->fetch( 36, 0, &obj ); + obj = xref->fetch( 36, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), true ); - obj.free(); // AllOff, one element array: // 43 0 obj<</Type/OCMD/OCGs[28 0 R]/P/AllOff>>endobj - xref->fetch( 43, 0, &obj ); + obj = xref->fetch( 43, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), false ); - obj.free(); // AnyOn, multi-element array: // 50 0 obj<</Type/OCMD/OCGs[21 0 R 28 0 R]/P/AnyOn>>endobj - xref->fetch( 50, 0, &obj ); + obj = xref->fetch( 50, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), true ); - obj.free(); // AnyOff, multi-element array: // 57 0 obj<</Type/OCMD/P/AnyOff/OCGs[21 0 R 28 0 R]>>endobj - xref->fetch( 57, 0, &obj ); + obj = xref->fetch( 57, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), false ); - obj.free(); // AllOn, multi-element array: // 64 0 obj<</Type/OCMD/P/AllOn/OCGs[21 0 R 28 0 R]>>endobj - xref->fetch( 64, 0, &obj ); + obj = xref->fetch( 64, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), true ); - obj.free(); // AllOff, multi-element array: // 71 0 obj<</Type/OCMD/P/AllOff/OCGs[21 0 R 28 0 R]>>endobj - xref->fetch( 71, 0, &obj ); + obj = xref->fetch( 71, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), false ); - obj.free(); delete doc; delete globalParams; @@ -182,8 +173,7 @@ void TestOptionalContent::checkVisibilitySetting() // In this test, both Ref(21,0) and Ref(28,0) start On, // based on the file settings - Object ref21obj; - ref21obj.initRef( 21, 0 ); + Object ref21obj( 21, 0 ); Ref ref21 = ref21obj.getRef(); OptionalContentGroup *ocgA = ocgs->findOcgByRef( ref21 ); QVERIFY( ocgA ); @@ -191,8 +181,7 @@ void TestOptionalContent::checkVisibilitySetting() QVERIFY( (ocgA->getName()->cmp("A")) == 0 ); QCOMPARE( ocgA->getState(), OptionalContentGroup::On ); - Object ref28obj; - ref28obj.initRef( 28, 0 ); + Object ref28obj( 28, 0 ); Ref ref28 = ref28obj.getRef(); OptionalContentGroup *ocgB = ocgs->findOcgByRef( ref28 ); QVERIFY( ocgB ); @@ -205,65 +194,56 @@ void TestOptionalContent::checkVisibilitySetting() // AnyOn, one element array: // 22 0 obj<</Type/OCMD/OCGs[21 0 R]/P/AnyOn>>endobj - xref->fetch( 22, 0, &obj ); + obj = xref->fetch( 22, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), false ); - obj.free(); // Same again, looking for any leaks or dubious free()'s - xref->fetch( 22, 0, &obj ); + obj = xref->fetch( 22, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), false ); - obj.free(); // AnyOff, one element array: // 29 0 obj<</Type/OCMD/OCGs[21 0 R]/P/AnyOff>>endobj - xref->fetch( 29, 0, &obj ); + obj = xref->fetch( 29, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), true ); - obj.free(); // AllOn, one element array: // 36 0 obj<</Type/OCMD/OCGs[28 0 R]/P/AllOn>>endobj - xref->fetch( 36, 0, &obj ); + obj = xref->fetch( 36, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), true ); - obj.free(); // AllOff, one element array: // 43 0 obj<</Type/OCMD/OCGs[28 0 R]/P/AllOff>>endobj - xref->fetch( 43, 0, &obj ); + obj = xref->fetch( 43, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), false ); - obj.free(); // AnyOn, multi-element array: // 50 0 obj<</Type/OCMD/OCGs[21 0 R 28 0 R]/P/AnyOn>>endobj - xref->fetch( 50, 0, &obj ); + obj = xref->fetch( 50, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), true ); - obj.free(); // AnyOff, multi-element array: // 57 0 obj<</Type/OCMD/P/AnyOff/OCGs[21 0 R 28 0 R]>>endobj - xref->fetch( 57, 0, &obj ); + obj = xref->fetch( 57, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), true ); - obj.free(); // AllOn, multi-element array: // 64 0 obj<</Type/OCMD/P/AllOn/OCGs[21 0 R 28 0 R]>>endobj - xref->fetch( 64, 0, &obj ); + obj = xref->fetch( 64, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), false ); - obj.free(); // AllOff, multi-element array: // 71 0 obj<</Type/OCMD/P/AllOff/OCGs[21 0 R 28 0 R]>>endobj - xref->fetch( 71, 0, &obj ); + obj = xref->fetch( 71, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), false ); - obj.free(); // Turn the other one off as well (i.e. both are Off) @@ -271,65 +251,56 @@ void TestOptionalContent::checkVisibilitySetting() // AnyOn, one element array: // 22 0 obj<</Type/OCMD/OCGs[21 0 R]/P/AnyOn>>endobj - xref->fetch( 22, 0, &obj ); + obj = xref->fetch( 22, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), false ); - obj.free(); // Same again, looking for any leaks or dubious free()'s - xref->fetch( 22, 0, &obj ); + obj = xref->fetch( 22, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), false ); - obj.free(); // AnyOff, one element array: // 29 0 obj<</Type/OCMD/OCGs[21 0 R]/P/AnyOff>>endobj - xref->fetch( 29, 0, &obj ); + obj = xref->fetch( 29, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), true ); - obj.free(); // AllOn, one element array: // 36 0 obj<</Type/OCMD/OCGs[28 0 R]/P/AllOn>>endobj - xref->fetch( 36, 0, &obj ); + obj = xref->fetch( 36, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), false ); - obj.free(); // AllOff, one element array: // 43 0 obj<</Type/OCMD/OCGs[28 0 R]/P/AllOff>>endobj - xref->fetch( 43, 0, &obj ); + obj = xref->fetch( 43, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), true ); - obj.free(); // AnyOn, multi-element array: // 50 0 obj<</Type/OCMD/OCGs[21 0 R 28 0 R]/P/AnyOn>>endobj - xref->fetch( 50, 0, &obj ); + obj = xref->fetch( 50, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), false ); - obj.free(); // AnyOff, multi-element array: // 57 0 obj<</Type/OCMD/P/AnyOff/OCGs[21 0 R 28 0 R]>>endobj - xref->fetch( 57, 0, &obj ); + obj = xref->fetch( 57, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), true ); - obj.free(); // AllOn, multi-element array: // 64 0 obj<</Type/OCMD/P/AllOn/OCGs[21 0 R 28 0 R]>>endobj - xref->fetch( 64, 0, &obj ); + obj = xref->fetch( 64, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), false ); - obj.free(); // AllOff, multi-element array: // 71 0 obj<</Type/OCMD/P/AllOff/OCGs[21 0 R 28 0 R]>>endobj - xref->fetch( 71, 0, &obj ); + obj = xref->fetch( 71, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), true ); - obj.free(); // Turn the first one on again (21 is On, 28 is Off) @@ -337,65 +308,56 @@ void TestOptionalContent::checkVisibilitySetting() // AnyOn, one element array: // 22 0 obj<</Type/OCMD/OCGs[21 0 R]/P/AnyOn>>endobj - xref->fetch( 22, 0, &obj ); + obj = xref->fetch( 22, 0); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), true ); - obj.free(); // Same again, looking for any leaks or dubious free()'s - xref->fetch( 22, 0, &obj ); + obj = xref->fetch( 22, 0); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), true ); - obj.free(); // AnyOff, one element array: // 29 0 obj<</Type/OCMD/OCGs[21 0 R]/P/AnyOff>>endobj - xref->fetch( 29, 0, &obj ); + obj = xref->fetch( 29, 0); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), false ); - obj.free(); // AllOn, one element array: // 36 0 obj<</Type/OCMD/OCGs[28 0 R]/P/AllOn>>endobj - xref->fetch( 36, 0, &obj ); + obj = xref->fetch( 36, 0); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), false ); - obj.free(); // AllOff, one element array: // 43 0 obj<</Type/OCMD/OCGs[28 0 R]/P/AllOff>>endobj - xref->fetch( 43, 0, &obj ); + obj = xref->fetch( 43, 0); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), true ); - obj.free(); // AnyOn, multi-element array: // 50 0 obj<</Type/OCMD/OCGs[21 0 R 28 0 R]/P/AnyOn>>endobj - xref->fetch( 50, 0, &obj ); + obj = xref->fetch( 50, 0); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), true ); - obj.free(); // AnyOff, multi-element array: // 57 0 obj<</Type/OCMD/P/AnyOff/OCGs[21 0 R 28 0 R]>>endobj - xref->fetch( 57, 0, &obj ); + obj = xref->fetch( 57, 0); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), true ); - obj.free(); // AllOn, multi-element array: // 64 0 obj<</Type/OCMD/P/AllOn/OCGs[21 0 R 28 0 R]>>endobj - xref->fetch( 64, 0, &obj ); + obj = xref->fetch( 64, 0); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), false ); - obj.free(); // AllOff, multi-element array: // 71 0 obj<</Type/OCMD/P/AllOff/OCGs[21 0 R 28 0 R]>>endobj - xref->fetch( 71, 0, &obj ); + obj = xref->fetch( 71, 0 ); QVERIFY( obj.isDict() ); QCOMPARE( ocgs->optContentIsVisible( &obj ), false ); - obj.free(); delete doc; delete globalParams; |