]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/misc/dynamiclib.cpp
using button impl
[wxWidgets.git] / tests / misc / dynamiclib.cpp
index bf3335009948e1e465d379794a3f498319685a1c..55d443c5a97d776b0319b2b0e2eaf2f8c6fd8f6c 100644 (file)
 
 #include "wx/dynlib.h"
 
 
 #include "wx/dynlib.h"
 
+#ifdef __UNIX__
+    #include "wx/filename.h"
+    #include "wx/log.h"
+#endif
+
 // ----------------------------------------------------------------------------
 // test class
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // test class
 // ----------------------------------------------------------------------------
@@ -46,7 +51,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( DynamicLibraryTestCase, "DynamicLibraryTe
 
 void DynamicLibraryTestCase::Load()
 {
 
 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__)
     static const wxChar *LIB_NAME = wxT("kernel32.dll");
     static const wxChar *FUNC_NAME = wxT("lstrlenA");
 #elif defined(__UNIX__)
@@ -57,6 +62,13 @@ void DynamicLibraryTestCase::Load()
     static const wxChar *LIB_NAME = wxT("/lib/libc.so.6");
 #endif
     static const wxChar *FUNC_NAME = wxT("strlen");
     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
 #else
     #error "don't know how to test wxDllLoader on this platform"
 #endif
@@ -74,7 +86,7 @@ void DynamicLibraryTestCase::Load()
     // Call the function dynamically loaded
     CPPUNIT_ASSERT( pfnStrlen("foo") == 3 );
 
     // 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 *);
     static const wxChar *FUNC_NAME_AW = wxT("lstrlen");
 
     typedef int (wxSTDCALL *wxStrlenTypeAorW)(const wxChar *);
@@ -86,5 +98,5 @@ void DynamicLibraryTestCase::Load()
     CPPUNIT_ASSERT_MESSAGE( errMsg2.ToStdString(), pfnStrlenAorW );
 
     CPPUNIT_ASSERT( pfnStrlenAorW(wxT("foobar")) == 6 );
     CPPUNIT_ASSERT_MESSAGE( errMsg2.ToStdString(), pfnStrlenAorW );
 
     CPPUNIT_ASSERT( pfnStrlenAorW(wxT("foobar")) == 6 );
-#endif // __WXMSW__
+#endif // __WINDOWS__
 }
 }