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

The presenter now can reload a document. To do so I had to add the setters for IDocument's zoom and rotation (they should've been from the start, but...)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/tests/MainPterTest.cxx

    r62 r63  
    288288} 
    289289 
     290 
    290291/// 
    291292/// @brief Test page navigation. 
     
    490491    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
    491492    CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
    492     CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0f, m_Document->getZoom (), 0.0001f); 
     493    CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, m_Document->getZoom (), 0.0001); 
    493494 
    494495    m_MainPter->zoomInActivated (); 
    495496    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
    496497    CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
    497     CPPUNIT_ASSERT_DOUBLES_EQUAL (1.2f, m_Document->getZoom (), 0.0001f); 
     498    CPPUNIT_ASSERT_DOUBLES_EQUAL (1.2, m_Document->getZoom (), 0.0001); 
    498499 
    499500    m_MainPter->zoomOutActivated (); 
    500501    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
    501502    CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
    502     CPPUNIT_ASSERT_EQUAL (1.0f, m_Document->getZoom ()); 
     503    CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, m_Document->getZoom (), 0.0001); 
    503504    
    504505    CPPUNIT_ASSERT (m_View->isSensitiveZoomIn ()); 
     
    523524    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
    524525    CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
    525     CPPUNIT_ASSERT_DOUBLES_EQUAL (0.2f, m_Document->getZoom (), 0.0001f); 
     526    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.2, m_Document->getZoom (), 0.0001); 
    526527    // For the width it should be 75/100 = 0.75 
    527528    m_MainPter->zoomWidthActivated (); 
    528529    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
    529530    CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
    530     CPPUNIT_ASSERT_DOUBLES_EQUAL (0.75f, m_Document->getZoom (), 0.0001f); 
     531    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.75, m_Document->getZoom (), 0.0001); 
    531532 
    532533    // Now rotate and try again. 
     
    537538    // Since rotation is now 90 the zoom level should be 75/250 = 0.3 
    538539    m_MainPter->zoomFitActivated (); 
    539     CPPUNIT_ASSERT_DOUBLES_EQUAL (0.3f, m_Document->getZoom (), 0.0001f); 
     540    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.3, m_Document->getZoom (), 0.0001); 
    540541    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
    541542    // For the width it should be 75/250 = 0.3 also. 
    542543    m_MainPter->zoomWidthActivated (); 
    543     CPPUNIT_ASSERT_DOUBLES_EQUAL (0.3f, m_Document->getZoom (), 0.0001f); 
    544     CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
    545 } 
     544    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.3, m_Document->getZoom (), 0.0001); 
     545    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     546} 
     547 
     548/// 
     549/// @brief Test to reload a normal document. 
     550/// 
     551/// A "normal" document is a non encrypted document. The document 
     552/// should then be viewed at the same page, scale an rotation. 
     553/// 
     554void 
     555MainPterTest::reloadNormal () 
     556{ 
     557    m_View->setOpenFileName ("/tmp/test.pdf"); 
     558    m_MainPter->openFileActivated (); 
     559    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     560 
     561    m_MainPter->goToNextPageActivated (); 
     562    m_MainPter->rotateRightActivated ();  
     563    m_MainPter->zoomWidthActivated (); 
     564    CPPUNIT_ASSERT_EQUAL (2, m_View->getCurrentPage ());  
     565    CPPUNIT_ASSERT_EQUAL (90, m_Document->getRotation ());  
     566    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.3, m_Document->getZoom (), 0.0001); 
     567    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     568    CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
     569 
     570    // Reload the document. 
     571    m_MainPter->reloadActivated (); 
     572    CPPUNIT_ASSERT_EQUAL (2, m_View->getCurrentPage ());  
     573    CPPUNIT_ASSERT_EQUAL (90, m_Document->getRotation ());  
     574    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.3, m_Document->getZoom (), 0.0001); 
     575    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     576    CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
     577}