]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/file/filetest.cpp
paint events cannot be constructed outside a native redraw in OSX
[wxWidgets.git] / tests / file / filetest.cpp
index dc3c28669193ea4ca868f595493980eefee37f60..85e70ab8e6bf73f8e7116a807677e77549654fa0 100644 (file)
@@ -37,6 +37,7 @@ private:
         CPPUNIT_TEST( RoundTripUTF8 );
         CPPUNIT_TEST( RoundTripUTF16 );
         CPPUNIT_TEST( RoundTripUTF32 );
+        CPPUNIT_TEST( TempFile );
     CPPUNIT_TEST_SUITE_END();
 
     void RoundTripUTF8() { DoRoundTripTest(wxConvUTF8); }
@@ -44,6 +45,7 @@ private:
     void RoundTripUTF32() { DoRoundTripTest(wxMBConvUTF32()); }
 
     void DoRoundTripTest(const wxMBConv& conv);
+    void TempFile();
 
     wxDECLARE_NO_COPY_CLASS(FileTestCase);
 };
@@ -76,7 +78,7 @@ void FileTestCase::DoRoundTripTest(const wxMBConv& conv)
         wxFile fin(tf.GetName(), wxFile::read);
         CPPUNIT_ASSERT( fin.IsOpened() );
 
-        const wxFileOffset len = fin.Length();
+        const ssize_t len = fin.Length();
         wxCharBuffer buf(len);
         CPPUNIT_ASSERT_EQUAL( len, fin.Read(buf.data(), len) );
 
@@ -92,4 +94,12 @@ void FileTestCase::DoRoundTripTest(const wxMBConv& conv)
     }
 }
 
+void FileTestCase::TempFile()
+{
+    wxTempFile tmpFile;
+    CPPUNIT_ASSERT( tmpFile.Open(wxT("test2")) && tmpFile.Write(wxT("the answer is 42")) );
+    CPPUNIT_ASSERT( tmpFile.Commit() );
+    CPPUNIT_ASSERT( wxRemoveFile(wxT("test2")) );
+}
+
 #endif // wxUSE_FILE