Changeset 207
- Timestamp:
- 06/10/06 06:57:16 (2 years ago)
- Location:
- trunk/tests
- Files:
-
- 4 modified
-
DumbMainView.cxx (modified) (8 diffs)
-
DumbMainView.h (modified) (3 diffs)
-
MainPterTest.cxx (modified) (20 diffs)
-
MainPterTest.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/DumbMainView.cxx
r205 r207 47 47 m_SensitiveRotateLeft = TRUE; 48 48 m_SensitiveRotateRight = TRUE; 49 m_SensitiveSave = TRUE; 50 m_SensitiveZoom = TRUE; 49 51 m_SensitiveZoomIn = TRUE; 50 52 m_SensitiveZoomOut = TRUE; … … 59 61 m_TimesShownPassword = 0; 60 62 m_TotalPages = 0; 63 m_ZoomText = g_strdup (""); 61 64 m_ZoomToFit = FALSE; 62 65 m_ZoomToWidth = FALSE; … … 72 75 g_free (m_Password); 73 76 g_free (m_Title); 77 g_free (m_ZoomText); 74 78 } 75 79 … … 188 192 DumbMainView::sensitiveSave (gboolean sensitive) 189 193 { 194 m_SensitiveSave = sensitive; 190 195 } 191 196 … … 193 198 DumbMainView::sensitiveZoom (gboolean sensitive) 194 199 { 200 m_SensitiveZoom = sensitive; 195 201 } 196 202 … … 228 234 DumbMainView::getZoomText () 229 235 { 230 return "";236 return m_ZoomText; 231 237 } 232 238 … … 271 277 DumbMainView::setZoomText (const gchar *text) 272 278 { 279 g_free (m_ZoomText); 280 m_ZoomText = g_strdup (text); 273 281 } 274 282 … … 396 404 { 397 405 return m_SensitiveRotateRight; 406 } 407 408 gboolean 409 DumbMainView::isSensitiveSave () 410 { 411 return m_SensitiveSave; 412 } 413 414 gboolean 415 DumbMainView::isSensitiveZoom () 416 { 417 return m_SensitiveZoom; 398 418 } 399 419 -
trunk/tests/DumbMainView.h
r205 r207 88 88 gboolean isSensitiveRotateLeft (void); 89 89 gboolean isSensitiveRotateRight (void); 90 gboolean isSensitiveZoomIn (void); 90 gboolean isSensitiveSave (void); 91 gboolean isSensitiveZoom (void); 92 gboolean isSensitiveZoomIn (void); 91 93 gboolean isSensitiveZoomOut (void); 92 94 gboolean isSensitiveZoomFit (void); … … 119 121 gboolean m_SensitiveRotateLeft; 120 122 gboolean m_SensitiveRotateRight; 123 gboolean m_SensitiveSave; 124 gboolean m_SensitiveZoom; 121 125 gboolean m_SensitiveZoomIn; 122 126 gboolean m_SensitiveZoomOut; … … 131 135 gchar *m_Title; 132 136 gint m_TotalPages; 137 gchar *m_ZoomText; 133 138 gboolean m_ZoomToFit; 134 139 gboolean m_ZoomToWidth; -
trunk/tests/MainPterTest.cxx
r141 r207 74 74 { 75 75 CPPUNIT_ASSERT ( m_View->isShown () ); 76 CPPUNIT_ASSERT_EQUAL (0, 76 CPPUNIT_ASSERT_EQUAL (0, 77 77 g_ascii_strcasecmp ("PDF Viewer", m_View->getTitle ())); 78 78 CPPUNIT_ASSERT (!m_View->isSensitiveGoToFirstPage ()); … … 84 84 CPPUNIT_ASSERT (!m_View->isSensitiveRotateLeft ()); 85 85 CPPUNIT_ASSERT (!m_View->isSensitiveRotateRight ()); 86 CPPUNIT_ASSERT (!m_View->isSensitiveSave ()); 87 CPPUNIT_ASSERT (!m_View->isSensitiveZoom ()); 86 88 CPPUNIT_ASSERT (!m_View->isSensitiveZoomIn ()); 87 89 CPPUNIT_ASSERT (!m_View->isSensitiveZoomOut ()); … … 108 110 m_MainPter->openFileActivated (); 109 111 m_MainPter->waitForFileLoaded (); 110 CPPUNIT_ASSERT_EQUAL (0, 112 CPPUNIT_ASSERT_EQUAL (0, 111 113 g_ascii_strcasecmp ("/tmp/test.pdf", m_View->getTitle ())); 112 114 CPPUNIT_ASSERT (!m_View->isSensitiveGoToFirstPage ()); … … 118 120 CPPUNIT_ASSERT (m_View->isSensitiveRotateLeft ()); 119 121 CPPUNIT_ASSERT (m_View->isSensitiveRotateRight ()); 122 CPPUNIT_ASSERT (m_View->isSensitiveSave ()); 123 CPPUNIT_ASSERT (m_View->isSensitiveZoom ()); 120 124 CPPUNIT_ASSERT (m_View->isSensitiveZoomIn ()); 121 125 CPPUNIT_ASSERT (m_View->isSensitiveZoomOut ()); … … 138 142 CPPUNIT_ASSERT (m_View->isSensitiveRotateLeft ()); 139 143 CPPUNIT_ASSERT (m_View->isSensitiveRotateRight ()); 144 CPPUNIT_ASSERT (m_View->isSensitiveSave ()); 145 CPPUNIT_ASSERT (m_View->isSensitiveZoom ()); 140 146 CPPUNIT_ASSERT (m_View->isSensitiveZoomIn ()); 141 147 CPPUNIT_ASSERT (m_View->isSensitiveZoomOut ()); … … 156 162 m_View->setOpenFileName (NULL); 157 163 m_MainPter->openFileActivated (); 158 CPPUNIT_ASSERT_EQUAL (0, 164 CPPUNIT_ASSERT_EQUAL (0, 159 165 g_ascii_strcasecmp ("PDF Viewer", m_View->getTitle ())); 160 166 CPPUNIT_ASSERT (!m_View->isSensitiveGoToFirstPage ()); … … 166 172 CPPUNIT_ASSERT (!m_View->isSensitiveRotateLeft ()); 167 173 CPPUNIT_ASSERT (!m_View->isSensitiveRotateRight ()); 174 CPPUNIT_ASSERT (!m_View->isSensitiveSave ()); 175 CPPUNIT_ASSERT (!m_View->isSensitiveZoom ()); 168 176 CPPUNIT_ASSERT (!m_View->isSensitiveZoomIn ()); 169 177 CPPUNIT_ASSERT (!m_View->isSensitiveZoomOut ()); … … 188 196 m_MainPter->openFileActivated (); 189 197 m_MainPter->waitForFileLoaded (); 190 CPPUNIT_ASSERT_EQUAL (0, 198 CPPUNIT_ASSERT_EQUAL (0, 191 199 g_ascii_strcasecmp ("PDF Viewer", m_View->getTitle ())); 192 200 CPPUNIT_ASSERT (!m_View->isSensitiveGoToFirstPage ()); … … 198 206 CPPUNIT_ASSERT (!m_View->isSensitiveRotateLeft ()); 199 207 CPPUNIT_ASSERT (!m_View->isSensitiveRotateRight ()); 208 CPPUNIT_ASSERT (!m_View->isSensitiveSave ()); 209 CPPUNIT_ASSERT (!m_View->isSensitiveZoom ()); 200 210 CPPUNIT_ASSERT (!m_View->isSensitiveZoomIn ()); 201 211 CPPUNIT_ASSERT (!m_View->isSensitiveZoomOut ()); … … 231 241 CPPUNIT_ASSERT (!m_View->isSensitiveRotateLeft ()); 232 242 CPPUNIT_ASSERT (!m_View->isSensitiveRotateRight ()); 243 CPPUNIT_ASSERT (!m_View->isSensitiveSave ()); 244 CPPUNIT_ASSERT (!m_View->isSensitiveZoom ()); 233 245 CPPUNIT_ASSERT (!m_View->isSensitiveZoomIn ()); 234 246 CPPUNIT_ASSERT (!m_View->isSensitiveZoomOut ()); … … 254 266 m_MainPter->openFileActivated (); 255 267 m_MainPter->waitForFileLoaded (); 256 CPPUNIT_ASSERT_EQUAL (0, 268 CPPUNIT_ASSERT_EQUAL (0, 257 269 g_ascii_strcasecmp ("PDF Viewer", m_View->getTitle ())); 258 270 CPPUNIT_ASSERT (!m_View->isSensitiveGoToFirstPage ()); … … 264 276 CPPUNIT_ASSERT (!m_View->isSensitiveRotateLeft ()); 265 277 CPPUNIT_ASSERT (!m_View->isSensitiveRotateRight ()); 278 CPPUNIT_ASSERT (!m_View->isSensitiveSave ()); 279 CPPUNIT_ASSERT (!m_View->isSensitiveZoom ()); 266 280 CPPUNIT_ASSERT (!m_View->isSensitiveZoomIn ()); 267 281 CPPUNIT_ASSERT (!m_View->isSensitiveZoomOut ()); … … 287 301 m_MainPter->openFileActivated (); 288 302 m_MainPter->waitForFileLoaded (); 289 CPPUNIT_ASSERT_EQUAL (0, 303 CPPUNIT_ASSERT_EQUAL (0, 290 304 g_ascii_strcasecmp ("/tmp/test.pdf", m_View->getTitle ())); 291 305 CPPUNIT_ASSERT (!m_View->isSensitiveGoToFirstPage ()); … … 297 311 CPPUNIT_ASSERT (m_View->isSensitiveRotateLeft ()); 298 312 CPPUNIT_ASSERT (m_View->isSensitiveRotateRight ()); 313 CPPUNIT_ASSERT (m_View->isSensitiveSave ()); 314 CPPUNIT_ASSERT (m_View->isSensitiveZoom ()); 299 315 CPPUNIT_ASSERT (m_View->isSensitiveZoomIn ()); 300 316 CPPUNIT_ASSERT (m_View->isSensitiveZoomOut ()); … … 326 342 CPPUNIT_ASSERT (0 == g_ascii_strcasecmp ("/tmp", 327 343 m_View->getLastOpenFileFolder ())); 328 344 329 345 m_MainPter->openFileActivated (); 330 346 m_MainPter->waitForFileLoaded (); … … 518 534 m_MainPter->zoomOutActivated (); 519 535 CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, m_Document->getZoom (), 0.0001); 520 536 521 537 CPPUNIT_ASSERT (m_View->isSensitiveZoomIn ()); 522 538 CPPUNIT_ASSERT (m_View->isSensitiveZoomOut ()); … … 545 561 m_MainPter->openFileActivated (); 546 562 m_MainPter->waitForFileLoaded (); 547 563 548 564 m_MainPter->zoomWidthActivated (TRUE); 549 565 CPPUNIT_ASSERT (m_View->isZoomToWidthActive ()); … … 570 586 m_MainPter->openFileActivated (); 571 587 m_MainPter->waitForFileLoaded (); 572 588 573 589 m_MainPter->zoomFitActivated (TRUE); 574 590 CPPUNIT_ASSERT (m_View->isZoomToFitActive ()); … … 607 623 m_MainPter->rotateLeftActivated (); 608 624 CPPUNIT_ASSERT_DOUBLES_EQUAL (0.3, m_Document->getZoom (), 0.0001); 609 m_MainPter->rotateRightActivated (); 625 m_MainPter->rotateRightActivated (); 610 626 CPPUNIT_ASSERT_DOUBLES_EQUAL (0.75, m_Document->getZoom (), 0.0001); 611 m_MainPter->rotateRightActivated (); 627 m_MainPter->rotateRightActivated (); 612 628 CPPUNIT_ASSERT_DOUBLES_EQUAL (0.3, m_Document->getZoom (), 0.0001); 613 629 m_MainPter->rotateLeftActivated (); … … 621 637 m_MainPter->rotateLeftActivated (); 622 638 CPPUNIT_ASSERT_DOUBLES_EQUAL (0.3, m_Document->getZoom (), 0.0001); 623 m_MainPter->rotateRightActivated (); 639 m_MainPter->rotateRightActivated (); 624 640 CPPUNIT_ASSERT_DOUBLES_EQUAL (0.2, m_Document->getZoom (), 0.0001); 625 m_MainPter->rotateRightActivated (); 641 m_MainPter->rotateRightActivated (); 626 642 CPPUNIT_ASSERT_DOUBLES_EQUAL (0.3, m_Document->getZoom (), 0.0001); 627 643 m_MainPter->rotateLeftActivated (); 628 644 CPPUNIT_ASSERT_DOUBLES_EQUAL (0.2, m_Document->getZoom (), 0.0001); 645 } 646 647 /// 648 /// @brief Test the current zoom level indicator. 649 /// 650 /// The main view has an entry in the tool bar that tells the user 651 /// which is the current document's zoom level. Also, when the user 652 /// enter a new zoom level and presses ENTER, the new zoom level is 653 /// used. 654 /// 655 void 656 MainPterTest::pageZoomIndicator () 657 { 658 // When the open is first opened, the zoom is 100%. 659 m_View->setOpenFileName ("/tmp/test.pdf"); 660 m_MainPter->openFileActivated (); 661 m_MainPter->waitForFileLoaded (); 662 CPPUNIT_ASSERT (0 == g_ascii_strcasecmp ("100%", m_View->getZoomText ())); 663 664 // Try changing a little the zoom level. 665 m_MainPter->zoomInActivated (); 666 CPPUNIT_ASSERT (0 == g_ascii_strcasecmp ("120%", m_View->getZoomText ())); 667 m_MainPter->zoomInActivated (); 668 CPPUNIT_ASSERT (0 == g_ascii_strcasecmp ("144%", m_View->getZoomText ())); 669 m_MainPter->zoomOutActivated (); 670 CPPUNIT_ASSERT (0 == g_ascii_strcasecmp ("120%", m_View->getZoomText ())); 671 m_MainPter->zoomOutActivated (); 672 CPPUNIT_ASSERT (0 == g_ascii_strcasecmp ("100%", m_View->getZoomText ())); 673 m_MainPter->zoomOutActivated (); 674 CPPUNIT_ASSERT (0 == g_ascii_strcasecmp ("83.3%", m_View->getZoomText ())); 675 676 // Now try to set the zoom level by hand. If the zoom level is 677 // clamped 400% and 5.41%. 678 m_View->setZoomText ("50%"); 679 m_MainPter->zoomActivated (); 680 CPPUNIT_ASSERT_DOUBLES_EQUAL (0.5, m_Document->getZoom (), 0.0001); 681 m_View->setZoomText ("1000%"); 682 m_MainPter->zoomActivated (); 683 CPPUNIT_ASSERT_DOUBLES_EQUAL (4.0, m_Document->getZoom (), 0.0001); 684 CPPUNIT_ASSERT (0 == g_ascii_strcasecmp ("400%", m_View->getZoomText ())); 685 m_View->setZoomText ("1"); 686 m_MainPter->zoomActivated (); 687 CPPUNIT_ASSERT_DOUBLES_EQUAL (0.0541, m_Document->getZoom (), 0.0001); 688 CPPUNIT_ASSERT (0 == g_ascii_strcasecmp ("5.41%", m_View->getZoomText ())); 629 689 } 630 690 -
trunk/tests/MainPterTest.h
r136 r207 41 41 CPPUNIT_TEST (pageZoomFit); 42 42 CPPUNIT_TEST (pageZoomAndRotate); 43 CPPUNIT_TEST (pageZoomIndicator); 43 44 CPPUNIT_TEST (reloadNormal); 44 45 CPPUNIT_TEST (reloadEncrypted); … … 67 68 void pageZoomFit (void); 68 69 void pageZoomAndRotate (void); 70 void pageZoomIndicator (void); 69 71 void reloadNormal (void); 70 72 void reloadEncrypted (void);
