Changeset 54 for trunk/tests/MainPterTest.cxx
- Timestamp:
- 04/14/06 05:08:13 (3 years ago)
- Files:
-
- 1 modified
-
trunk/tests/MainPterTest.cxx (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/MainPterTest.cxx
r36 r54 16 16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 17 18 #include <epdfview.h> 18 #include <glib.h> 19 #include <IDocument.h> 20 #include <IMainView.h> 21 #include <MainPter.h> 19 22 #include "DumbDocument.h" 20 23 #include "DumbMainView.h" … … 46 49 // We only need to delete the presenter, as all other 47 50 // classes are deleted by it. 48 // delete m_MainPter; 49 } 51 delete m_MainPter; 52 } 53 50 54 51 55 /// … … 295 299 CPPUNIT_ASSERT_EQUAL (1, m_View->getCurrentPage ()); 296 300 CPPUNIT_ASSERT (m_View->hasImagePageView ()); 301 // This is to check that after calling this function, it returns false 302 // because no page can be shown between the two... (I didn't called 303 // the presenter or the view, yet) 297 304 CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 298 305 // Going to the next page should make all actions sensitive. … … 305 312 CPPUNIT_ASSERT (m_View->isSensitiveGoToPreviousPage ()); 306 313 CPPUNIT_ASSERT (m_View->hasImagePageView ()); 307 CPPUNIT_ASSERT (!m_View->hasImagePageView ());308 314 // Going to the last will make some unsensitive. 309 315 m_MainPter->goToLastPageActivated (); … … 315 321 CPPUNIT_ASSERT (m_View->isSensitiveGoToPreviousPage ()); 316 322 CPPUNIT_ASSERT (m_View->hasImagePageView ()); 317 CPPUNIT_ASSERT (!m_View->hasImagePageView ());318 323 // Again to the last won't harm (just in case...) nor going next. 319 324 m_MainPter->goToLastPageActivated (); … … 358 363 CPPUNIT_ASSERT (m_View->hasImagePageView ()); 359 364 CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 365 } 366 367 /// 368 /// @brief Test the page navigation using the entry on the toolbar. 369 /// 370 /// The application has a text entry that the user can use to to a 371 /// page just by writting the number. Any non number after the first number 372 /// character will be discarded. 373 /// 374 void 375 MainPterTest::pageNavigationEntry () 376 { 377 m_View->setOpenFileName ("/tmp/test.pdf"); 378 m_Document->setNumPages (4); 379 m_MainPter->openFileActivated (); 380 // Check that sets the correct number of pages and the current page. 381 CPPUNIT_ASSERT_EQUAL (4, m_View->getTotalPages ()); 382 CPPUNIT_ASSERT_EQUAL (1, m_View->getCurrentPage ()); 383 CPPUNIT_ASSERT (m_View->hasImagePageView ()); 360 384 361 385 // Now try again using the page entry on toolbar. 362 m_View->setGoToPageText ("2 ");386 m_View->setGoToPageText ("2 of 4"); 363 387 m_MainPter->goToPageActivated (); 364 388 CPPUNIT_ASSERT_EQUAL (2, m_View->getCurrentPage ()); … … 371 395 CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 372 396 373 m_View->setGoToPageText ("4 ");397 m_View->setGoToPageText ("4 of 4"); 374 398 m_MainPter->goToPageActivated (); 375 399 CPPUNIT_ASSERT_EQUAL (4, m_View->getCurrentPage ()); … … 382 406 CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 383 407 384 m_View->setGoToPageText ("1 ");408 m_View->setGoToPageText ("1 of 4"); 385 409 m_MainPter->goToPageActivated (); 386 410 CPPUNIT_ASSERT_EQUAL (1, m_View->getCurrentPage ()); … … 394 418 395 419 // Invalid values. 396 m_View->setGoToPageText ("123123 ");420 m_View->setGoToPageText ("123123 of 1"); 397 421 m_MainPter->goToPageActivated (); 398 422 CPPUNIT_ASSERT_EQUAL (4, m_View->getCurrentPage ()); … … 405 429 CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 406 430 407 m_View->setGoToPageText ("0 ");431 m_View->setGoToPageText ("0 of 12"); 408 432 m_MainPter->goToPageActivated (); 409 433 CPPUNIT_ASSERT_EQUAL (1, m_View->getCurrentPage ()); … … 417 441 418 442 m_MainPter->goToNextPageActivated (); 419 m_View->setGoToPageText ("Jejej ");443 m_View->setGoToPageText ("Jejej :-)"); 420 444 m_MainPter->goToPageActivated (); 421 445 CPPUNIT_ASSERT_EQUAL (1, m_View->getCurrentPage ()); … … 527 551 CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 528 552 } 553
