]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/misc/dynamiclib.cpp
Fix horizontal mouse wheel scrolling in wxGTK.
[wxWidgets.git] / tests / misc / dynamiclib.cpp
index 4fedd6bed0e9ebc78804201b19a556be3547e45f..af9ca06a00bc7b16510d6c40c09c0808e1cd3915 100644 (file)
@@ -3,7 +3,6 @@
 // Purpose:     Test wxDynamicLibrary
 // Author:      Francesco Montorsi (extracted from console sample)
 // Created:     2010-06-13
-// RCS-ID:      $Id$
 // Copyright:   (c) 2010 wxWidgets team
 ///////////////////////////////////////////////////////////////////////////////
 
 
 #include "wx/dynlib.h"
 
+#ifdef __UNIX__
+    #include "wx/filename.h"
+    #include "wx/log.h"
+#endif
+
 // ----------------------------------------------------------------------------
 // test class
 // ----------------------------------------------------------------------------
@@ -41,12 +45,12 @@ private:
 // register in the unnamed registry so that these tests are run by default
 CPPUNIT_TEST_SUITE_REGISTRATION( DynamicLibraryTestCase );
 
-// also include in it's own registry so that these tests can be run alone
+// also include in its own registry so that these tests can be run alone
 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( DynamicLibraryTestCase, "DynamicLibraryTestCase" );
 
 void DynamicLibraryTestCase::Load()
 {
-#if defined(__WXMSW__)
+#if defined(__WINDOWS__)
     static const wxChar *LIB_NAME = wxT("kernel32.dll");
     static const wxChar *FUNC_NAME = wxT("lstrlenA");
 #elif defined(__UNIX__)
@@ -57,6 +61,13 @@ void DynamicLibraryTestCase::Load()
     static const wxChar *LIB_NAME = wxT("/lib/libc.so.6");
 #endif
     static const wxChar *FUNC_NAME = wxT("strlen");
+
+    if ( !wxFileName::Exists(LIB_NAME) )
+    {
+        wxLogWarning("Shared library \"%s\" doesn't exist, "
+                     "skipping DynamicLibraryTestCase::Load() test.");
+        return;
+    }
 #else
     #error "don't know how to test wxDllLoader on this platform"
 #endif
@@ -74,7 +85,7 @@ void DynamicLibraryTestCase::Load()
     // Call the function dynamically loaded
     CPPUNIT_ASSERT( pfnStrlen("foo") == 3 );
 
-#ifdef __WXMSW__
+#ifdef __WINDOWS__
     static const wxChar *FUNC_NAME_AW = wxT("lstrlen");
 
     typedef int (wxSTDCALL *wxStrlenTypeAorW)(const wxChar *);
@@ -86,5 +97,5 @@ void DynamicLibraryTestCase::Load()
     CPPUNIT_ASSERT_MESSAGE( errMsg2.ToStdString(), pfnStrlenAorW );
 
     CPPUNIT_ASSERT( pfnStrlenAorW(wxT("foobar")) == 6 );
-#endif // __WXMSW__
+#endif // __WINDOWS__
 }