]> git.saurik.com Git - wxWidgets.git/blame - tests/testfile.h
Fix configure check for gcc atomics on 32-bit x86.
[wxWidgets.git] / tests / testfile.h
CommitLineData
caa96da7
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: tests/testfile.h
3// Purpose: TestFile class
4// Author: Mike Wetherell
caa96da7 5// Copyright: (c) 2005 Mike Wetherell
526954c5 6// Licence: wxWindows licence
caa96da7
VZ
7///////////////////////////////////////////////////////////////////////////////
8
9#ifndef _WX_TESTS_TEMPFILE_H_
10#define _WX_TESTS_TEMPFILE_H_
11
12#include "wx/filefn.h"
13#include "wx/filename.h"
14
40152925
VZ
15#include <ostream>
16
17// define stream inserter for wxFileName to use it in CPPUNIT_ASSERT_EQUAL()
18inline std::ostream& operator<<(std::ostream& o, const wxFileName& fn)
19{
20 return o << fn.GetFullPath();
21}
22
caa96da7
VZ
23// ----------------------------------------------------------------------------
24// TestFile: self deleting test file in temporary directory
25// ----------------------------------------------------------------------------
26
27class TestFile
28{
29public:
30 TestFile()
31 {
32 wxFile file;
33 m_name = wxFileName::CreateTempFileName(wxT("wxtest"), &file);
34 file.Write("Before", 6);
35 }
36
37 ~TestFile() { if (wxFileExists(m_name)) wxRemoveFile(m_name); }
38 wxString GetName() const { return m_name; }
39
40private:
41 wxString m_name;
42};
43
44#endif // _WX_TESTS_TEMPFILE_H_
45