]>
git.saurik.com Git - wxWidgets.git/blob - tests/testfile.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/testfile.h
3 // Purpose: TestFile class
4 // Author: Mike Wetherell
6 // Copyright: (c) 2005 Mike Wetherell
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_TESTS_TEMPFILE_H_
11 #define _WX_TESTS_TEMPFILE_H_
13 #include "wx/filefn.h"
14 #include "wx/filename.h"
18 // define stream inserter for wxFileName to use it in CPPUNIT_ASSERT_EQUAL()
19 inline std::ostream
& operator<<(std::ostream
& o
, const wxFileName
& fn
)
21 return o
<< fn
.GetFullPath();
24 // ----------------------------------------------------------------------------
25 // TestFile: self deleting test file in temporary directory
26 // ----------------------------------------------------------------------------
34 m_name
= wxFileName::CreateTempFileName(wxT("wxtest"), &file
);
35 file
.Write("Before", 6);
38 ~TestFile() { if (wxFileExists(m_name
)) wxRemoveFile(m_name
); }
39 wxString
GetName() const { return m_name
; }
45 #endif // _WX_TESTS_TEMPFILE_H_