[poppler] CMakeLists.txt configure.ac Makefile.am qt4/tests

Albert Astals Cid aacid at kemper.freedesktop.org
Tue Feb 14 11:11:58 PST 2012


 CMakeLists.txt                  |   20 +++++++++++++++++++
 Makefile.am                     |    2 -
 configure.ac                    |   42 ++++++++++++++++++++++++++++++++++++++++
 qt4/tests/CMakeLists.txt        |    1 
 qt4/tests/Makefile.am           |    1 
 qt4/tests/check_actualtext.cpp  |    2 -
 qt4/tests/check_attachments.cpp |   14 ++++++-------
 qt4/tests/check_fonts.cpp       |   18 ++++++++---------
 qt4/tests/check_links.cpp       |    6 ++---
 qt4/tests/check_metadata.cpp    |   32 +++++++++++++++---------------
 qt4/tests/check_optcontent.cpp  |   12 +++++------
 qt4/tests/check_pagelayout.cpp  |    6 ++---
 qt4/tests/check_pagemode.cpp    |   10 ++++-----
 qt4/tests/check_password.cpp    |   12 +++++------
 qt4/tests/check_permissions.cpp |    2 -
 qt4/tests/check_search.cpp      |    4 +--
 16 files changed, 124 insertions(+), 60 deletions(-)

New commits:
commit a76135391555145ec740d49a7141e60da0ea5dee
Author: Hib Eris <hib at hiberis.nl>
Date:   Tue Feb 14 20:11:19 2012 +0100

    Add a configuration option for the test data dir
    
    This makes 'make distcheck' run succesfully.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bc7c0f1..9f438cc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,25 @@ endif(WIN32)
 
 set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)")
 
+set(TESTDATADIR "${CMAKE_SOURCE_DIR}/../test" CACHE STRING "Specify test data dir.")
+if(NOT (EXISTS ${TESTDATADIR} AND EXISTS ${TESTDATADIR}/test-poppler.c))
+  message(WARNING "
+ No test data found in $testdatadir.
+ You will not be able to run 'make test' successfully.
+
+ The test data is not included in the source packages
+ and is also not part of the main git repository. Instead,
+ you can checkout the test data from its own git
+ repository with:
+
+   git clone git://git.freedesktop.org/git/poppler/test
+
+ You should checkout the test data as a sibling of your
+ poppler source folder or specify the location of your
+ checkout with -DTESTDATADIR=/path/to/checkoutdir/test.
+  ")
+endif()
+
 if(WIN32)
   set(_default_fontconfiguration "win32")
 else(WIN32)
@@ -577,6 +596,7 @@ show_end_message_yesno("use curl" ENABLE_LIBCURL)
 show_end_message_yesno("use libopenjpeg" LIBOPENJPEG_FOUND)
 show_end_message_yesno("use cms" USE_CMS)
 show_end_message_yesno("command line utils" ENABLE_UTILS)
+show_end_message("test data dir" ${TESTDATADIR})
 
 if(USE_FIXEDPOINT AND USE_FLOAT)
   message("Warning: Single precision and fixed point options should not be enabled at the same time")
diff --git a/Makefile.am b/Makefile.am
index 60c82dc..5023be9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
 ACLOCAL_AMFLAGS = -I m4
-DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
+DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --with-testdatadir=$(TESTDATADIR)
 
 if BUILD_SPLASH_OUTPUT
 splash_subdir = splash
diff --git a/configure.ac b/configure.ac
index ab9e470..d839022 100644
--- a/configure.ac
+++ b/configure.ac
@@ -596,6 +596,47 @@ if test "x$enable_cms" = "xyes"; then
 fi
 AM_CONDITIONAL(USE_CMS, test x$enable_cms = xyes)
 
+AC_ARG_WITH([testdatadir],
+   [AS_HELP_STRING([--testdatadir=/path/to/testdatadir],
+                   [Specify test data dir])],
+   [case $withval in
+       [[\\/]]* | ?:[[\\/]]* )  # Absolute name.
+          TESTDATADIR=$withval ;;
+       *) # Relative name.
+          TESTDATADIR=$ac_pwd/$withval ;;
+    esac
+   ],
+   [case $srcdir in
+       [[\\/]]* | ?:[[\\/]]* )  # Absolute name.
+          TESTDATADIR=$srcdir/../test ;;
+       *) # Relative name.
+          TESTDATADIR=$ac_pwd/$srcdir/../test ;;
+    esac
+   ]
+)
+AC_MSG_CHECKING([for test data in $TESTDATADIR])
+if test -d $TESTDATADIR && test -f $TESTDATADIR/test-poppler.c; then
+  AC_MSG_RESULT([yes])
+else
+  AC_MSG_RESULT([no])
+  AC_MSG_WARN([
+ No test data found in $TESTDATADIR.
+ You will not be able to run 'make check' successfully.
+
+ The test data is not included in the source packages
+ and is also not part of the main git repository. Instead,
+ you can checkout the test data from its own git
+ repository with:
+
+   git clone git://git.freedesktop.org/git/poppler/test
+
+ You should checkout the test data as a sibling of your
+ poppler source folder or specify the location of your
+ checkout with --testdatadir=/path/to/checkoutdir/test.
+])
+fi
+AC_SUBST(TESTDATADIR)
+
 if test "x$GCC" != xyes; then
   enable_compile_warnings=no
 fi
