Changeset 28

Show
Ignore:
Timestamp:
04/11/06 12:21:07 (2 years ago)
Author:
jordi
Message:

Now the tests prove that we can load an encrypted file asking only once for the password :-)

Location:
trunk/tests
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/tests/MainPterTest.cxx

    r27 r28  
    232232    CPPUNIT_ASSERT_EQUAL (3, m_View->countTimesShownPasswordPrompt ()); 
    233233} 
     234 
     235/// 
     236/// @brief Test a good password. 
     237/// 
     238/// This test just check that giving the correct password opens the 
     239/// file correctly. 
     240/// 
     241void 
     242MainPterTest::goodPassword () 
     243{ 
     244    m_View->setOpenFileName ("/tmp/test.pdf"); 
     245    m_View->setPassword ("goodpassword"); 
     246    m_Document->setPassword ("goodpassword"); 
     247    m_Document->setOpenError (DocumentErrorEncrypted); 
     248    m_MainPter->openFileActivated (); 
     249    CPPUNIT_ASSERT_EQUAL (0,  
     250            g_ascii_strcasecmp ("/tmp/test.pdf", m_View->getTitle ())); 
     251    CPPUNIT_ASSERT (!m_View->isSensitiveGoToFirstPage ()); 
     252    CPPUNIT_ASSERT (m_View->isSensitiveGoToLastPage ()); 
     253    CPPUNIT_ASSERT (m_View->isSensitiveGoToNextPage ()); 
     254    CPPUNIT_ASSERT (m_View->isSensitiveGoToPage ()); 
     255    CPPUNIT_ASSERT (!m_View->isSensitiveGoToPreviousPage ()); 
     256    CPPUNIT_ASSERT (m_View->isSensitiveZoomIn ()); 
     257    CPPUNIT_ASSERT (m_View->isSensitiveZoomOut ()); 
     258    CPPUNIT_ASSERT (m_View->isSensitiveZoomFit ()); 
     259    CPPUNIT_ASSERT (m_View->isSensitiveZoomWidth ()); 
     260    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     261    CPPUNIT_ASSERT (!m_View->shownError ()); 
     262    CPPUNIT_ASSERT_EQUAL (1, m_View->countTimesShownPasswordPrompt ()); 
     263} 
  • trunk/tests/MainPterTest.h

    r27 r28  
    3232        CPPUNIT_TEST (cancelledPassword); 
    3333        CPPUNIT_TEST (badPassword); 
     34        CPPUNIT_TEST (goodPassword); 
    3435        CPPUNIT_TEST_SUITE_END(); 
    3536 
     
    4445            void cancelledPassword (void); 
    4546            void badPassword (void); 
     47            void goodPassword (void); 
     48 
    4649        private: 
    4750            DumbMainView *m_View;