[poppler] poppler/qt4/tests: Makefile.am, 1.9, 1.10 check_metadata.cpp, 1.1, 1.2 check_pagelayout.cpp, 1.1, 1.2 check_pagemode.cpp, 1.1, 1.2 check_permissions.cpp, 1.2, 1.3

Brad Hards bradh at freedesktop.org
Sat Nov 26 17:33:54 PST 2005


Update of /cvs/poppler/poppler/qt4/tests
In directory gabe:/tmp/cvs-serv29177/qt4/tests

Modified Files:
	Makefile.am check_metadata.cpp check_pagelayout.cpp 
	check_pagemode.cpp check_permissions.cpp 
Log Message:
Convert Qt4 unit tests to use the new Qt4.1 QTestlib framework.
Add a little more API documentation


Index: Makefile.am
===================================================================
RCS file: /cvs/poppler/poppler/qt4/tests/Makefile.am,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Makefile.am	3 Sep 2005 11:53:44 -0000	1.9
+++ Makefile.am	27 Nov 2005 01:33:51 -0000	1.10
@@ -53,16 +53,20 @@
 
 check_PROGRAMS = $(TESTS)
 
-check_metadata_SOURCES = check_metadata.cpp check_metadata.moc
+check_metadata_SOURCES = check_metadata.cpp
+check_metadata.$(OBJEXT): check_metadata.moc
 check_metadata_LDADD = $(UT_LDADDS)
 
-check_pagemode_SOURCES = check_pagemode.cpp check_pagemode.moc
+check_pagemode_SOURCES = check_pagemode.cpp
+check_pagemode.$(OBJEXT): check_pagemode.moc
 check_pagemode_LDADD = $(UT_LDADDS)
 
-check_permissions_SOURCES = check_permissions.cpp check_permissions.moc
+check_permissions_SOURCES = check_permissions.cpp
+check_metadata.$(OBJEXT): check_permissions.moc
 check_permissions_LDADD = $(UT_LDADDS)
 
-check_pagelayout_SOURCES = check_pagelayout.cpp check_pagelayout.moc
+check_pagelayout_SOURCES = check_pagelayout.cpp
+check_pagelayout.$(OBJEXT): check_pagelayout.moc
 check_pagelayout_LDADD = $(UT_LDADDS)
 
 endif

Index: check_metadata.cpp
===================================================================
RCS file: /cvs/poppler/poppler/qt4/tests/check_metadata.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- check_metadata.cpp	3 Sep 2005 11:53:44 -0000	1.1
+++ check_metadata.cpp	27 Nov 2005 01:33:51 -0000	1.2
@@ -7,7 +7,7 @@
 {
     Q_OBJECT
 private slots:
-    void checkStrings_data(QtTestTable &t);
+    void checkStrings_data();
     void checkStrings();
     void checkLinearised();
     void checkPortraitOrientation();
@@ -17,85 +17,85 @@
     void checkVersion();
 };
 
