Changeset 98 for trunk/tests/MainPterTest.cxx
- Timestamp:
- 04/20/06 11:13:01 (3 years ago)
- Files:
-
- 1 modified
-
trunk/tests/MainPterTest.cxx (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/MainPterTest.cxx
r97 r98 513 513 /// ZoomIn insensitives the ZoomIn button. The same for the ZoomOut. 514 514 /// 515 /// Then will test Zoom Fit and Zoom Width with two different rotations. 516 /// 517 void 518 MainPterTest::pageZoom () 515 /// 516 void 517 MainPterTest::pageZoomInAndOut () 519 518 { 520 519 m_View->setOpenFileName ("/tmp/test.pdf"); … … 549 548 CPPUNIT_ASSERT (m_View->isSensitiveZoomIn ()); 550 549 CPPUNIT_ASSERT (!m_View->isSensitiveZoomOut ()); 550 } 551 552 /// 553 /// @brief Tests page's zoom to width 554 /// 555 void 556 MainPterTest::pageZoomWidth () 557 { 558 m_View->setOpenFileName ("/tmp/test.pdf"); 559 m_MainPter->openFileActivated (); 560 CPPUNIT_ASSERT (m_View->hasImagePageView ()); 561 CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 562 CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, m_Document->getZoom (), 0.0001); 551 563 552 564 // OK, now try to zoom width. Since rotation is 0 565 // the zoom level should be 75/100 = 0.75 566 m_MainPter->zoomWidthActivated (); 567 CPPUNIT_ASSERT (m_View->hasImagePageView ()); 568 CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 569 CPPUNIT_ASSERT_DOUBLES_EQUAL (0.75, m_Document->getZoom (), 0.0001); 570 571 // Now rotate and try again. 572 m_MainPter->rotateRightActivated (); 573 CPPUNIT_ASSERT (m_View->hasImagePageView ()); 574 CPPUNIT_ASSERT_EQUAL (90, m_Document->getRotation ()); 575 576 // Since rotation is now 90 the zoom level should be 75/250 = 0.3 577 m_MainPter->zoomWidthActivated (); 578 CPPUNIT_ASSERT_DOUBLES_EQUAL (0.3, m_Document->getZoom (), 0.0001); 579 CPPUNIT_ASSERT (m_View->hasImagePageView ()); 580 } 581 582 /// 583 /// @brief Tests page's zoom to fit 584 /// 585 void 586 MainPterTest::pageZoomFit () 587 { 588 m_View->setOpenFileName ("/tmp/test.pdf"); 589 m_MainPter->openFileActivated (); 590 CPPUNIT_ASSERT (m_View->hasImagePageView ()); 591 CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 592 CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, m_Document->getZoom (), 0.0001); 593 594 // OK, now try to zoom to fit. Since rotation is 0 553 595 // the zoom level should be 50/250 = 0.2 554 596 m_MainPter->zoomFitActivated (); … … 556 598 CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 557 599 CPPUNIT_ASSERT_DOUBLES_EQUAL (0.2, m_Document->getZoom (), 0.0001); 558 // For the width it should be 75/100 = 0.75559 m_MainPter->zoomWidthActivated ();560 CPPUNIT_ASSERT (m_View->hasImagePageView ());561 CPPUNIT_ASSERT (!m_View->hasImagePageView ());562 CPPUNIT_ASSERT_DOUBLES_EQUAL (0.75, m_Document->getZoom (), 0.0001);563 600 564 601 // Now rotate and try again. … … 571 608 CPPUNIT_ASSERT_DOUBLES_EQUAL (0.3, m_Document->getZoom (), 0.0001); 572 609 CPPUNIT_ASSERT (m_View->hasImagePageView ()); 573 // For the width it should be 75/250 = 0.3 also. 574 m_MainPter->zoomWidthActivated (); 575 CPPUNIT_ASSERT_DOUBLES_EQUAL (0.3, m_Document->getZoom (), 0.0001); 576 CPPUNIT_ASSERT (m_View->hasImagePageView ()); 577 } 610 } 611 578 612 579 613 ///
