]> git.saurik.com Git - wxWidgets.git/blame_incremental - tests/misc/pathlist.cpp
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / tests / misc / pathlist.cpp
... / ...
CommitLineData
1///////////////////////////////////////////////////////////////////////////////
2// Name: tests/misc/pathlist.cpp
3// Purpose: Test wxPathList
4// Author: Francesco Montorsi (extracted from console sample)
5// Created: 2010-06-02
6// Copyright: (c) 2010 wxWidgets team
7///////////////////////////////////////////////////////////////////////////////
8
9// ----------------------------------------------------------------------------
10// headers
11// ----------------------------------------------------------------------------
12
13#include "testprec.h"
14
15#ifdef __BORLANDC__
16# pragma hdrstop
17#endif
18
19#include "wx/filefn.h"
20
21// ----------------------------------------------------------------------------
22// test class
23// ----------------------------------------------------------------------------
24
25class PathListTestCase : public CppUnit::TestCase
26{
27public:
28 PathListTestCase() { }
29
30private:
31 CPPUNIT_TEST_SUITE( PathListTestCase );
32 CPPUNIT_TEST( FindValidPath );
33 CPPUNIT_TEST_SUITE_END();
34
35 void FindValidPath();
36
37 DECLARE_NO_COPY_CLASS(PathListTestCase)
38};
39
40// register in the unnamed registry so that these tests are run by default
41CPPUNIT_TEST_SUITE_REGISTRATION( PathListTestCase );
42
43// also include in its own registry so that these tests can be run alone
44CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( PathListTestCase, "PathListTestCase" );
45
46void PathListTestCase::FindValidPath()
47{
48#ifdef __UNIX__
49 #define CMD_IN_PATH wxT("ls")
50#else
51 #define CMD_IN_PATH wxT("cmd.exe")
52#endif
53
54 wxPathList pathlist;
55 pathlist.AddEnvList(wxT("PATH"));
56
57 wxString path = pathlist.FindValidPath(CMD_IN_PATH);
58 CPPUNIT_ASSERT( !path.empty() );
59}
60
61