-void TestMetaData::checkStrings_data(QtTestTable &t)
+void TestMetaData::checkStrings_data()
 {
-    t.defineElement( "QString", "key" );
-    t.defineElement( "QString", "value" );
+    QTest::addColumn<QString>("key");
+    QTest::addColumn<QString>("value");
 
-    *t.newData( "Author" ) << "Author" << "Brad Hards";
-    *t.newData( "Title" ) << "Title" << "Two pages";
-    *t.newData( "Subject" ) << "Subject"
-			    << "A two page layout for poppler testing";
-    *t.newData( "Keywords" ) << "Keywords" << "Qt4 bindings";
-    *t.newData( "Creator" ) << "Creator" << "iText: cgpdftops CUPS filter";
-    *t.newData( "Producer" ) << "Producer" << "Acrobat Distiller 7.0 for Macintosh";
+    QTest::newRow( "Author" ) << "Author" << "Brad Hards";
+    QTest::newRow( "Title" ) << "Title" << "Two pages";
+    QTest::newRow( "Subject" ) << "Subject"
+			       << "A two page layout for poppler testing";
+    QTest::newRow( "Keywords" ) << "Keywords" << "Qt4 bindings";
+    QTest::newRow( "Creator" ) << "Creator" << "iText: cgpdftops CUPS filter";
+    QTest::newRow( "Producer" ) << "Producer" << "Acrobat Distiller 7.0 for Macintosh";
 }
 
 void TestMetaData::checkStrings()
 {
     Poppler::Document *doc;
     doc = Poppler::Document::load("../../../test/unittestcases/doublepage.pdf");
-    VERIFY( doc );
+    QVERIFY( doc );
 
-    FETCH( QString, key );
-    FETCH( QString, value );
-    COMPARE( doc->info(key), value );
+    QFETCH( QString, key );
+    QFETCH( QString, value );
+    QCOMPARE( doc->info(key), value );
 }
 
 void TestMetaData::checkLinearised()
 {
     Poppler::Document *doc;
     doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
-    VERIFY( doc );
+    QVERIFY( doc );
 
-    VERIFY( doc->isLinearized() );
+    QVERIFY( doc->isLinearized() );
 }
 
 void TestMetaData::checkPortraitOrientation()
 {
     Poppler::Document *doc;
     doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
-    VERIFY( doc );
+    QVERIFY( doc );
   
-    COMPARE( doc->page(0)->orientation(), Poppler::Page::Portrait );
+    QCOMPARE( doc->page(0)->orientation(), Poppler::Page::Portrait );
 }
 
 void TestMetaData::checkLandscapeOrientation()
 {
     Poppler::Document *doc;
     doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
-    VERIFY( doc );
+    QVERIFY( doc );
   
-    COMPARE( doc->page(1)->orientation(), Poppler::Page::Landscape );
+    QCOMPARE( doc->page(1)->orientation(), Poppler::Page::Landscape );
 }
 
 void TestMetaData::checkUpsideDownOrientation()
 {
     Poppler::Document *doc;
     doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
-    VERIFY( doc );
+    QVERIFY( doc );
 
-    COMPARE( doc->page(2)->orientation(), Poppler::Page::UpsideDown );
+    QCOMPARE( doc->page(2)->orientation(), Poppler::Page::UpsideDown );
 }
 
 void TestMetaData::checkSeascapeOrientation()
 {
     Poppler::Document *doc;
     doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
-    VERIFY( doc );
+    QVERIFY( doc );
 
-    COMPARE( doc->page(3)->orientation(), Poppler::Page::Seascape );
+    QCOMPARE( doc->page(3)->orientation(), Poppler::Page::Seascape );
 }
 
 void TestMetaData::checkVersion()
 {
     Poppler::Document *doc;
     doc = Poppler::Document::load("../../../test/unittestcases/doublepage.pdf");
-    VERIFY( doc );
+    QVERIFY( doc );
 
-    COMPARE( doc->pdfVersion(), 1.6 );
+    QCOMPARE( doc->pdfVersion(), 1.6 );
 }
 
-QTTEST_MAIN(TestMetaData)
+QTEST_MAIN(TestMetaData)
 #include "check_metadata.moc"
 

Index: check_pagelayout.cpp
===================================================================
RCS file: /cvs/poppler/poppler/qt4/tests/check_pagelayout.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- check_pagelayout.cpp	3 Sep 2005 11:53:44 -0000	1.1
+++ check_pagelayout.cpp	27 Nov 2005 01:33:51 -0000	1.2
@@ -16,29 +16,29 @@
 {
     Poppler::Document *doc;
     doc = Poppler::Document::load("../../../test/unittestcases/UseNone.pdf");
-    VERIFY( doc );
+    QVERIFY( doc );
   
-    COMPARE( doc->pageLayout(), Poppler::Document::NoLayout );
+    QCOMPARE( doc->pageLayout(), Poppler::Document::NoLayout );
 }
 
 void TestPageLayout::checkSingle()
 {
     Poppler::Document *doc;
     doc = Poppler::Document::load("../../../test/unittestcases/FullScreen.pdf");
-    VERIFY( doc );
+    QVERIFY( doc );
   
-    COMPARE( doc->pageLayout(), Poppler::Document::SinglePage );
+    QCOMPARE( doc->pageLayout(), Poppler::Document::SinglePage );
 }
 
 void TestPageLayout::checkFacing()
 {
     Poppler::Document *doc;
     doc = Poppler::Document::load("../../../test/unittestcases/doublepage.pdf");
-    VERIFY( doc );
+    QVERIFY( doc );
 
-    COMPARE( doc->pageLayout(), Poppler::Document::TwoPageRight );
+    QCOMPARE( doc->pageLayout(), Poppler::Document::TwoPageRight );
 }
 
