Show
Ignore:
Timestamp:
04/11/06 11:10:26 (3 years ago)
Author:
jordi
Message:

The main presenter now can open files and changes the window's title to show the file name or the document's title, if it has title. Also changes the the control's sensitiveness.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/tests/MainPterTest.cxx

    r23 r24  
    7474    CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
    7575} 
     76 
     77/// 
     78/// @brief Test loading a document. 
     79/// 
     80/// Loading a document will set the title to the document's title or the 
     81/// document's file name, if it has no title. Also will sensitive the 
     82/// go to next page, go to last page and all zoom actions. Also will 
     83/// show the document's first page. 
     84/// 
     85void 
     86MainPterTest::loadDocument () 
     87{ 
     88    m_View->setOpenFileName ("/tmp/test.pdf"); 
     89    m_MainPter->openFileActivated (); 
     90    CPPUNIT_ASSERT_EQUAL (0,  
     91            g_ascii_strcasecmp ("/tmp/test.pdf", m_View->getTitle ())); 
     92    CPPUNIT_ASSERT (!m_View->isSensitiveGoToFirstPage ()); 
     93    CPPUNIT_ASSERT (m_View->isSensitiveGoToLastPage ()); 
     94    CPPUNIT_ASSERT (m_View->isSensitiveGoToNextPage ()); 
     95    CPPUNIT_ASSERT (m_View->isSensitiveGoToPage ()); 
     96    CPPUNIT_ASSERT (!m_View->isSensitiveGoToPreviousPage ()); 
     97    CPPUNIT_ASSERT (m_View->isSensitiveZoomIn ()); 
     98    CPPUNIT_ASSERT (m_View->isSensitiveZoomOut ()); 
     99    CPPUNIT_ASSERT (m_View->isSensitiveZoomFit ()); 
     100    CPPUNIT_ASSERT (m_View->isSensitiveZoomWidth ()); 
     101    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     102 
     103    // Now try a document with a title. 
     104    m_Document->setTitle ("Test PDF"); 
     105    m_MainPter->openFileActivated (); 
     106    CPPUNIT_ASSERT_EQUAL (0,  
     107            g_ascii_strcasecmp ("Test PDF", m_View->getTitle ())); 
     108    CPPUNIT_ASSERT (!m_View->isSensitiveGoToFirstPage ()); 
     109    CPPUNIT_ASSERT (m_View->isSensitiveGoToLastPage ()); 
     110    CPPUNIT_ASSERT (m_View->isSensitiveGoToNextPage ()); 
     111    CPPUNIT_ASSERT (m_View->isSensitiveGoToPage ()); 
     112    CPPUNIT_ASSERT (!m_View->isSensitiveGoToPreviousPage ()); 
     113    CPPUNIT_ASSERT (m_View->isSensitiveZoomIn ()); 
     114    CPPUNIT_ASSERT (m_View->isSensitiveZoomOut ()); 
     115    CPPUNIT_ASSERT (m_View->isSensitiveZoomFit ()); 
     116    CPPUNIT_ASSERT (m_View->isSensitiveZoomWidth ()); 
     117    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     118}