summaryrefslogtreecommitdiffstats
path: root/Tests/UseWX/WX.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2003-10-13 20:04:24 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2003-10-13 20:04:24 (GMT)
commit97dd683836337c6f9c3a488ec6f42dfba28d750e (patch)
tree084b9a08a6c636cd7d67c62e9145b8d5bbd7247a /Tests/UseWX/WX.cxx
parentdb12c17017ec8b5af121fc1c75eec63003c5ef1d (diff)
downloadCMake-97dd683836337c6f9c3a488ec6f42dfba28d750e.zip
CMake-97dd683836337c6f9c3a488ec6f42dfba28d750e.tar.gz
CMake-97dd683836337c6f9c3a488ec6f42dfba28d750e.tar.bz2
ENH: Add test for FindwxWindows. Thanks to: Mathieu Malaterre
Diffstat (limited to 'Tests/UseWX/WX.cxx')
-rw-r--r--Tests/UseWX/WX.cxx78
1 files changed, 78 insertions, 0 deletions
diff --git a/Tests/UseWX/WX.cxx b/Tests/UseWX/WX.cxx
new file mode 100644
index 0000000..f8d8b20
--- /dev/null
+++ b/Tests/UseWX/WX.cxx
@@ -0,0 +1,78 @@
+//For wx
+#include <wx/app.h>
+#include <wx/dir.h>
+
+static void TestDirEnumHelper(wxDir& dir,
+ int flags = wxDIR_DEFAULT,
+ const wxString& filespec = wxEmptyString)
+{
+ wxString filename;
+
+ if ( !dir.IsOpened() )
+ return;
+
+ bool cont = dir.GetFirst(&filename, filespec, flags);
+ while ( cont )
+ {
+ wxPrintf(_T("\t%s\n"), filename.c_str());
+
+ cont = dir.GetNext(&filename);
+ }
+
+ wxPuts(_T(""));
+}
+
+
+//----------------------------------------------------------------------------
+// MyApp
+//----------------------------------------------------------------------------
+
+class MyApp: public wxApp
+{
+public:
+ MyApp();
+
+ bool OnInit();
+ int MainLoop();
+};
+
+
+IMPLEMENT_APP(MyApp)
+
+MyApp::MyApp()
+{
+}
+
+bool MyApp::OnInit()
+{
+ //test a directory that exist:
+ wxDir dir(wxT(".")); //wxDir dir("/tmp");
+ TestDirEnumHelper(dir, wxDIR_DEFAULT | wxDIR_DOTDOT);
+
+ //Testing if link to wx debug library
+#ifdef __WXDEBUG__
+ std::cout << "If you read this you're in debug mode." << std::endl;
+#endif //__WXDEBUG__
+
+ wxChar ch = wxT('*');
+ wxString s = wxT("Hello, world!");
+ int len = s.Len();
+ printf("Length of string is: %d\n", len);
+
+ //Force testing of Unicode mode
+#ifdef __UNICODE__
+ wprintf(L"Unicode: %s \n", s.c_str());
+ wprintf(:"Char: %c\n", ch);
+#else
+ printf("ANSI: %s \n", s.c_str());
+ printf("Char: %c\n", ch);
+#endif //__UNICODE__
+
+ //return immediately
+ return TRUE;
+}
+
+int MyApp::MainLoop()
+{
+ return 0;
+}