-QTTEST_MAIN(TestPageLayout)
+QTEST_MAIN(TestPageLayout)
 #include "check_pagelayout.moc"
 

Index: check_pagemode.cpp
===================================================================
RCS file: /cvs/poppler/poppler/qt4/tests/check_pagemode.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- check_pagemode.cpp	3 Sep 2005 11:53:44 -0000	1.1
+++ check_pagemode.cpp	27 Nov 2005 01:33:51 -0000	1.2
@@ -18,47 +18,47 @@
 {
     Poppler::Document *doc;
     doc = Poppler::Document::load("../../../test/unittestcases/UseNone.pdf");
-    VERIFY( doc );
+    QVERIFY( doc );
   
-    COMPARE( doc->pageMode(), Poppler::Document::UseNone );
+    QCOMPARE( doc->pageMode(), Poppler::Document::UseNone );
 }
 
 void TestPageMode::checkFullScreen()
 {
     Poppler::Document *doc;
     doc = Poppler::Document::load("../../../test/unittestcases/FullScreen.pdf");
-    VERIFY( doc );
+    QVERIFY( doc );
 
-    COMPARE( doc->pageMode(), Poppler::Document::FullScreen );
+    QCOMPARE( doc->pageMode(), Poppler::Document::FullScreen );
 }
 
 void TestPageMode::checkAttachments()
 {
     Poppler::Document *doc;
     doc = Poppler::Document::load("../../../test/unittestcases/UseAttachments.pdf");
-    VERIFY( doc );
+    QVERIFY( doc );
   
-    COMPARE( doc->pageMode(), Poppler::Document::UseAttach );
+    QCOMPARE( doc->pageMode(), Poppler::Document::UseAttach );
 }
 
 void TestPageMode::checkThumbs()
 {
     Poppler::Document *doc;
     doc = Poppler::Document::load("../../../test/unittestcases/UseThumbs.pdf");
-    VERIFY( doc );
+    QVERIFY( doc );
 
-    COMPARE( doc->pageMode(), Poppler::Document::UseThumbs );
+    QCOMPARE( doc->pageMode(), Poppler::Document::UseThumbs );
 }
 
 void TestPageMode::checkOC()
 {
     Poppler::Document *doc;
     doc = Poppler::Document::load("../../../test/unittestcases/UseOC.pdf");
-    VERIFY( doc );
+    QVERIFY( doc );
 
-    COMPARE( doc->pageMode(), Poppler::Document::UseOC );
+    QCOMPARE( doc->pageMode(), Poppler::Document::UseOC );
 }
 
-QTTEST_MAIN(TestPageMode)
+QTEST_MAIN(TestPageMode)
 #include "check_pagemode.moc"
 

Index: check_permissions.cpp
===================================================================
RCS file: /cvs/poppler/poppler/qt4/tests/check_permissions.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- check_permissions.cpp	3 Sep 2005 11:53:44 -0000	1.2
+++ check_permissions.cpp	27 Nov 2005 01:33:51 -0000	1.3
@@ -14,30 +14,30 @@
 {
     Poppler::Document *doc;
     doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
-    VERIFY( doc );
+    QVERIFY( doc );
   
     // we are allowed to print
-    VERIFY( doc->okToPrint() );
+    QVERIFY( doc->okToPrint() );
 
     // we are not allowed to change
-    VERIFY( !(doc->okToChange()) );
+    QVERIFY( !(doc->okToChange()) );
 
     // we are not allowed to copy or extract content
-    VERIFY( !(doc->okToCopy()) );
+    QVERIFY( !(doc->okToCopy()) );
 
     // we are not allowed to print at high resolution
-    VERIFY( !(doc->okToPrintHighRes()) );
+    QVERIFY( !(doc->okToPrintHighRes()) );
 
     // we are not allowed to fill forms
-    VERIFY( !(doc->okToFillForm()) );
+    QVERIFY( !(doc->okToFillForm()) );
 
     // we are allowed to extract content for accessibility
-    VERIFY( doc->okToExtractForAccessibility() );
+    QVERIFY( doc->okToExtractForAccessibility() );
 
     // we are allowed to assemble this document
-    VERIFY( doc->okToAssemble() );
+    QVERIFY( doc->okToAssemble() );
 }
 
-QTTEST_MAIN(TestPermissions)
+QTEST_MAIN(TestPermissions)
 #include "check_permissions.moc"
 



More information about the poppler mailing list