]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/filename/filenametest.cpp
MinGW-w64 provides isfinite() in both 32 and 64 bit builds.
[wxWidgets.git] / tests / filename / filenametest.cpp
index 10ef920f39a018e345def4cf7073ca51d9f07881..f54e8e8376427298284fb80d277506465963d332 100644 (file)
@@ -3,7 +3,6 @@
 // Purpose:     wxFileName unit test
 // Author:      Vadim Zeitlin
 // Created:     2004-07-25
-// RCS-ID:      $Id$
 // Copyright:   (c) 2004 Vadim Zeitlin
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -35,6 +34,7 @@
 #endif // __UNIX__
 
 #include "testfile.h"
+#include "testdate.h"
 
 // ----------------------------------------------------------------------------
 // test data
@@ -139,6 +139,7 @@ private:
         CPPUNIT_TEST( TestVolumeUniqueName );
         CPPUNIT_TEST( TestCreateTempFileName );
         CPPUNIT_TEST( TestGetTimes );
+        CPPUNIT_TEST( TestSetTimes );
         CPPUNIT_TEST( TestExists );
         CPPUNIT_TEST( TestIsSame );
 #if defined(__UNIX__)
@@ -161,6 +162,7 @@ private:
     void TestVolumeUniqueName();
     void TestCreateTempFileName();
     void TestGetTimes();
+    void TestSetTimes();
     void TestExists();
     void TestIsSame();
 #if defined(__UNIX__)
@@ -664,6 +666,31 @@ void FileNameTestCase::TestGetTimes()
     CPPUNIT_ASSERT(dtAccess.IsEqualUpTo(wxDateTime::Now(), wxTimeSpan(0,1)));
 }
 
+void FileNameTestCase::TestSetTimes()
+{
+    wxFileName fn(wxFileName::CreateTempFileName("filenametest"));
+    CPPUNIT_ASSERT( fn.IsOk() );
+    wxON_BLOCK_EXIT1( wxRemoveFile, fn.GetFullPath() );
+
+    const wxDateTime dtAccess(1, wxDateTime::Jan, 2013);
+    const wxDateTime dtModify(1, wxDateTime::Feb, 2013);
+    const wxDateTime dtCreate(1, wxDateTime::Mar, 2013);
+
+    CPPUNIT_ASSERT( fn.SetTimes(&dtAccess, &dtModify, &dtCreate) );
+
+    wxDateTime dtAccess2,
+               dtModify2,
+               dtCreate2;
+    CPPUNIT_ASSERT( fn.GetTimes(&dtAccess2, &dtModify2, &dtCreate2) );
+    CPPUNIT_ASSERT_EQUAL( dtAccess, dtAccess2 );
+    CPPUNIT_ASSERT_EQUAL( dtModify, dtModify2 );
+
+    // Under Unix the creation time can't be set.
+#ifdef __WINDOWS__
+    CPPUNIT_ASSERT_EQUAL( dtCreate, dtCreate2 );
+#endif // __WINDOWS__
+}
+
 void FileNameTestCase::TestExists()
 {
     wxFileName fn(wxFileName::CreateTempFileName("filenametest"));