#include "wx/file.h"
#include "wx/app.h"
#include "wx/log.h"
+#include "wx/apptrait.h"
+#include "wx/platinfo.h"
// without this pragma, the stupid compiler precompiles #defines below so that
// changing them doesn't "take place" later!
#define TEST_LOCALE
#define TEST_LOG
#define TEST_MIME
+ #define TEST_MODULE
#define TEST_PATHLIST
#define TEST_ODBC
#define TEST_PRINTF
#define TEST_WCHAR
#define TEST_ZIP
#else // #if TEST_ALL
- #define TEST_STDPATHS
+ #define TEST_INFO_FUNCTIONS
#endif
// some tests are interactive, define this to run them
#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
// ----------------------------------------------------------------------------
wxPrintf(_T("Running under: %s, version %d.%d\n"),
wxGetOsDescription().c_str(), major, minor);
- wxPrintf(_T("%ld free bytes of memory left.\n"), wxGetFreeMemory());
+ wxPrintf(_T("%ld free bytes of memory left.\n"), wxGetFreeMemory().ToLong());
wxPrintf(_T("Host name is %s (%s).\n"),
wxGetHostName().c_str(), wxGetFullHostName().c_str());
wxPuts(wxEmptyString);
}
+static void TestPlatformInfo()
+{
+ wxPuts(_T("*** Testing wxPlatformInfo functions ***\n"));
+
+ // get this platform
+ wxPlatformInfo plat;
+
+ wxPrintf(_T("Operating system family name is: %s\n"), plat.GetOperatingSystemFamilyName().c_str());
+ wxPrintf(_T("Operating system name is: %s\n"), plat.GetOperatingSystemIdName().c_str());
+ wxPrintf(_T("Port ID name is: %s\n"), plat.GetPortIdName().c_str());
+ wxPrintf(_T("Port ID short name is: %s\n"), plat.GetPortIdShortName().c_str());
+ wxPrintf(_T("Architecture is: %s\n"), plat.GetArchName().c_str());
+ wxPrintf(_T("Endianness is: %s\n"), plat.GetEndiannessName().c_str());
+
+ wxPuts(wxEmptyString);
+}
+
static void TestUserInfo()
{
wxPuts(_T("*** Testing user info functions ***\n"));
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"),
#endif // TEST_MIME
#ifdef TEST_INFO_FUNCTIONS
- #if TEST_ALL
- TestOsInfo();
- TestUserInfo();
+ TestOsInfo();
+ TestPlatformInfo();
+ TestUserInfo();
- #if TEST_INTERACTIVE
- TestDiskInfo();
- #endif
+ #if TEST_INTERACTIVE
+ TestDiskInfo();
#endif
#endif // TEST_INFO_FUNCTIONS