Changeset 25
- Timestamp:
- 04/11/06 11:16:59 (2 years ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
src/MainPter.cxx (modified) (1 diff)
-
tests/DumbMainView.cxx (modified) (1 diff)
-
tests/MainPterTest.cxx (modified) (1 diff)
-
tests/MainPterTest.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/MainPter.cxx
r24 r25 142 142 IMainView &view = getView (); 143 143 gchar *fileName = view.openFileDialog (); 144 GError *error; 145 if ( m_Document->loadFile (fileName, NULL, &error) ) 144 // if openFileDialog returns NULL, then the user cancelled the operation. 145 // I don't need to do anything in this case. I'm only interested when 146 // the user tried to open a file. 147 if ( NULL != fileName ) 146 148 { 147 // Now that the document has been loaded, just reset the initial 148 // state. 149 setInitialState (); 150 g_free (fileName); 149 GError *error; 150 if ( m_Document->loadFile (fileName, NULL, &error) ) 151 { 152 // Now that the document has been loaded, just reset the initial 153 // state. 154 setInitialState (); 155 g_free (fileName); 156 } 151 157 } 152 158 } -
trunk/tests/DumbMainView.cxx
r24 r25 209 209 { 210 210 g_free (m_OpenFileName); 211 m_OpenFileName = g_strdup (fileName); 212 } 211 m_OpenFileName = NULL; 212 if ( NULL != fileName ) 213 { 214 m_OpenFileName = g_strdup (fileName); 215 } 216 } -
trunk/tests/MainPterTest.cxx
r24 r25 117 117 CPPUNIT_ASSERT (m_View->hasImagePageView ()); 118 118 } 119 120 /// 121 /// @brief Tests a cancelled open file. 122 /// 123 /// When the user cancels the open dialog, then nothing should change. 124 /// 125 void 126 MainPterTest::loadCancelled () 127 { 128 // returning a NULL file name is what will happen when cancel. 129 m_View->setOpenFileName (NULL); 130 m_MainPter->openFileActivated (); 131 CPPUNIT_ASSERT_EQUAL (0, 132 g_ascii_strcasecmp ("PDF Viewer", m_View->getTitle ())); 133 CPPUNIT_ASSERT (!m_View->isSensitiveGoToFirstPage ()); 134 CPPUNIT_ASSERT (!m_View->isSensitiveGoToLastPage ()); 135 CPPUNIT_ASSERT (!m_View->isSensitiveGoToNextPage ()); 136 CPPUNIT_ASSERT (!m_View->isSensitiveGoToPage ()); 137 CPPUNIT_ASSERT (!m_View->isSensitiveGoToPreviousPage ()); 138 CPPUNIT_ASSERT (!m_View->isSensitiveZoomIn ()); 139 CPPUNIT_ASSERT (!m_View->isSensitiveZoomOut ()); 140 CPPUNIT_ASSERT (!m_View->isSensitiveZoomFit ()); 141 CPPUNIT_ASSERT (!m_View->isSensitiveZoomWidth ()); 142 CPPUNIT_ASSERT (!m_View->hasImagePageView ()); 143 } -
trunk/tests/MainPterTest.h
r24 r25 28 28 CPPUNIT_TEST (initialStatus); 29 29 CPPUNIT_TEST (loadDocument); 30 CPPUNIT_TEST (loadCancelled); 30 31 CPPUNIT_TEST_SUITE_END(); 31 32 … … 36 37 void initialStatus (void); 37 38 void loadDocument (void); 39 void loadCancelled (void); 38 40 39 41 private:
