Show
Ignore:
Timestamp:
04/17/06 07:28:50 (3 years ago)
Author:
jordi
Message:

Since version 0.5.0 and up doesn't support the old Xpdf header files and because the CairoOutputDev?.h file is not installed on version 0.5.1, I now use Poppler's glib wrapper for PDF loading.

The glib wrapper needs an URI instead of a filename (why?), so the path to the file must be specified as an absolute path to be able to convert it to an URI (file:///dir1/dir2/file.pdf). This also means that the tests files had to be changed to use absolute paths. I added a function (that I'll change to a common utils source) that transform the filename to an absolute path.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/tests/DocumentOutlineTest.cxx

    r73 r78  
    2323// Register the test suite into the `registry'. 
    2424CPPUNIT_TEST_SUITE_REGISTRATION (DocumentOutlineTest); 
     25 
     26/// 
     27/// @brief Returns the path to the test data file. 
     28/// 
     29/// It assumes that TEST_DIR is defined to the relative 
     30/// tests directory and that the checks are executed from the 
     31/// test build dir. 
     32/// 
     33static gchar * 
     34getTestFile (const gchar *fileName) 
     35{ 
     36    gchar *currentDir = g_get_current_dir (); 
     37    gchar *filePath = g_build_filename (currentDir, TEST_DIR, fileName, NULL); 
     38 
     39    return filePath; 
     40} 
    2541 
    2642/// 
     
    6379DocumentOutlineTest::noOutline () 
    6480{ 
    65     CPPUNIT_ASSERT (m_Document->loadFile (TEST_DATA_DIR "test2.pdf", 
    66                                           NULL, NULL)); 
     81    gchar *testFile = getTestFile ("test2.pdf"); 
     82    CPPUNIT_ASSERT (m_Document->loadFile (testFile, NULL, NULL)); 
    6783    CPPUNIT_ASSERT (m_Document->isLoaded ()); 
    6884    DocumentOutline *outline = m_Document->getOutline (); 
     
    7389    CPPUNIT_ASSERT (NULL == outline->getFirstChild ()); 
    7490    CPPUNIT_ASSERT (NULL == outline->getNextChild ()); 
     91 
     92    g_free (testFile); 
    7593} 
    7694 
     
    93111DocumentOutlineTest::hasOutline () 
    94112{ 
    95     CPPUNIT_ASSERT (m_Document->loadFile (TEST_DATA_DIR "test1.pdf", 
    96                                           NULL, NULL)); 
     113    gchar *testFile = getTestFile ("test1.pdf"); 
     114    CPPUNIT_ASSERT (m_Document->loadFile (testFile, NULL, NULL)); 
    97115    CPPUNIT_ASSERT (m_Document->isLoaded ()); 
    98116    DocumentOutline *outline = m_Document->getOutline (); 
     
    143161    // Try again the "no outlined" file. 
    144162    noOutline (); 
     163 
     164    g_free (testFile); 
    145165}