Changeset 23

Show
Ignore:
Timestamp:
04/11/06 10:13:29 (3 years ago)
Author:
jordi
Message:

At last, I have the first presenter's test. At the previous commit I forgot to add the MainPter?.cxx and header filers. Are now included in this commit.

The first check just test that the initial state of the main window is what we expect (i.e., no document yet => all unsensitived).

Location:
trunk
Files:
3 added
8 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/Makefile.am

    r21 r23  
    1313    MainPter.cxx        \ 
    1414    MainPter.h          \ 
     15    MainView.h          \ 
    1516    PDFDocument.cxx     \ 
    1617    PDFDocument.h 
  • trunk/src/epdfview.h

    r21 r23  
    3131#include <PDFDocument.h> 
    3232 
     33#include <IMainView.h> 
    3334#include <MainPter.h> 
    3435 
  • trunk/tests/DumbDocument.cxx

    r21 r23  
    1616// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1717 
     18#include <epdfview.h> 
     19#include "DumbDocument.h" 
     20 
     21using namespace ePDFView; 
     22 
     23//////////////////////////////////////////////////////////////// 
     24// Interface Methods 
     25//////////////////////////////////////////////////////////////// 
     26 
     27DumbDocument::DumbDocument (): 
     28    IDocument () 
     29{ 
     30} 
     31 
     32DumbDocument::~DumbDocument () 
     33{ 
     34} 
     35 
     36gboolean 
     37DumbDocument::isLoaded () 
     38{ 
     39    return false; 
     40} 
     41 
     42gboolean 
     43DumbDocument::loadFile (const gchar *filename, const gchar *password,  
     44                        GError **error) 
     45{ 
     46    return false; 
     47} 
     48 
     49void 
     50DumbDocument::getPageSize (gdouble *width, gdouble *height) 
     51{ 
     52    *width = 10; 
     53    *height = 10; 
     54} 
     55 
     56DocumentPage * 
     57DumbDocument::renderPage () 
     58{ 
     59    return new DocumentPage (); 
     60} 
  • trunk/tests/DumbDocument.h

    r21 r23  
    2121namespace ePDFView 
    2222{ 
    23     class DumbDocument 
     23    class DumbDocument: public IDocument 
    2424    { 
     25        public: 
     26            DumbDocument (); 
     27            ~DumbDocument (); 
     28 
     29            // Interface methods. 
     30            gboolean isLoaded (void); 
     31            gboolean loadFile (const gchar *filename, const gchar *password, 
     32                               GError **error); 
     33            void getPageSize (gdouble *width, gdouble *height); 
     34            DocumentPage *renderPage (void); 
    2535    }; 
    2636} 
  • trunk/tests/DumbMainView.cxx

    r21 r23  
    1616// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1717 
     18#include <epdfview.h> 
     19#include "DumbMainView.h" 
     20 
     21using namespace ePDFView; 
     22 
     23//////////////////////////////////////////////////////////////// 
     24// Interface Methods 
     25//////////////////////////////////////////////////////////////// 
     26DumbMainView::DumbMainView (MainPter *pter): 
     27    IMainView (pter) 
     28{ 
     29    // This won't be deleted because it's presenter responsability. 
     30    m_DocumentPage = NULL; 
     31    m_SensitiveGoToFirstPage = TRUE; 
     32    m_SensitiveGoToLastPage = TRUE; 
     33    m_SensitiveGoToNextPage = TRUE; 
     34    m_SensitiveGoToPage = TRUE; 
     35    m_SensitiveGoToPreviousPage = TRUE; 
     36    m_SensitiveZoomIn = TRUE; 
     37    m_SensitiveZoomOut = TRUE; 
     38    m_SensitiveZoomFit = TRUE; 
     39    m_SensitiveZoomWidth = TRUE; 
     40    m_Shown = FALSE; 
     41    m_Title = g_strdup (""); 
     42} 
     43 
     44DumbMainView::~DumbMainView () 
     45{ 
     46    g_free (m_Title); 
     47} 
     48 
     49void 
     50DumbMainView::sensitiveGoToFirstPage (gboolean sensitive) 
     51{ 
     52    m_SensitiveGoToFirstPage = sensitive; 
     53} 
     54 
     55void 
     56DumbMainView::sensitiveGoToLastPage (gboolean sensitive) 
     57{ 
     58    m_SensitiveGoToLastPage = sensitive; 
     59} 
     60 
     61void 
     62DumbMainView::sensitiveGoToNextPage (gboolean sensitive) 
     63{ 
     64    m_SensitiveGoToNextPage = sensitive; 
     65} 
     66 
     67void 
     68DumbMainView::sensitiveGoToPage (gboolean sensitive) 
     69{ 
     70    m_SensitiveGoToPage = sensitive; 
     71} 
     72 
     73void 
     74DumbMainView::sensitiveGoToPreviousPage (gboolean sensitive) 
     75{ 
     76    m_SensitiveGoToPreviousPage = sensitive; 
     77} 
     78 
     79void 
     80DumbMainView::sensitiveZoomIn (gboolean sensitive) 
     81{ 
     82    m_SensitiveZoomIn = sensitive; 
     83} 
     84 
     85void 
     86DumbMainView::sensitiveZoomOut (gboolean sensitive) 
     87{ 
     88    m_SensitiveZoomOut = sensitive; 
     89} 
     90 
     91void 
     92DumbMainView::sensitiveZoomFit (gboolean sensitive) 
     93{ 
     94    m_SensitiveZoomFit = sensitive; 
     95} 
     96 
     97void 
     98DumbMainView::sensitiveZoomWidth (gboolean sensitive) 
     99{ 
     100    m_SensitiveZoomWidth = sensitive; 
     101} 
     102 
     103void 
     104DumbMainView::show (void) 
     105{ 
     106    m_Shown = TRUE; 
     107} 
     108 
     109void 
     110DumbMainView::setTitle (const gchar *title) 
     111{ 
     112    g_free (m_Title); 
     113    m_Title = g_strdup (title); 
     114} 
     115 
     116 
     117//////////////////////////////////////////////////////////////// 
     118// Test Methods 
     119//////////////////////////////////////////////////////////////// 
     120 
     121gboolean 
     122DumbMainView::isShown () 
     123{ 
     124    return m_Shown; 
     125} 
     126 
     127const gchar * 
     128DumbMainView::getTitle () 
     129{ 
     130    return m_Title; 
     131} 
     132 
     133gboolean 
     134DumbMainView::isSensitiveGoToFirstPage () 
     135{ 
     136    return m_SensitiveGoToFirstPage; 
     137} 
     138 
     139gboolean 
     140DumbMainView::isSensitiveGoToLastPage () 
     141{ 
     142    return m_SensitiveGoToLastPage; 
     143} 
     144 
     145gboolean 
     146DumbMainView::isSensitiveGoToNextPage () 
     147{ 
     148    return m_SensitiveGoToNextPage; 
     149} 
     150 
     151gboolean 
     152DumbMainView::isSensitiveGoToPage () 
     153{ 
     154    return m_SensitiveGoToPage; 
     155} 
     156 
     157gboolean 
     158DumbMainView::isSensitiveGoToPreviousPage () 
     159{ 
     160    return m_SensitiveGoToPreviousPage; 
     161} 
     162 
     163gboolean 
     164DumbMainView::isSensitiveZoomIn () 
     165{ 
     166    return m_SensitiveZoomIn; 
     167} 
     168 
     169gboolean 
     170DumbMainView::isSensitiveZoomOut () 
     171{ 
     172    return m_SensitiveZoomOut; 
     173} 
     174 
     175gboolean 
     176DumbMainView::isSensitiveZoomFit () 
     177{ 
     178    return m_SensitiveZoomFit; 
     179} 
     180 
     181gboolean 
     182DumbMainView::isSensitiveZoomWidth () 
     183{ 
     184    return m_SensitiveZoomWidth; 
     185} 
     186 
     187gboolean 
     188DumbMainView::hasImagePageView () 
     189{ 
     190    return NULL != m_DocumentPage; 
     191} 
  • trunk/tests/DumbMainView.h

    r21 r23  
    2121namespace ePDFView  
    2222{ 
    23     class DumbMainView 
     23    class DumbMainView: public IMainView 
    2424    { 
     25        public: 
     26            // Interface methods. 
     27            DumbMainView (MainPter *pter); 
     28            ~DumbMainView (); 
     29 
     30            void sensitiveGoToFirstPage (gboolean sensitive); 
     31            void sensitiveGoToLastPage (gboolean sensitive); 
     32            void sensitiveGoToNextPage (gboolean sensitive); 
     33            void sensitiveGoToPage (gboolean sensitive); 
     34            void sensitiveGoToPreviousPage (gboolean sensitive); 
     35            void sensitiveZoomIn (gboolean sensitive); 
     36            void sensitiveZoomOut (gboolean sensitive); 
     37            void sensitiveZoomFit (gboolean sensitive); 
     38            void sensitiveZoomWidth (gboolean sensitive); 
     39            void show (void);  
     40            void setTitle (const gchar *title); 
     41 
     42            // Methods for test purposes. 
     43            const gchar *getTitle (void); 
     44            gboolean isShown (void); 
     45            gboolean isSensitiveGoToFirstPage (void); 
     46            gboolean isSensitiveGoToLastPage (void); 
     47            gboolean isSensitiveGoToNextPage (void); 
     48            gboolean isSensitiveGoToPage (void); 
     49            gboolean isSensitiveGoToPreviousPage (void); 
     50            gboolean isSensitiveZoomIn (void);         
     51            gboolean isSensitiveZoomOut (void); 
     52            gboolean isSensitiveZoomFit (void); 
     53            gboolean isSensitiveZoomWidth (void); 
     54            gboolean hasImagePageView (void); 
     55 
     56        protected: 
     57            DocumentPage *m_DocumentPage; 
     58            gboolean m_SensitiveGoToFirstPage; 
     59            gboolean m_SensitiveGoToLastPage; 
     60            gboolean m_SensitiveGoToNextPage; 
     61            gboolean m_SensitiveGoToPage; 
     62            gboolean m_SensitiveGoToPreviousPage; 
     63            gboolean m_SensitiveZoomIn; 
     64            gboolean m_SensitiveZoomOut; 
     65            gboolean m_SensitiveZoomFit; 
     66            gboolean m_SensitiveZoomWidth; 
     67            gboolean m_Shown; 
     68            gchar *m_Title; 
    2569    }; 
    2670} 
  • trunk/tests/MainPterTest.cxx

    r21 r23  
    3232MainPterTest::setUp () 
    3333{ 
    34 /*    m_Document = new DumbDocument (); 
     34    m_Document = new DumbDocument (); 
    3535    m_MainPter = new MainPter (m_Document); 
    3636    m_View = new DumbMainView (m_MainPter); 
    37     m_MainPter->setView (m_View);*/ 
     37    m_MainPter->setView (m_View); 
    3838} 
    3939 
     
    6060MainPterTest::initialStatus () 
    6161{ 
    62 /*    CPPUNIT_ASSERT ( m_View->isShown () ); 
     62    CPPUNIT_ASSERT ( m_View->isShown () ); 
    6363    CPPUNIT_ASSERT_EQUAL (0,  
    6464            g_ascii_strcasecmp ("PDF Viewer", m_View->getTitle ())); 
     
    7272    CPPUNIT_ASSERT (!m_View->isSensitiveZoomFit ()); 
    7373    CPPUNIT_ASSERT (!m_View->isSensitiveZoomWidth ()); 
    74     CPPUNIT_ASSERT (!m_View->hasImagePageView ()); */ 
     74    CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 
    7575} 
  • trunk/tests/MainPterTest.h

    r21 r23  
    3636 
    3737        private: 
    38 /*            DumbMainView *m_View; 
     38            DumbMainView *m_View; 
    3939            DumbDocument *m_Document; 
    40             MainPter *m_MainPter;            */ 
     40            MainPter *m_MainPter; 
    4141    }; 
    4242}