@@ -679,6 +720,7 @@ echo "  use libcurl:        $enable_libcurl"
 echo "  use libopenjpeg:    $enable_libopenjpeg"
 echo "  use cms:            $enable_cms"
 echo "  command line utils: $enable_utils"
+echo "  test data dir:      $TESTDATADIR"
 echo ""
 
 if test x$enable_splash_output = xno -a x$enable_cairo_output = xno; then
diff --git a/qt4/tests/CMakeLists.txt b/qt4/tests/CMakeLists.txt
index d0ba762..028c1e1 100644
--- a/qt4/tests/CMakeLists.txt
+++ b/qt4/tests/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_definitions(${QT4_DEFINITIONS})
+add_definitions(-DTESTDATADIR=\"${TESTDATADIR}\")
 
 include_directories(
   ${CMAKE_CURRENT_SOURCE_DIR}
diff --git a/qt4/tests/Makefile.am b/qt4/tests/Makefile.am
index 319b7f4..be8ea35 100644
--- a/qt4/tests/Makefile.am
+++ b/qt4/tests/Makefile.am
@@ -4,6 +4,7 @@ INCLUDES =					\
 	-I$(top_srcdir)				\
 	-I$(top_srcdir)/poppler			\
 	-I$(top_srcdir)/qt4/src			\
+	-DTESTDATADIR=\"$(TESTDATADIR)\"        \
 	$(FONTCONFIG_CFLAGS)			\
 	$(POPPLER_QT4_CFLAGS)
 
diff --git a/qt4/tests/check_actualtext.cpp b/qt4/tests/check_actualtext.cpp
index 64fae8f..5c765c5 100644
--- a/qt4/tests/check_actualtext.cpp
+++ b/qt4/tests/check_actualtext.cpp
@@ -14,7 +14,7 @@ private slots:
 void TestActualText::checkActualText1()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/WithActualText.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/WithActualText.pdf");
     QVERIFY( doc );
 
     Poppler::Page *page = doc->page(0);
diff --git a/qt4/tests/check_attachments.cpp b/qt4/tests/check_attachments.cpp
index 6405351..73e3150 100644
--- a/qt4/tests/check_attachments.cpp
+++ b/qt4/tests/check_attachments.cpp
@@ -18,7 +18,7 @@ private slots:
 void TestAttachments::checkNoAttachments()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/truetype.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/truetype.pdf");
     QVERIFY( doc );
 
     QCOMPARE( doc->hasEmbeddedFiles(), false );
@@ -30,7 +30,7 @@ void TestAttachments::checkAttach1()
 {
 
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/WithAttachments.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/WithAttachments.pdf");
     QVERIFY( doc );
 
     QVERIFY( doc->hasEmbeddedFiles() );
@@ -45,7 +45,7 @@ void TestAttachments::checkAttach1()
     QCOMPARE( embfile->modDate(), QDateTime( QDate(), QTime() ) );
     QCOMPARE( embfile->mimeType(), QString() );
 
-    QFile file( "../../../test/unittestcases/kroller.png" );
+    QFile file(TESTDATADIR "/unittestcases/kroller.png" );
     QVERIFY(  file.open( QIODevice::ReadOnly ) );
     QByteArray krollerData = file.readAll();
     QByteArray embdata = embfile->data();
@@ -59,7 +59,7 @@ void TestAttachments::checkAttach1()
     QCOMPARE( embfile2->createDate(), QDateTime( QDate(), QTime() ) );
     QCOMPARE( embfile2->mimeType(), QString() );
 
-    QFile file2( "../../../test/unittestcases/gnome-64.gif" );
+    QFile file2(TESTDATADIR "/unittestcases/gnome-64.gif" );
     QVERIFY(  file2.open( QIODevice::ReadOnly ) );
     QByteArray g64Data = file2.readAll();
     QByteArray emb2data = embfile2->data();
@@ -73,7 +73,7 @@ void TestAttachments::checkAttach2()
 {
 
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/A6EmbeddedFiles.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/A6EmbeddedFiles.pdf");
     QVERIFY( doc );
 
     QVERIFY( doc->hasEmbeddedFiles() );
@@ -110,7 +110,7 @@ void TestAttachments::checkAttach3()
 {
 
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/shapes+attachments.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/shapes+attachments.pdf");
     QVERIFY( doc );
 
     QVERIFY( doc->hasEmbeddedFiles() );
@@ -133,7 +133,7 @@ void TestAttachments::checkAttach4()
 {
 
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/imageretrieve+attachment.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/imageretrieve+attachment.pdf");
     QVERIFY( doc );
 
     QVERIFY( doc->hasEmbeddedFiles() );
diff --git a/qt4/tests/check_fonts.cpp b/qt4/tests/check_fonts.cpp
index fdf4be7..c57b6da 100644
--- a/qt4/tests/check_fonts.cpp
+++ b/qt4/tests/check_fonts.cpp
@@ -53,7 +53,7 @@ bool operator==( const Poppler::FontInfo &f1, const Poppler::FontInfo &f2 )
 void TestFontsData::checkNoFonts()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/tests/image.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/tests/image.pdf");
     QVERIFY( doc );
 
     QList<Poppler::FontInfo> listOfFonts = doc->fonts();
@@ -65,7 +65,7 @@ void TestFontsData::checkNoFonts()
 void TestFontsData::checkType1()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/tests/text.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/tests/text.pdf");
     QVERIFY( doc );
 
     QList<Poppler::FontInfo> listOfFonts = doc->fonts();
@@ -83,7 +83,7 @@ void TestFontsData::checkType1()
 void TestFontsData::checkType3()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/tests/type3.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/tests/type3.pdf");
     QVERIFY( doc );
 
     QList<Poppler::FontInfo> listOfFonts = doc->fonts();
@@ -108,7 +108,7 @@ void TestFontsData::checkType3()
 void TestFontsData::checkTrueType()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/truetype.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/truetype.pdf");
     QVERIFY( doc );
 
     QList<Poppler::FontInfo> listOfFonts = doc->fonts();
@@ -134,10 +134,10 @@ void TestFontsData::checkFontIterator()
 {
     // loading a 1-page document
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/tests/type3.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/tests/type3.pdf");
     QVERIFY( doc );
     // loading a 6-pages document
-    Poppler::Document *doc6 = Poppler::Document::load("../../../test/tests/cropbox.pdf");
+    Poppler::Document *doc6 = Poppler::Document::load(TESTDATADIR "/tests/cropbox.pdf");
     QVERIFY( doc6 );
 
     std::auto_ptr< Poppler::FontIterator > it;
@@ -188,7 +188,7 @@ void TestFontsData::checkFontIterator()
 void TestFontsData::checkSecondDocumentQuery()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/tests/type3.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/tests/type3.pdf");
     QVERIFY( doc );
 
     QList<Poppler::FontInfo> listOfFonts = doc->fonts();
@@ -203,7 +203,7 @@ void TestFontsData::checkSecondDocumentQuery()
 void TestFontsData::checkMultipleIterations()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/tests/type3.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/tests/type3.pdf");
     QVERIFY( doc );
 
     QList<Poppler::FontInfo> listOfFonts = loadFontsViaIterator( doc );
@@ -217,7 +217,7 @@ void TestFontsData::checkMultipleIterations()
 void TestFontsData::checkScanForFonts()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/tests/fonts.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/tests/fonts.pdf");
     QVERIFY( doc );
 
     QList<Poppler::FontInfo> listOfFonts = doc->fonts();
diff --git a/qt4/tests/check_links.cpp b/qt4/tests/check_links.cpp
index 2f69a82..b5b2dee 100644
--- a/qt4/tests/check_links.cpp
+++ b/qt4/tests/check_links.cpp
@@ -27,7 +27,7 @@ bool isDestinationValid_name( const Poppler::LinkDestination *dest )
 void TestLinks::checkDocumentWithNoDests()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/WithAttachments.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/WithAttachments.pdf");
     QVERIFY( doc );
 
     std::auto_ptr< Poppler::LinkDestination > dest;
@@ -41,7 +41,7 @@ void TestLinks::checkDocumentWithNoDests()
 void TestLinks::checkDests_xr01()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/xr01.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/xr01.pdf");
     QVERIFY( doc );
 
     Poppler::Page *page = doc->page(0);
@@ -74,7 +74,7 @@ void TestLinks::checkDests_xr01()
 void TestLinks::checkDests_xr02()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/xr02.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/xr02.pdf");
     QVERIFY( doc );
 
     std::auto_ptr< Poppler::LinkDestination > dest;
diff --git a/qt4/tests/check_metadata.cpp b/qt4/tests/check_metadata.cpp
index 61575dd..fb4f716 100644
--- a/qt4/tests/check_metadata.cpp
+++ b/qt4/tests/check_metadata.cpp
@@ -41,7 +41,7 @@ void TestMetaData::checkStrings_data()
 void TestMetaData::checkStrings()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/doublepage.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/doublepage.pdf");
     QVERIFY( doc );
 
     QFETCH( QString, key );
@@ -68,7 +68,7 @@ void TestMetaData::checkStrings2_data()
 void TestMetaData::checkStrings2()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/truetype.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/truetype.pdf");
     QVERIFY( doc );
 
     QFETCH( QString, key );
@@ -81,7 +81,7 @@ void TestMetaData::checkStrings2()
 void TestMetaData::checkStringKeys()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/truetype.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/truetype.pdf");
     QVERIFY( doc );
 
     QStringList keyList;
@@ -98,14 +98,14 @@ void TestMetaData::checkStringKeys()
 void TestMetaData::checkLinearised()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/orientation.pdf");
     QVERIFY( doc );
 
     QVERIFY( doc->isLinearized() );
 
     delete doc;
 
-    doc = Poppler::Document::load("../../../test/unittestcases/truetype.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/truetype.pdf");
     QVERIFY( doc );
     QCOMPARE( doc->isLinearized(), false );
 
@@ -115,7 +115,7 @@ void TestMetaData::checkLinearised()
 void TestMetaData::checkPortraitOrientation()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/orientation.pdf");
     QVERIFY( doc );
   
     Poppler::Page *page = doc->page(0);
@@ -128,13 +128,13 @@ void TestMetaData::checkPortraitOrientation()
 void TestMetaData::checkNumPages()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/doublepage.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/doublepage.pdf");
     QVERIFY( doc );
     QCOMPARE( doc->numPages(), 2 );
 
     delete doc;
 
-    doc = Poppler::Document::load("../../../test/unittestcases/truetype.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/truetype.pdf");
     QVERIFY( doc );
     QCOMPARE( doc->numPages(), 1 );
 
@@ -145,7 +145,7 @@ void TestMetaData::checkDate()
 {
     Poppler::Document *doc;
 
-    doc = Poppler::Document::load("../../../test/unittestcases/truetype.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/truetype.pdf");
     QVERIFY( doc );
     QCOMPARE( doc->date("ModDate"), QDateTime(QDate(2005, 12, 5), QTime(9,44,46), Qt::UTC ) );
     QCOMPARE( doc->date("CreationDate"), QDateTime(QDate(2005, 8, 13), QTime(1,12,11), Qt::UTC ) );
@@ -157,7 +157,7 @@ void TestMetaData::checkPageSize()
 {
     Poppler::Document *doc;
 
-    doc = Poppler::Document::load("../../../test/unittestcases/truetype.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/truetype.pdf");
     QVERIFY( doc );
     Poppler::Page *page = doc->page(0);
     QCOMPARE( page->pageSize(), QSize(595, 842) );
@@ -171,7 +171,7 @@ void TestMetaData::checkPageSize()
 void TestMetaData::checkLandscapeOrientation()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/orientation.pdf");
     QVERIFY( doc );
   
     Poppler::Page *page = doc->page(1);
@@ -184,7 +184,7 @@ void TestMetaData::checkLandscapeOrientation()
 void TestMetaData::checkUpsideDownOrientation()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/orientation.pdf");
     QVERIFY( doc );
 
     Poppler::Page *page = doc->page(2);
@@ -197,7 +197,7 @@ void TestMetaData::checkUpsideDownOrientation()
 void TestMetaData::checkSeascapeOrientation()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/orientation.pdf");
     QVERIFY( doc );
 
     Poppler::Page *page = doc->page(3);
@@ -210,7 +210,7 @@ void TestMetaData::checkSeascapeOrientation()
 void TestMetaData::checkVersion()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/doublepage.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/doublepage.pdf");
     QVERIFY( doc );
 
     QCOMPARE( doc->pdfVersion(), 1.6 );
@@ -225,7 +225,7 @@ void TestMetaData::checkVersion()
 void TestMetaData::checkPdfId()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/A6EmbeddedFiles.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/A6EmbeddedFiles.pdf");
     QVERIFY( doc );
 
     const QByteArray referencePermanentId( "00C9D5B6D8FB11D7A902003065D630AA" );
@@ -262,7 +262,7 @@ void TestMetaData::checkPdfId()
 void TestMetaData::checkNoPdfId()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/WithActualText.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/WithActualText.pdf");
     QVERIFY( doc );
 
     QVERIFY( !doc->getPdfId( 0, 0 ) );
diff --git a/qt4/tests/check_optcontent.cpp b/qt4/tests/check_optcontent.cpp
index b59ec48..22b14a4 100644
--- a/qt4/tests/check_optcontent.cpp
+++ b/qt4/tests/check_optcontent.cpp
@@ -20,7 +20,7 @@ private slots:
 void TestOptionalContent::checkVisPolicy()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/vis_policy_test.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/vis_policy_test.pdf");
     QVERIFY( doc );
 
     QVERIFY( doc->hasOptionalContent() );
@@ -40,7 +40,7 @@ void TestOptionalContent::checkVisPolicy()
 void TestOptionalContent::checkNestedLayers()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/NestedLayers.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/NestedLayers.pdf");
     QVERIFY( doc );
 
     QVERIFY( doc->hasOptionalContent() );
@@ -75,7 +75,7 @@ void TestOptionalContent::checkNestedLayers()
 void TestOptionalContent::checkNoOptionalContent()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/orientation.pdf");
     QVERIFY( doc );
 
     QCOMPARE( doc->hasOptionalContent(), false );
@@ -85,7 +85,7 @@ void TestOptionalContent::checkNoOptionalContent()
 
 void TestOptionalContent::checkIsVisible()
 {
-    GooString *fileName = new GooString("../../../test/unittestcases/vis_policy_test.pdf"); 
+    GooString *fileName = new GooString(TESTDATADIR "/unittestcases/vis_policy_test.pdf");
     globalParams = new GlobalParams();
     PDFDoc *doc = new PDFDoc( fileName );
     QVERIFY( doc );
@@ -169,7 +169,7 @@ void TestOptionalContent::checkIsVisible()
 void TestOptionalContent::checkVisibilitySetting()
 {
     globalParams = new GlobalParams();
-    GooString *fileName = new GooString("../../../test/unittestcases/vis_policy_test.pdf"); 
+    GooString *fileName = new GooString(TESTDATADIR "/unittestcases/vis_policy_test.pdf");
     PDFDoc *doc = new PDFDoc( fileName );
     QVERIFY( doc );
 
@@ -404,7 +404,7 @@ void TestOptionalContent::checkVisibilitySetting()
 void TestOptionalContent::checkRadioButtons()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/ClarityOCGs.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/ClarityOCGs.pdf");
     QVERIFY( doc );
 
     QVERIFY( doc->hasOptionalContent() );
diff --git a/qt4/tests/check_pagelayout.cpp b/qt4/tests/check_pagelayout.cpp
index dbdb93e..6108f88 100644
--- a/qt4/tests/check_pagelayout.cpp
+++ b/qt4/tests/check_pagelayout.cpp
@@ -14,7 +14,7 @@ private slots:
 void TestPageLayout::checkNone()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/UseNone.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/UseNone.pdf");
     QVERIFY( doc );
   
     QCOMPARE( doc->pageLayout(), Poppler::Document::NoLayout );
@@ -25,7 +25,7 @@ void TestPageLayout::checkNone()
 void TestPageLayout::checkSingle()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/FullScreen.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/FullScreen.pdf");
     QVERIFY( doc );
   
     QCOMPARE( doc->pageLayout(), Poppler::Document::SinglePage );
@@ -36,7 +36,7 @@ void TestPageLayout::checkSingle()
 void TestPageLayout::checkFacing()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/doublepage.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/doublepage.pdf");
     QVERIFY( doc );
 
     QCOMPARE( doc->pageLayout(), Poppler::Document::TwoPageRight );
diff --git a/qt4/tests/check_pagemode.cpp b/qt4/tests/check_pagemode.cpp
index 9df07ff..0565fe2 100644
--- a/qt4/tests/check_pagemode.cpp
+++ b/qt4/tests/check_pagemode.cpp
@@ -16,7 +16,7 @@ private slots:
 void TestPageMode::checkNone()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/UseNone.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/UseNone.pdf");
     QVERIFY( doc );
   
     QCOMPARE( doc->pageMode(), Poppler::Document::UseNone );
@@ -27,7 +27,7 @@ void TestPageMode::checkNone()
 void TestPageMode::checkFullScreen()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/FullScreen.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/FullScreen.pdf");
     QVERIFY( doc );
 
     QCOMPARE( doc->pageMode(), Poppler::Document::FullScreen );
@@ -38,7 +38,7 @@ void TestPageMode::checkFullScreen()
 void TestPageMode::checkAttachments()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/UseAttachments.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/UseAttachments.pdf");
     QVERIFY( doc );
   
     QCOMPARE( doc->pageMode(), Poppler::Document::UseAttach );
@@ -49,7 +49,7 @@ void TestPageMode::checkAttachments()
 void TestPageMode::checkThumbs()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/UseThumbs.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/UseThumbs.pdf");
     QVERIFY( doc );
 
     QCOMPARE( doc->pageMode(), Poppler::Document::UseThumbs );
@@ -60,7 +60,7 @@ void TestPageMode::checkThumbs()
 void TestPageMode::checkOC()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/UseOC.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/UseOC.pdf");
     QVERIFY( doc );
 
     QCOMPARE( doc->pageMode(), Poppler::Document::UseOC );
diff --git a/qt4/tests/check_password.cpp b/qt4/tests/check_password.cpp
index 7bc81b2..4c7dcd1 100644
--- a/qt4/tests/check_password.cpp
+++ b/qt4/tests/check_password.cpp
@@ -19,7 +19,7 @@ private slots:
 void TestPassword::password1()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load(QString::fromUtf8("../../../test/unittestcases/Gday garçon - open.pdf"), "", QString::fromUtf8("garçon").toLatin1() );
+    doc = Poppler::Document::load(QString::fromUtf8(TESTDATADIR "/unittestcases/Gday garçon - open.pdf"), "", QString::fromUtf8("garçon").toLatin1() );
     QVERIFY( doc );
     QVERIFY( !doc->isLocked() );
 
@@ -30,7 +30,7 @@ void TestPassword::password1()
 void TestPassword::password1a()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load(QString::fromUtf8("../../../test/unittestcases/Gday garçon - open.pdf") );
+    doc = Poppler::Document::load(QString::fromUtf8(TESTDATADIR "/unittestcases/Gday garçon - open.pdf") );
     QVERIFY( doc );
     QVERIFY( doc->isLocked() );
     QVERIFY( !doc->unlock( "", QString::fromUtf8("garçon").toLatin1() ) );
@@ -42,7 +42,7 @@ void TestPassword::password1a()
 void TestPassword::password2()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load(QString::fromUtf8("../../../test/unittestcases/Gday garçon - owner.pdf"), QString::fromUtf8("garçon").toLatin1(), "" );
+    doc = Poppler::Document::load(QString::fromUtf8(TESTDATADIR "/unittestcases/Gday garçon - owner.pdf"), QString::fromUtf8("garçon").toLatin1(), "" );
     QVERIFY( doc );
     QVERIFY( !doc->isLocked() );
 
@@ -52,7 +52,7 @@ void TestPassword::password2()
 void TestPassword::password2a()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load(QString::fromUtf8("../../../test/unittestcases/Gday garçon - owner.pdf"), QString::fromUtf8("garçon").toLatin1() );
+    doc = Poppler::Document::load(QString::fromUtf8(TESTDATADIR "/unittestcases/Gday garçon - owner.pdf"), QString::fromUtf8("garçon").toLatin1() );
     QVERIFY( doc );
     QVERIFY( !doc->isLocked() );
 
@@ -62,7 +62,7 @@ void TestPassword::password2a()
 void TestPassword::password2b()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load(QString::fromUtf8("../../../test/unittestcases/Gday garçon - owner.pdf") );
+    doc = Poppler::Document::load(QString::fromUtf8(TESTDATADIR "/unittestcases/Gday garçon - owner.pdf") );
     QVERIFY( doc );
     QVERIFY( !doc->isLocked() );
     QVERIFY( !doc->unlock( QString::fromUtf8("garçon").toLatin1(), "" ) );
@@ -74,7 +74,7 @@ void TestPassword::password2b()
 void TestPassword::password3()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load( QString::fromUtf8("../../../test/unittestcases/PasswordEncrypted.pdf") );
+    doc = Poppler::Document::load( QString::fromUtf8(TESTDATADIR "/unittestcases/PasswordEncrypted.pdf") );
     QVERIFY( doc );
     QVERIFY( doc->isLocked() );
     QVERIFY( !doc->unlock( "", "password" ) );
diff --git a/qt4/tests/check_permissions.cpp b/qt4/tests/check_permissions.cpp
index eec78ed..a3f3bdc 100644
--- a/qt4/tests/check_permissions.cpp
+++ b/qt4/tests/check_permissions.cpp
@@ -12,7 +12,7 @@ private slots:
 void TestPermissions::permissions1()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/orientation.pdf");
     QVERIFY( doc );
   
     // we are allowed to print
diff --git a/qt4/tests/check_search.cpp b/qt4/tests/check_search.cpp
index c7e44bc..cabf82d 100644
--- a/qt4/tests/check_search.cpp
+++ b/qt4/tests/check_search.cpp
@@ -13,7 +13,7 @@ private slots:
 void TestSearch::bug7063()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/bug7063.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/bug7063.pdf");
     QVERIFY( doc );
    
     Poppler::Page *page = doc->page(0);
@@ -39,7 +39,7 @@ void TestSearch::bug7063()
 void TestSearch::testNextAndPrevious()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load("../../../test/unittestcases/xr01.pdf");
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/xr01.pdf");
     QVERIFY( doc );
   
     Poppler::Page *page = doc->page(0);


More information about the poppler mailing list