Changeset 99

Show
Ignore:
Timestamp:
04/20/06 13:09:22 (2 years ago)
Author:
jordi
Message:

The MainPter? now resizes the page shown if the zoom to width or zoom to fit, that now are toggle actions, are activated. The view also tells to the presenter when the scroll window has resized, so it can calculate the new page.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/IMainView.h

    r97 r99  
    4242            /// 
    4343            virtual ~IMainView (void) {} 
     44 
     45            /// 
     46            /// @brief Actives or desactives the zoom to fit. 
     47            /// 
     48            /// The view must change the state of the zoom to fit option 
     49            /// to @a active. 
     50            /// 
     51            /// @param active TRUE if the option must be actived, FALSE 
     52            ///               otherwise. 
     53            /// 
     54            virtual void activeZoomFit (gboolean active) = 0; 
     55            
     56            /// 
     57            /// @brief Actives or desactives the zoom to width. 
     58            /// 
     59            /// The view must change the state of the zoom to width option 
     60            /// to @a active. 
     61            /// 
     62            /// @param active TRUE if the option must be actived, FALSE 
     63            ///               otherwise. 
     64            /// 
     65            virtual void activeZoomWidth (gboolean active) = 0; 
    4466            
    4567            /// 
  • trunk/src/MainPter.cxx

    r97 r99  
    9696        view.sensitiveZoomFit (TRUE); 
    9797        view.sensitiveZoomWidth (TRUE); 
     98        view.activeZoomFit (Config::getConfig ().zoomToFit ()); 
     99        view.activeZoomWidth (Config::getConfig ().zoomToWidth ()); 
    98100        view.setTotalPages (m_Document->getNumPages ()); 
    99101 
     
    289291 
    290292/// 
     293/// @brief The page view has been resized. 
     294/// 
     295/// @param width The new with of the page view. 
     296/// @param height The new height of the page view. 
     297/// 
     298void 
     299MainPter::pageViewResized (gint width, gint height) 
     300{ 
     301    static gint lastWidth = -1; 
     302    static gint lastHeight = -1; 
     303 
     304    if ( !m_Document->isLoaded() ||  
     305         ( lastWidth == width && lastHeight == height) ) 
     306    { 
     307        return; 
     308    } 
     309     
     310    lastWidth = width; 
     311    lastHeight = height; 
     312     
     313    Config &config = Config::getConfig (); 
     314 
     315    if ( config.zoomToFit () ) 
     316    { 
     317        m_Document->zoomToFit (width, height); 
     318        showPage (); 
     319    } 
     320    else if ( config.zoomToWidth () ) 
     321    { 
     322        m_Document->zoomToWidth (width); 
     323        showPage (); 
     324    } 
     325} 
     326 
     327/// 
    291328/// @brief The "Reload" was activated. 
    292329/// 
     
    339376/// @brief The "Zoom Fit Best" was activated. 
    340377/// 
    341 void 
    342 MainPter::zoomFitActivated (void) 
     378/// @param active TRUE if the Zoom fit best is active, FALSE otherwise. 
     379/// 
     380void 
     381MainPter::zoomFitActivated (gboolean active) 
    343382{ 
    344383    g_assert ( NULL != m_Document && "Tried to zoom fit a NULL document."); 
    345384 
    346     gint width; 
    347     gint height; 
    348     getView ().getPageViewSize (&width, &height); 
    349     m_Document->zoomToFit (width, height); 
    350     showPage (); 
     385    Config &config = Config::getConfig (); 
     386    config.setZoomToFit (active); 
     387    IMainView &view = getView (); 
     388    view.activeZoomFit (config.zoomToFit ()); 
     389    view.activeZoomWidth (config.zoomToWidth ()); 
     390    if ( active ) 
     391    { 
     392        gint width; 
     393        gint height; 
     394        view.getPageViewSize (&width, &height); 
     395        m_Document->zoomToFit (width, height); 
     396        showPage (); 
     397    } 
    351398} 
    352399 
     
    359406    g_assert ( NULL != m_Document && "Tried to zoom in a NULL document."); 
    360407 
     408    Config &config = Config::getConfig (); 
     409    config.setZoomToFit (FALSE); 
     410    config.setZoomToWidth (FALSE); 
     411 
     412    IMainView &view = getView (); 
     413    view.activeZoomFit (FALSE); 
     414    view.activeZoomWidth (FALSE); 
     415     
    361416    m_Document->zoomIn (); 
    362417    showPage (); 
     
    371426    g_assert ( NULL != m_Document && "Tried to zoom out a NULL document."); 
    372427 
     428    Config &config = Config::getConfig (); 
     429    config.setZoomToFit (FALSE); 
     430    config.setZoomToWidth (FALSE); 
     431 
     432    IMainView &view = getView (); 
     433    view.activeZoomFit (FALSE); 
     434    view.activeZoomWidth (FALSE); 
     435     
    373436    m_Document->zoomOut (); 
    374437    showPage (); 
     
    378441/// @brief The "Zoom Fit Width" was activated. 
    379442/// 
    380 void 
    381 MainPter::zoomWidthActivated (void) 
     443/// @param active TRUE if the zoom to width option is actived, false otherwise. 
     444/// 
     445void 
     446MainPter::zoomWidthActivated (gboolean active) 
    382447{ 
    383448    g_assert ( NULL != m_Document && "Tried to zoom width a NULL document."); 
    384449 
    385     gint width; 
    386     gint height; 
    387     getView ().getPageViewSize (&width, &height); 
    388     m_Document->zoomToWidth (width); 
    389     showPage (); 
     450    Config &config = Config::getConfig (); 
     451    config.setZoomToWidth (active); 
     452    IMainView &view = getView (); 
     453    view.activeZoomFit (config.zoomToFit ()); 
     454    view.activeZoomWidth (config.zoomToWidth ()); 
     455    if ( active ) 
     456    { 
     457        gint width; 
     458        gint height; 
     459        view.getPageViewSize (&width, &height); 
     460        m_Document->zoomToWidth (width); 
     461        showPage (); 
     462    } 
    390463} 
    391464 
  • trunk/src/MainPter.h

    r71 r99  
    5454            void openFileActivated (void); 
    5555            void outlineActivated (DocumentOutline *outline); 
     56            void pageViewResized (gint width, gint height); 
    5657            void reloadActivated (void); 
    5758            void rotateLeftActivated (void); 
    5859            void rotateRightActivated (void); 
    59             void zoomFitActivated (void); 
     60            void zoomFitActivated (gboolean active); 
    6061            void zoomInActivated (void); 
    6162            void zoomOutActivated (void); 
    62             void zoomWidthActivated (void); 
     63            void zoomWidthActivated (gboolean active); 
    6364 
    6465        protected: 
  • trunk/src/gtk/MainView.cxx

    r97 r99  
    4646static void main_window_open_file_cb (GtkWidget *, gpointer); 
    4747static void main_window_outline_cb (GtkTreeSelection *, gpointer); 
     48static void main_window_page_view_resized_cb (GtkWidget *, GtkAllocation *,  
     49                                              gpointer); 
    4850static void main_window_quit_cb (GtkWidget *, gpointer); 
    4951static void main_window_show_sidebar_cb (GtkToggleAction *, gpointer); 
    5052static void main_window_show_statusbar_cb (GtkToggleAction *, gpointer); 
    5153static void main_window_show_toolbar_cb (GtkToggleAction *, gpointer); 
    52 static void main_window_zoom_fit_cb (GtkWidget *, gpointer); 
     54static void main_window_zoom_fit_cb (GtkToggleAction *, gpointer); 
    5355static void main_window_zoom_in_cb (GtkWidget *, gpointer); 
    5456static void main_window_zoom_out_cb (GtkWidget *, gpointer); 
    55 static void main_window_zoom_width_cb (GtkWidget *, gpointer); 
     57static void main_window_zoom_width_cb (GtkToggleAction *, gpointer); 
    5658 
    5759// The actions for menus and toolbars. 
     
    8385      G_CALLBACK (main_window_zoom_out_cb) }, 
    8486     
    85     { "ZoomFit", GTK_STOCK_ZOOM_FIT, N_("Zoom to _Fit"), NULL, 
    86       N_("Make the current document fill the window"),  
    87       G_CALLBACK (main_window_zoom_fit_cb) }, 
    88  
    89     { "ZoomWidth", EPDFVIEW_STOCK_ZOOM_WIDTH, N_("Zoom to _Width"), NULL, 
    90       N_("Make the current document fill the window width"),  
    91       G_CALLBACK (main_window_zoom_width_cb) }, 
    92  
    9387    { "RotateRight", EPDFVIEW_STOCK_ROTATE_RIGHT, N_("Rotate _Right"), NULL,  
    9488      N_("Rotate the document 90 degrees clockwise"),  
     
    130124    { "ShowSideBar", NULL, N_("Show O_utline"), NULL, 
    131125      N_("Show or hide the document's outline"), 
    132       G_CALLBACK (main_window_show_sidebar_cb), FALSE } 
     126      G_CALLBACK (main_window_show_sidebar_cb), FALSE }, 
     127 
     128    { "ZoomFit", GTK_STOCK_ZOOM_FIT, N_("Zoom to _Fit"), NULL, 
     129      N_("Make the current document fill the window"),  
     130      G_CALLBACK (main_window_zoom_fit_cb), FALSE }, 
     131 
     132    { "ZoomWidth", EPDFVIEW_STOCK_ZOOM_WIDTH, N_("Zoom to _Width"), NULL, 
     133      N_("Make the current document fill the window width"),  
     134      G_CALLBACK (main_window_zoom_width_cb), FALSE } 
     135 
    133136}; 
    134137 
     
    190193} 
    191194 
     195void 
     196MainView::activeZoomFit (gboolean active) 
     197{ 
     198    GtkAction *zoomFit =  
     199        gtk_ui_manager_get_action (m_UIManager, "/MenuBar/ViewMenu/ZoomFit"); 
     200    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (zoomFit), active); 
     201} 
     202 
     203void 
     204MainView::activeZoomWidth (gboolean active) 
     205{ 
     206    GtkAction *zoomWidth =  
     207        gtk_ui_manager_get_action (m_UIManager, "/MenuBar/ViewMenu/ZoomWidth"); 
     208    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (zoomWidth), active); 
     209} 
    192210 
    193211gchar * 
     
    513531                                    GTK_POLICY_AUTOMATIC, 
    514532                                    GTK_POLICY_AUTOMATIC); 
     533    // When resizing. 
     534    g_signal_connect (G_OBJECT (m_PageViewScroll), "size-allocate", 
     535                      G_CALLBACK (main_window_page_view_resized_cb), m_Pter); 
     536    // The actual image, 
    515537    m_PageView = gtk_image_new  (); 
    516538    gtk_misc_set_padding (GTK_MISC (m_PageView),  
     
    586608    gtk_action_group_add_toggle_actions (actionGroup, g_ToggleEntries, 
    587609                                         G_N_ELEMENTS (g_ToggleEntries), 
    588                                          this); 
     610                                         m_Pter); 
    589611    m_UIManager = gtk_ui_manager_new (); 
    590612    gtk_ui_manager_insert_action_group (m_UIManager, actionGroup, 0); 
     
    919941    } 
    920942} 
     943 
     944/// 
     945/// @brief The page view has been resized. 
     946static void 
     947main_window_page_view_resized_cb (GtkWidget *widget, GtkAllocation *allocation, 
     948                                  gpointer data) 
     949{ 
     950    g_assert ( NULL != data && "The data parameter is NULL."); 
     951 
     952    gint scrollSize = SCROLLBARS_SIZE + PAGE_VIEW_PADDING * 2; 
     953    gint width = allocation->width - scrollSize; 
     954    gint height = allocation->height - scrollSize; 
     955    MainPter *pter = (MainPter *)data; 
     956    pter->pageViewResized (width, height); 
     957} 
     958 
    921959/// 
    922960/// @brief Called when the window is closed or Quit is activated. 
     
    936974    g_assert ( NULL != data && "The data parameter is NULL."); 
    937975 
    938     MainView *view = (MainView *)data; 
    939     view->showSidebar (gtk_toggle_action_get_active (action)); 
     976//    MainView *view = (MainView *)data; 
     977//    view->showSidebar (gtk_toggle_action_get_active (action)); 
    940978} 
    941979 
     
    948986    g_assert ( NULL != data && "The data parameter is NULL."); 
    949987 
    950     MainView *view = (MainView *)data; 
    951     view->showStatusbar (gtk_toggle_action_get_active (action)); 
     988//    MainView *view = (MainView *)data; 
     989//    view->showStatusbar (gtk_toggle_action_get_active (action)); 
    952990} 
    953991 
     
    960998    g_assert ( NULL != data && "The data parameter is NULL."); 
    961999 
    962     MainView *view = (MainView *)data; 
    963     view->showToolbar (gtk_toggle_action_get_active (action)); 
     1000//    MainView *view = (MainView *)data; 
     1001//    view->showToolbar (gtk_toggle_action_get_active (action)); 
    9641002} 
    9651003 
     
    9681006/// 
    9691007void 
    970 main_window_zoom_fit_cb (GtkWidget *widget, gpointer data) 
    971 { 
    972     g_assert ( NULL != data && "The data parameter is NULL."); 
    973  
    974     MainPter *pter = (MainPter *)data; 
    975     pter->zoomFitActivated (); 
     1008main_window_zoom_fit_cb (GtkToggleAction *action, gpointer data) 
     1009{ 
     1010    g_assert ( NULL != data && "The data parameter is NULL."); 
     1011 
     1012    MainPter *pter = (MainPter *)data; 
     1013    pter->zoomFitActivated (gtk_toggle_action_get_active (action)); 
    9761014} 
    9771015 
     
    10041042/// 
    10051043void 
    1006 main_window_zoom_width_cb (GtkWidget *widget, gpointer data) 
    1007 { 
    1008     g_assert ( NULL != data && "The data parameter is NULL."); 
    1009  
    1010     MainPter *pter = (MainPter *)data; 
    1011     pter->zoomWidthActivated (); 
    1012 } 
     1044main_window_zoom_width_cb (GtkToggleAction *action, gpointer data) 
     1045{ 
     1046    g_assert ( NULL != data && "The data parameter is NULL."); 
     1047 
     1048    MainPter *pter = (MainPter *)data; 
     1049    pter->zoomWidthActivated (gtk_toggle_action_get_active (action)); 
     1050} 
  • trunk/src/gtk/MainView.h

    r97 r99  
    3131            MainView (MainPter *pter); 
    3232            ~MainView (); 
    33              
     33            
     34            void activeZoomFit (gboolean active); 
     35            void activeZoomWidth (gboolean active); 
    3436            gchar *openFileDialog (const gchar *lastFolder); 
    3537            gchar *promptPasswordDialog (void); 
  • trunk/tests/DumbMainView.cxx

    r97 r99  
    5353    m_TimesShownPassword = 0; 
    5454    m_TotalPages = 0; 
     55    m_ZoomToFit = FALSE; 
     56    m_ZoomToWidth = FALSE; 
    5557} 
    5658 
     
    6466} 
    6567             
     68void  
     69DumbMainView::activeZoomFit (gboolean active) 
     70{ 
     71    m_ZoomToFit = active; 
     72} 
     73 
     74void  
     75DumbMainView::activeZoomWidth (gboolean active) 
     76{ 
     77    m_ZoomToWidth = active; 
     78} 
     79             
    6680gchar * 
    6781DumbMainView::openFileDialog (const gchar *lastFolder) 
     
    348362{ 
    349363    return m_ShownSidebar; 
     364} 
     365 
     366gboolean 
     367DumbMainView::isZoomToFitActive () 
     368{ 
     369    return m_ZoomToFit; 
     370} 
     371 
     372gboolean 
     373DumbMainView::isZoomToWidthActive () 
     374{ 
     375    return m_ZoomToWidth; 
    350376} 
    351377 
  • trunk/tests/DumbMainView.h

    r97 r99  
    2828            ~DumbMainView (); 
    2929 
     30            void activeZoomFit (gboolean active); 
     31            void activeZoomWidth (gboolean active); 
    3032            gchar *openFileDialog (const gchar *lastFolder); 
    3133            gchar *promptPasswordDialog (void); 
     
    7577            gboolean isSensitiveZoomWidth (void); 
    7678            gboolean isShownSidebar (void); 
     79            gboolean isZoomToFitActive (void); 
     80            gboolean isZoomToWidthActive (void); 
    7781            void setOpenFileName (const gchar *fileName); 
    7882            void setPassword (const gchar *password); 
     
    105109            gchar *m_Title; 
    106110            gint m_TotalPages; 
     111            gboolean m_ZoomToFit; 
     112            gboolean m_ZoomToWidth; 
    107113    }; 
    108114} 
  • trunk/tests/MainPterTest.cxx

    r98 r99  
    559559    m_MainPter->openFileActivated (); 
    560560    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
    561     CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
    562561    CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, m_Document->getZoom (), 0.0001); 
    563562 
    564563    // OK, now try to zoom width. Since rotation is 0 
    565564    // 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 ()); 
     565    m_MainPter->zoomWidthActivated (TRUE); 
     566    CPPUNIT_ASSERT (m_View->isZoomToWidthActive ()); 
     567    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
    569568    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.75, m_Document->getZoom (), 0.0001); 
     569 
     570    // Now change the view size. We do this calling the main presenter's 
     571    // function instead of the view, because the view here don't have anything 
     572    // to do. 
     573    // The new zoom should be 50/100 = 0.5 
     574    m_MainPter->pageViewResized (50, 50); 
     575    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     576    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.5, m_Document->getZoom (), 0.0001); 
     577     
     578    m_MainPter->pageViewResized (75, 50); 
     579    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     580    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.75, m_Document->getZoom (), 0.0001); 
     581 
     582    // If we desactive the zoom to width, no resizing changes the 
     583    // zoom. 
     584    m_MainPter->zoomWidthActivated (FALSE); 
     585    CPPUNIT_ASSERT (!m_View->isZoomToWidthActive ()); 
     586    m_MainPter->pageViewResized (50, 50); 
     587    CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
     588    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.75, m_Document->getZoom (), 0.0001); 
     589    m_MainPter->pageViewResized (100, 50); 
     590    CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
     591    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.75, m_Document->getZoom (), 0.0001); 
     592 
     593    // Now rotate and try again. 
     594    m_MainPter->rotateRightActivated ();  
     595    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     596    CPPUNIT_ASSERT_EQUAL (90, m_Document->getRotation ());     
     597    // Since rotation is now 90 the zoom level should be 75/250 = 0.3 
     598    m_MainPter->zoomWidthActivated (TRUE); 
     599    CPPUNIT_ASSERT (m_View->isZoomToWidthActive ()); 
     600    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.3, m_Document->getZoom (), 0.0001); 
     601    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     602    // Resizing. 50/250 = 0.2 
     603    m_MainPter->pageViewResized (50, 50); 
     604    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     605    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.2, m_Document->getZoom (), 0.0001); 
     606 
     607    // Changing any of the zoom in or zoom out features should make the  
     608    // zoom to width not being active. 
     609    m_MainPter->zoomInActivated (); 
     610    CPPUNIT_ASSERT (!m_View->isZoomToWidthActive ()); 
     611    m_MainPter->zoomWidthActivated (TRUE); 
     612    m_MainPter->zoomOutActivated (); 
     613    CPPUNIT_ASSERT (!m_View->isZoomToWidthActive ()); 
     614} 
     615 
     616/// 
     617/// @brief Tests page's zoom to fit 
     618/// 
     619void 
     620MainPterTest::pageZoomFit () 
     621{ 
     622    m_View->setOpenFileName ("/tmp/test.pdf"); 
     623    m_MainPter->openFileActivated (); 
     624    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     625    CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, m_Document->getZoom (), 0.0001); 
     626 
     627    // OK, now try to zoom to fit. Since rotation is 0 
     628    // the zoom level should be 50/250 = 0.2 
     629    m_MainPter->zoomFitActivated (TRUE); 
     630    CPPUNIT_ASSERT (m_View->isZoomToFitActive ()); 
     631    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     632    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.2, m_Document->getZoom (), 0.0001); 
     633 
     634    // Resizing the view size. 100/250 = 0.4 
     635    m_MainPter->pageViewResized (100, 100); 
     636    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     637    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.4, m_Document->getZoom (), 0.0001); 
     638    m_MainPter->pageViewResized (100, 50); 
     639    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     640    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.2, m_Document->getZoom (), 0.0001); 
     641 
     642    // Desactivating the zoom to fit. 
     643    m_MainPter->zoomFitActivated (FALSE); 
     644    CPPUNIT_ASSERT (!m_View->isZoomToFitActive ()); 
     645    m_MainPter->pageViewResized (100, 100); 
     646    CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
     647    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.2, m_Document->getZoom (), 0.0001); 
     648    m_MainPter->pageViewResized (100, 50); 
     649    CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
     650    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.2, m_Document->getZoom (), 0.0001); 
    570651 
    571652    // Now rotate and try again. 
     
    575656     
    576657    // Since rotation is now 90 the zoom level should be 75/250 = 0.3 
    577     m_MainPter->zoomWidthActivated (); 
     658    m_MainPter->zoomFitActivated (TRUE); 
     659    CPPUNIT_ASSERT (m_View->isZoomToFitActive ()); 
    578660    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.3, m_Document->getZoom (), 0.0001); 
    579661    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 
    595     // the zoom level should be 50/250 = 0.2 
    596     m_MainPter->zoomFitActivated (); 
    597     CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
    598     CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
    599     CPPUNIT_ASSERT_DOUBLES_EQUAL (0.2, m_Document->getZoom (), 0.0001); 
    600  
    601     // Now rotate and try again. 
    602     m_MainPter->rotateRightActivated ();  
    603     CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
    604     CPPUNIT_ASSERT_EQUAL (90, m_Document->getRotation ()); 
     662    // 100/250 = 0.4 
     663    m_MainPter->pageViewResized (100, 100); 
     664    CPPUNIT_ASSERT_DOUBLES_EQUAL (0.4, m_Document->getZoom (), 0.0001); 
     665    CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
    605666     
    606     // Since rotation is now 90 the zoom level should be 75/250 = 0.3 
    607     m_MainPter->zoomFitActivated (); 
    608     CPPUNIT_ASSERT_DOUBLES_EQUAL (0.3, m_Document->getZoom (), 0.0001); 
    609     CPPUNIT_ASSERT (m_View->hasImagePageView ()); 
     667    // Changing any of the zoom in or zoom out features should make the  
     668    // zoom to fit not being active. 
     669    m_MainPter->zoomInActivated (); 
     670    CPPUNIT_ASSERT (!m_View->isZoomToFitActive ()); 
     671    m_MainPter->zoomFitActivated (TRUE); 
     672    m_MainPter->zoomOutActivated (); 
     673    CPPUNIT_ASSERT (!m_View->isZoomToFitActive ()); 
    610674} 
    611675 
     
    626690    m_MainPter->goToNextPageActivated (); 
    627691    m_MainPter->rotateRightActivated ();  
    628     m_MainPter->zoomWidthActivated (); 
     692    m_MainPter->zoomWidthActivated (TRUE); 
    629693    CPPUNIT_ASSERT_EQUAL (2, m_View->getCurrentPage ());  
    630694    CPPUNIT_ASSERT_EQUAL (90, m_Document->getRotation ());  
     
    662726    m_MainPter->goToNextPageActivated (); 
    663727    m_MainPter->rotateRightActivated ();  
    664     m_MainPter->zoomWidthActivated (); 
     728    m_MainPter->zoomWidthActivated (TRUE); 
    665729    CPPUNIT_ASSERT_EQUAL (2, m_View->getCurrentPage ());  
    666730    CPPUNIT_ASSERT_EQUAL (90, m_Document->getRotation ());  
     
    702766    m_MainPter->goToNextPageActivated (); 
    703767    m_MainPter->rotateRightActivated ();  
    704     m_MainPter->zoomWidthActivated (); 
     768    m_MainPter->zoomWidthActivated (TRUE); 
    705769    CPPUNIT_ASSERT_EQUAL (2, m_View->getCurrentPage ());  
    706770    CPPUNIT_ASSERT_EQUAL (90, m_Document->getRotation ());