Show
Ignore:
Timestamp:
04/15/06 06:57:59 (3 years ago)
Author:
jordi
Message:

The main presenter shows the sidebar when the document has outlines. Also passes the outline to the view and accepts an activated outline to make change the page.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/tests/MainPterTest.cxx

    r65 r66  
    5656/// the main window's title is 'PDF Viewer', the page selection  
    5757/// and zoom actions are unsensitived and the documentView has 
    58 /// no image yet. 
     58/// no image yet. Also the side bar won't be displayed, yet. 
    5959/// 
    6060void 
     
    7676    CPPUNIT_ASSERT (!m_View->isSensitiveZoomFit ()); 
    7777    CPPUNIT_ASSERT (!m_View->isSensitiveZoomWidth ()); 
     78    CPPUNIT_ASSERT (!m_View->isShownSidebar ()); 
    7879    CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
    7980} 
     
    8586/// document's file name, if it has no title. Also will sensitive the 
    8687/// go to next page, go to last page and all zoom actions. Also will 
    87 /// show the document's first page. 
     88/// show the document's first page. Since this document don't have 
     89/// outline, the sidebar won't be displayed. 
    8890/// 
    8991void 
     
    106108    CPPUNIT_ASSERT (m_View->isSensitiveZoomFit ()); 
    107109    CPPUNIT_ASSERT (m_View->isSensitiveZoomWidth ()); 
     110    CPPUNIT_ASSERT (!m_View->isShownSidebar ()); 
    108111    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
    109112 
     
    125128    CPPUNIT_ASSERT (m_View->isSensitiveZoomFit ()); 
    126129    CPPUNIT_ASSERT (m_View->isSensitiveZoomWidth ()); 
     130    CPPUNIT_ASSERT (!m_View->isShownSidebar ()); 
    127131    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
    128132} 
     
    661665    CPPUNIT_ASSERT_EQUAL (1, m_View->countTimesShownPasswordPrompt ()); 
    662666} 
     667 
     668/// 
     669/// @brief Checks that the sidebar is shown when a document has outline. 
     670///  
     671/// From now, the sidebar is shown only for the outline (no thumbnails), 
     672/// so if a document has outline the sidebar should be shown with it. 
     673/// 
     674/// When the presenter needs to show the outline, it just passes the root 
     675/// outline item to the view, and the view must then render it whatever it 
     676/// can (a GtkTreeView in GTK, etc...) 
     677/// 
     678void 
     679MainPterTest::showSidebar () 
     680{ 
     681    DocumentOutline *outline = new DocumentOutline (); 
     682    DocumentOutline *child = new DocumentOutline (); 
     683    child->setParent (outline); 
     684    child->setTitle ("Outline 1"); 
     685    child->setDestination (2); 
     686    outline->addChild (child); 
     687    m_Document->setOutline (outline);     
     688    m_Document->setNumPages (4); 
     689     
     690    m_View->setOpenFileName ("/tmp/test.pdf"); 
     691    m_MainPter->openFileActivated (); 
     692    CPPUNIT_ASSERT (m_View->isShownSidebar ()); 
     693    CPPUNIT_ASSERT (outline == m_View->getOutline ()); 
     694    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     695 
     696    // When the user does click on a outline item, the view 
     697    // sends to the presenter the outline that has been activated. 
     698    // Then the presenter goes to that page. 
     699    m_MainPter->outlineActivated (child); 
     700    CPPUNIT_ASSERT_EQUAL (2, m_View->getCurrentPage ()); 
     701    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     702}