]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/filename/filenametest.cpp
made wxCommandEvent::GetInt() return int, not long (patch 1473771)
[wxWidgets.git] / tests / filename / filenametest.cpp
index 2ce261d7164f82a175ad7c0f796407eb772194dc..11c98c33b326f0bd135a2816fcfa9f93ec0856be 100644 (file)
@@ -86,15 +86,23 @@ public:
 private:
     CPPUNIT_TEST_SUITE( FileNameTestCase );
         CPPUNIT_TEST( TestConstruction );
+        CPPUNIT_TEST( TestComparison );
         CPPUNIT_TEST( TestSplit );
         CPPUNIT_TEST( TestSetPath );
         CPPUNIT_TEST( TestStrip );
+#ifdef __WINDOWS__
+        CPPUNIT_TEST( TestShortLongPath );
+#endif // __WINDOWS__
     CPPUNIT_TEST_SUITE_END();
 
     void TestConstruction();
+    void TestComparison();
     void TestSplit();
     void TestSetPath();
     void TestStrip();
+#ifdef __WINDOWS__
+    void TestShortLongPath();
+#endif // __WINDOWS__
 
     DECLARE_NO_COPY_CLASS(FileNameTestCase)
 };
@@ -134,6 +142,13 @@ void FileNameTestCase::TestConstruction()
     }
 }
 
+void FileNameTestCase::TestComparison()
+{
+    wxFileName fn1(wxT("/tmp"));
+    wxFileName fn2(wxT("/tmp/"));
+    assert(fn1.SameAs(fn2));
+}
+
 void FileNameTestCase::TestSplit()
 {
     for ( size_t n = 0; n < WXSIZEOF(filenames); n++ )
@@ -148,6 +163,10 @@ void FileNameTestCase::TestSplit()
         CPPUNIT_ASSERT( name == fni.name );
         CPPUNIT_ASSERT( ext == fni.ext );
     }
+
+    // special case of empty extension
+    wxFileName fn(_T("foo."));
+    CPPUNIT_ASSERT( fn.GetFullPath() == _T("foo.") );
 }
 
 void FileNameTestCase::TestSetPath()
@@ -178,3 +197,17 @@ void FileNameTestCase::TestStrip()
     CPPUNIT_ASSERT( wxTestStripExtension( _T("good.wav") ) == _T("good") );
     CPPUNIT_ASSERT( wxTestStripExtension( _T("good.wav.wav") ) == _T("good.wav") );
 }
+
+#ifdef __WINDOWS__
+
+void FileNameTestCase::TestShortLongPath()
+{
+    wxFileName fn(_T("C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe"));
+
+    // incredibly enough, GetLongPath() used to return different results during
+    // the first and subsequent runs, test for this
+    CPPUNIT_ASSERT_EQUAL( fn.GetLongPath(), fn.GetLongPath() );
+    CPPUNIT_ASSERT_EQUAL( fn.GetShortPath(), fn.GetShortPath() );
+}
+
+#endif // __WINDOWS__