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

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

Files:
1 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}