[poppler] poppler/qt4/tests: .cvsignore, 1.6, 1.7 Makefile.am, 1.8,
1.9 README.unittest, NONE, 1.1 check_author.cpp, 1.1,
NONE check_linearised.cpp, 1.1, NONE check_metadata.cpp, NONE,
1.1 check_orientation.cpp, 1.3, NONE check_pagelayout.cpp,
NONE, 1.1 check_pagelayout_facing.cpp, 1.1,
NONE check_pagelayout_none.cpp, 1.1,
NONE check_pagelayout_single.cpp, 1.1, NONE check_pagemode.cpp,
NONE, 1.1 check_pagemode_attach.cpp, 1.1,
NONE check_pagemode_fullscreen.cpp, 1.1,
NONE check_pagemode_none.cpp, 1.1, NONE check_pagemode_oc.cpp,
1.1, NONE check_pagemode_thumbs.cpp, 1.1,
NONE check_permissions.cpp, 1.1, 1.2
Brad Hards
bradh at freedesktop.org
Sat Sep 3 04:53:46 PDT 2005
Update of /cvs/poppler/poppler/qt4/tests
In directory gabe:/tmp/cvs-serv1131/qt4/tests
Modified Files:
.cvsignore Makefile.am check_permissions.cpp
Added Files:
README.unittest check_metadata.cpp check_pagelayout.cpp
check_pagemode.cpp
Removed Files:
check_author.cpp check_linearised.cpp check_orientation.cpp
check_pagelayout_facing.cpp check_pagelayout_none.cpp
check_pagelayout_single.cpp check_pagemode_attach.cpp
check_pagemode_fullscreen.cpp check_pagemode_none.cpp
check_pagemode_oc.cpp check_pagemode_thumbs.cpp
Log Message:
Switch the qt4/tests unittests to use QtTestLib.
Index: .cvsignore
===================================================================
RCS file: /cvs/poppler/poppler/qt4/tests/.cvsignore,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- .cvsignore 6 Aug 2005 01:53:06 -0000 1.6
+++ .cvsignore 3 Sep 2005 11:53:44 -0000 1.7
@@ -2,22 +2,15 @@
.libs
*.la
*.lo
+*.moc
Makefile
Makefile.in
stress-poppler-qt4
test-poppler-qt4
test-password-qt4
poppler-fonts
-check_orientation
-check_author
+check_metadata
check_permissions
-check_linearised
-check_pagelayout_facing
-check_pagelayout_none
-check_pagelayout_single
-check_pagemode_attach
-check_pagemode_fullscreen
-check_pagemode_none
-check_pagemode_oc
-check_pagemode_thumbs
-check_version
+check_pagelayout
+check_pagemode
+
Index: Makefile.am
===================================================================
RCS file: /cvs/poppler/poppler/qt4/tests/Makefile.am,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- Makefile.am 6 Aug 2005 01:53:06 -0000 1.8
+++ Makefile.am 3 Sep 2005 11:53:44 -0000 1.9
@@ -2,13 +2,21 @@
-I$(top_srcdir) \
-I$(top_srcdir)/poppler \
-I$(top_srcdir)/qt4/src \
- $(POPPLER_QT4_CXXFLAGS)
+ $(POPPLER_QT4_CXXFLAGS) \
+ $(POPPLER_QTTEST_CXXFLAGS)
LDADDS = \
$(top_builddir)/poppler/libpoppler.la \
$(top_builddir)/qt4/src/libpoppler-qt4.la \
$(POPPLER_QT4_LIBS)
+UT_LDADDS = $(LDADDS) $(POPPLER_QTTEST_LIBS)
+
+SUFFIXES: .moc
+
+.cpp.moc:
+ moc -i $< -o $@
+
noinst_PROGRAMS = test-poppler-qt4 stress-poppler-qt4 \
poppler-fonts test-password-qt4
@@ -18,6 +26,7 @@
test_poppler_qt4_LDADD = $(LDADDS)
+
test_password_qt4_SOURCES = \
test-password-qt4.cpp
@@ -30,65 +39,31 @@
poppler_fonts_LDADD = $(LDADDS)
-
stress_poppler_qt4_SOURCES = \
stress-poppler-qt4.cpp
stress_poppler_qt4_LDADD = $(LDADDS)
+if BUILD_POPPLER_QT4TESTS
TESTS = \
- check_author \
- check_orientation \
+ check_metadata \
check_permissions \
- check_linearised \
- check_pagemode_fullscreen \
- check_pagemode_attach \
- check_pagemode_none \
- check_pagemode_thumbs \
- check_pagemode_oc \
- check_pagelayout_none \
- check_pagelayout_single \
- check_pagelayout_facing \
- check_version
-
+ check_pagemode \
+ check_pagelayout
check_PROGRAMS = $(TESTS)
-check_orientation_SOURCES = check_orientation.cpp
-check_orientation_LDADD = $(LDADDS)
-
-check_linearised_SOURCES = check_linearised.cpp
-check_linearised_LDADD = $(LDADDS)
-
-check_author_SOURCES = check_author.cpp
-check_author_LDADD = $(LDADDS)
-
-check_permissions_SOURCES = check_permissions.cpp
-check_permissions_LDADD = $(LDADDS)
-
-check_pagemode_fullscreen_SOURCES = check_pagemode_fullscreen.cpp
-check_pagemode_fullscreen_LDADD = $(LDADDS)
-
-check_pagemode_attach_SOURCES = check_pagemode_attach.cpp
-check_pagemode_attach_LDADD = $(LDADDS)
-
-check_pagemode_none_SOURCES = check_pagemode_none.cpp
-check_pagemode_none_LDADD = $(LDADDS)
-
-check_pagemode_thumbs_SOURCES = check_pagemode_thumbs.cpp
-check_pagemode_thumbs_LDADD = $(LDADDS)
+check_metadata_SOURCES = check_metadata.cpp check_metadata.moc
+check_metadata_LDADD = $(UT_LDADDS)
-check_pagemode_oc_SOURCES = check_pagemode_oc.cpp
-check_pagemode_oc_LDADD = $(LDADDS)
+check_pagemode_SOURCES = check_pagemode.cpp check_pagemode.moc
+check_pagemode_LDADD = $(UT_LDADDS)
-check_pagelayout_single_SOURCES = check_pagelayout_single.cpp
-check_pagelayout_single_LDADD = $(LDADDS)
+check_permissions_SOURCES = check_permissions.cpp check_permissions.moc
+check_permissions_LDADD = $(UT_LDADDS)
-check_pagelayout_none_SOURCES = check_pagelayout_none.cpp
-check_pagelayout_none_LDADD = $(LDADDS)
+check_pagelayout_SOURCES = check_pagelayout.cpp check_pagelayout.moc
+check_pagelayout_LDADD = $(UT_LDADDS)
-check_pagelayout_facing_SOURCES = check_pagelayout_facing.cpp
-check_pagelayout_facing_LDADD = $(LDADDS)
+endif
-check_version_SOURCES = check_version.cpp
-check_version_LDADD = $(LDADDS)
--- NEW FILE: README.unittest ---
The unittests for the Qt4 bindings rely on the QtTestLib package, and
will not be built until this is installed. If you do not have it, then
you can download it from the Trolltech website.
Note that there are a range of ways in which you can run the tests:
1. "make check" will run all the tests.
2. You can run a single test by executing the applicable
executable. For example, you can run the PageMode tests by
"./check_pagemode"
3. You can run a single function within a single test by appending the
name of the function to the executable. For example, if you just want
to run the FullScreen test within the PageMode tests, you can
"./check_pagemode checkFullScreen". Run the executable with -functions
to get a list of all the functions.
4. You can run a single function with specific data by appending the
name of the function, followed by a colon, then the data label to the
executable. For example, to just do the Author check within the
metadata checks, you can "./check_metadata checkStrings:Author".
For a full list of options, run a executable with "-help".
Brad Hards
bradh at frogmouth.net
--- check_author.cpp DELETED ---
--- check_linearised.cpp DELETED ---
--- NEW FILE: check_metadata.cpp ---
#include <QtTest/QtTest>
#define UNSTABLE_POPPLER_QT4
#include <poppler-qt4.h>
class TestMetaData: public QObject
{
Q_OBJECT
private slots:
void checkStrings_data(QtTestTable &t);
void checkStrings();
void checkLinearised();
void checkPortraitOrientation();
void checkLandscapeOrientation();
void checkUpsideDownOrientation();
void checkSeascapeOrientation();
void checkVersion();
};
void TestMetaData::checkStrings_data(QtTestTable &t)
{
t.defineElement( "QString", "key" );
t.defineElement( "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";
}
void TestMetaData::checkStrings()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/unittestcases/doublepage.pdf");
VERIFY( doc );
FETCH( QString, key );
FETCH( QString, value );
COMPARE( doc->info(key), value );
}
void TestMetaData::checkLinearised()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
VERIFY( doc );
VERIFY( doc->isLinearized() );
}
void TestMetaData::checkPortraitOrientation()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
VERIFY( doc );
COMPARE( doc->page(0)->orientation(), Poppler::Page::Portrait );
}
void TestMetaData::checkLandscapeOrientation()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
VERIFY( doc );
COMPARE( doc->page(1)->orientation(), Poppler::Page::Landscape );
}
void TestMetaData::checkUpsideDownOrientation()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
VERIFY( doc );
COMPARE( doc->page(2)->orientation(), Poppler::Page::UpsideDown );
}
void TestMetaData::checkSeascapeOrientation()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
VERIFY( doc );
COMPARE( doc->page(3)->orientation(), Poppler::Page::Seascape );
}
void TestMetaData::checkVersion()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/unittestcases/doublepage.pdf");
VERIFY( doc );
COMPARE( doc->pdfVersion(), 1.6 );
}
QTTEST_MAIN(TestMetaData)
#include "check_metadata.moc"
--- check_orientation.cpp DELETED ---
--- NEW FILE: check_pagelayout.cpp ---
#include <QtTest/QtTest>
#define UNSTABLE_POPPLER_QT4
#include <poppler-qt4.h>
class TestPageLayout: public QObject
{
Q_OBJECT
private slots:
void checkNone();
void checkSingle();
void checkFacing();
};
void TestPageLayout::checkNone()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/unittestcases/UseNone.pdf");
VERIFY( doc );
COMPARE( doc->pageLayout(), Poppler::Document::NoLayout );
}
void TestPageLayout::checkSingle()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/unittestcases/FullScreen.pdf");
VERIFY( doc );
COMPARE( doc->pageLayout(), Poppler::Document::SinglePage );
}
void TestPageLayout::checkFacing()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/unittestcases/doublepage.pdf");
VERIFY( doc );
COMPARE( doc->pageLayout(), Poppler::Document::TwoPageRight );
}
QTTEST_MAIN(TestPageLayout)
#include "check_pagelayout.moc"
--- check_pagelayout_facing.cpp DELETED ---
--- check_pagelayout_none.cpp DELETED ---
--- check_pagelayout_single.cpp DELETED ---
--- NEW FILE: check_pagemode.cpp ---
#include <QtTest/QtTest>
#define UNSTABLE_POPPLER_QT4
#include <poppler-qt4.h>
class TestPageMode: public QObject
{
Q_OBJECT
private slots:
void checkNone();
void checkFullScreen();
void checkAttachments();
void checkThumbs();
void checkOC();
};
void TestPageMode::checkNone()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/unittestcases/UseNone.pdf");
VERIFY( doc );
COMPARE( doc->pageMode(), Poppler::Document::UseNone );
}
void TestPageMode::checkFullScreen()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/unittestcases/FullScreen.pdf");
VERIFY( doc );
COMPARE( doc->pageMode(), Poppler::Document::FullScreen );
}
void TestPageMode::checkAttachments()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/unittestcases/UseAttachments.pdf");
VERIFY( doc );
COMPARE( doc->pageMode(), Poppler::Document::UseAttach );
}
void TestPageMode::checkThumbs()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/unittestcases/UseThumbs.pdf");
VERIFY( doc );
COMPARE( doc->pageMode(), Poppler::Document::UseThumbs );
}
void TestPageMode::checkOC()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/unittestcases/UseOC.pdf");
VERIFY( doc );
COMPARE( doc->pageMode(), Poppler::Document::UseOC );
}
QTTEST_MAIN(TestPageMode)
#include "check_pagemode.moc"
--- check_pagemode_attach.cpp DELETED ---
--- check_pagemode_fullscreen.cpp DELETED ---
--- check_pagemode_none.cpp DELETED ---
--- check_pagemode_oc.cpp DELETED ---
--- check_pagemode_thumbs.cpp DELETED ---
Index: check_permissions.cpp
===================================================================
RCS file: /cvs/poppler/poppler/qt4/tests/check_permissions.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- check_permissions.cpp 5 Jul 2005 12:31:59 -0000 1.1
+++ check_permissions.cpp 3 Sep 2005 11:53:44 -0000 1.2
@@ -1,59 +1,43 @@
-#include <QtCore/QtCore>
+#include <QtTest/QtTest>
#define UNSTABLE_POPPLER_QT4
#include <poppler-qt4.h>
-int main( int argc, char **argv )
+class TestPermissions: public QObject
{
- QCoreApplication a( argc, argv ); // QApplication required!
+ Q_OBJECT
+private slots:
+ void permissions1();
+};
- Poppler::Document *doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
- if (!doc)
- {
- exit(1);
- }
+void TestPermissions::permissions1()
+{
+ Poppler::Document *doc;
+ doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
+ VERIFY( doc );
// we are allowed to print
- if ( !(doc->okToPrint() ) )
- {
- exit(2);
- }
+ VERIFY( doc->okToPrint() );
// we are not allowed to change
- if ( (doc->okToChange()) )
- {
- exit(3);
- }
+ VERIFY( !(doc->okToChange()) );
// we are not allowed to copy or extract content
- if ( (doc->okToCopy() ) )
- {
- exit(4);
- }
+ VERIFY( !(doc->okToCopy()) );
// we are not allowed to print at high resolution
- if ( (doc->okToPrintHighRes() ) )
- {
- exit(5);
- }
+ VERIFY( !(doc->okToPrintHighRes()) );
// we are not allowed to fill forms
- if ( (doc->okToFillForm() ) )
- {
- exit(6);
- }
+ VERIFY( !(doc->okToFillForm()) );
// we are allowed to extract content for accessibility
- if ( (!doc->okToExtractForAccessibility() ) )
- {
- exit(7);
- }
+ VERIFY( doc->okToExtractForAccessibility() );
// we are allowed to assemble this document
- if ( (!doc->okToAssemble() ) )
- {
- exit(8);
- }
-
- exit(0);
+ VERIFY( doc->okToAssemble() );
}
+
+QTTEST_MAIN(TestPermissions)
+#include "check_permissions.moc"
+
More information about the poppler
mailing list