]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/console/console.cpp
Reverting my first test commit, as per ABX request
[wxWidgets.git] / samples / console / console.cpp
index 65eacb745989039d561ed420ba449b90c09a0954..7f0b545c80ea9972e139d886c9e12d3a0b329b46 100644 (file)
@@ -65,6 +65,7 @@
     #define TEST_LOCALE
     #define TEST_LOG
     #define TEST_MIME
+    #define TEST_MODULE
     #define TEST_PATHLIST
     #define TEST_ODBC
     #define TEST_PRINTF
@@ -85,7 +86,7 @@
     #define TEST_WCHAR
     #define TEST_ZIP
 #else // #if TEST_ALL
-    #define TEST_DYNLIB
+    #define TEST_MODULE
 #endif
 
 // some tests are interactive, define this to run them
@@ -201,7 +202,7 @@ static void TestCmdLineConvert()
 #ifdef __UNIX__
     static const wxChar *ROOTDIR = _T("/");
     static const wxChar *TESTDIR = _T("/usr/local/share");
-#elif defined(__WXMSW__)
+#elif defined(__WXMSW__) || defined(__DOS__) || defined(__OS2__)
     static const wxChar *ROOTDIR = _T("c:\\");
     static const wxChar *TESTDIR = _T("d:\\");
 #else
@@ -228,6 +229,8 @@ static void TestDirEnumHelper(wxDir& dir,
     wxPuts(wxEmptyString);
 }
 
+#if TEST_ALL
+
 static void TestDirEnum()
 {
     wxPuts(_T("*** Testing wxDir::GetFirst/GetNext ***"));
@@ -283,6 +286,8 @@ static void TestDirEnum()
     TestDirEnumHelper(dirNo);
 }
 
+#endif // TEST_ALL
+
 class DirPrintTraverser : public wxDirTraverser
 {
 public:
@@ -333,6 +338,8 @@ static void TestDirTraverse()
     dir.Traverse(traverser, wxEmptyString, wxDIR_DIRS | wxDIR_HIDDEN);
 }
 
+#if TEST_ALL
+
 static void TestDirExists()
 {
     wxPuts(_T("*** Testing wxDir::Exists() ***"));
@@ -366,6 +373,8 @@ static void TestDirExists()
     }
 }
 
+#endif // TEST_ALL
+
 #endif // TEST_DIR
 
 // ----------------------------------------------------------------------------
@@ -889,8 +898,8 @@ static void TestFileNameCwd()
 
 #ifdef TEST_FILETIME
 
-#include <wx/filename.h>
-#include <wx/datetime.h>
+#include "wx/filename.h"
+#include "wx/datetime.h"
 
 static void TestFileGetTimes()
 {
@@ -1373,6 +1382,80 @@ static void TestMimeAssociate()
 
 #endif // TEST_MIME
 
+// ----------------------------------------------------------------------------
+// module dependencies feature
+// ----------------------------------------------------------------------------
+
+#ifdef TEST_MODULE
+
+#include "wx/module.h"
+
+class wxTestModule : public wxModule
+{
+protected:
+    virtual bool OnInit() { wxPrintf(_T("Load module: %s\n"), GetClassInfo()->GetClassName()); return true; }
+    virtual void OnExit() { wxPrintf(_T("Unload module: %s\n"), GetClassInfo()->GetClassName()); }
+};
+
+class wxTestModuleA : public wxTestModule
+{
+public:
+    wxTestModuleA();
+private:
+    DECLARE_DYNAMIC_CLASS(wxTestModuleA)
+};
+
+class wxTestModuleB : public wxTestModule
+{
+public:
+    wxTestModuleB();
+private:
+    DECLARE_DYNAMIC_CLASS(wxTestModuleB)
+};
+
+class wxTestModuleC : public wxTestModule
+{
+public:
+    wxTestModuleC();
+private:
+    DECLARE_DYNAMIC_CLASS(wxTestModuleC)
+};
+
+class wxTestModuleD : public wxTestModule
+{
+public:
+    wxTestModuleD();
+private:
+    DECLARE_DYNAMIC_CLASS(wxTestModuleD)
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxTestModuleC, wxModule)
+wxTestModuleC::wxTestModuleC()
+{
+    AddDependency(CLASSINFO(wxTestModuleD));
+}
+
+IMPLEMENT_DYNAMIC_CLASS(wxTestModuleA, wxModule)
+wxTestModuleA::wxTestModuleA()
+{
+    AddDependency(CLASSINFO(wxTestModuleB));
+    AddDependency(CLASSINFO(wxTestModuleD));
+}
+
+IMPLEMENT_DYNAMIC_CLASS(wxTestModuleD, wxModule)
+wxTestModuleD::wxTestModuleD()
+{
+}
+
+IMPLEMENT_DYNAMIC_CLASS(wxTestModuleB, wxModule)
+wxTestModuleB::wxTestModuleB()
+{
+    AddDependency(CLASSINFO(wxTestModuleD));
+    AddDependency(CLASSINFO(wxTestModuleC));
+}
+
+#endif // TEST_MODULE
+
 // ----------------------------------------------------------------------------
 // misc information functions
 // ----------------------------------------------------------------------------
@@ -1546,7 +1629,7 @@ static void TestRegExInteractive()
 
 #ifdef TEST_ODBC
 
-#include <wx/db.h>
+#include "wx/db.h"
 
 static void TestDbOpen()
 {
@@ -2105,9 +2188,9 @@ static void TestScopeGuard()
     wxON_BLOCK_EXIT2(function2, 3.14, 'p');
 
     Object obj;
-    wxON_BLOCK_EXIT_OBJ0(obj, &Object::method0);
-    wxON_BLOCK_EXIT_OBJ1(obj, &Object::method1, 7);
-    wxON_BLOCK_EXIT_OBJ2(obj, &Object::method2, 2.71, 'e');
+    wxON_BLOCK_EXIT_OBJ0(obj, Object::method0);
+    wxON_BLOCK_EXIT_OBJ1(obj, Object::method1, 7);
+    wxON_BLOCK_EXIT_OBJ2(obj, Object::method2, 2.71, 'e');
 
     wxScopeGuard dismissed = wxMakeGuard(function0);
     dismissed.Dismiss();
@@ -2676,7 +2759,17 @@ static void TestStandardPaths()
     wxPrintf(_T("Data dir (sys local):\t%s\n"), stdp.GetLocalDataDir().c_str());
     wxPrintf(_T("Data dir (user):\t%s\n"), stdp.GetUserDataDir().c_str());
     wxPrintf(_T("Data dir (user local):\t%s\n"), stdp.GetUserLocalDataDir().c_str());
+    wxPrintf(_T("Documents dir:\t\t%s\n"), stdp.GetDocumentsDir().c_str());
     wxPrintf(_T("Plugins dir:\t\t%s\n"), stdp.GetPluginsDir().c_str());
+    wxPrintf(_T("Resources dir:\t\t%s\n"), stdp.GetResourcesDir().c_str());
+    wxPrintf(_T("Localized res. dir:\t%s\n"),
+             stdp.GetLocalizedResourcesDir(_T("fr")).c_str());
+    wxPrintf(_T("Message catalogs dir:\t%s\n"),
+             stdp.GetLocalizedResourcesDir
+                  (
+                    _T("fr"),
+                    wxStandardPaths::ResourceCat_Messages
+                  ).c_str());
 }
 
 #endif // TEST_STDPATHS
@@ -4385,4 +4478,3 @@ int main(int argc, char **argv)
     wxUnusedVar(argv);
     return 0;
 }
-