]> git.saurik.com Git - wxWidgets.git/blob - tests/testfile.h
Merged GSOC Ribbon work from SOC2009_RIBBON branch into trunk.
[wxWidgets.git] / tests / testfile.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/testfile.h
3 // Purpose: TestFile class
4 // Author: Mike Wetherell
5 // RCS-ID: $Id$
6 // Copyright: (c) 2005 Mike Wetherell
7 // Licence: wxWidgets licence
8 ///////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_TESTS_TEMPFILE_H_
11 #define _WX_TESTS_TEMPFILE_H_
12
13 #include "wx/filefn.h"
14 #include "wx/filename.h"
15
16 // ----------------------------------------------------------------------------
17 // TestFile: self deleting test file in temporary directory
18 // ----------------------------------------------------------------------------
19
20 class TestFile
21 {
22 public:
23 TestFile()
24 {
25 wxFile file;
26 m_name = wxFileName::CreateTempFileName(wxT("wxtest"), &file);
27 file.Write("Before", 6);
28 }
29
30 ~TestFile() { if (wxFileExists(m_name)) wxRemoveFile(m_name); }
31 wxString GetName() const { return m_name; }
32
33 private:
34 wxString m_name;
35 };
36
37 #endif // _WX_TESTS_TEMPFILE_H_
38