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