X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e3778b4d9c7eebc39f496a9dd055638e06fb9140..9e1da4827a0ec18f9766d664b9af12c25e3f71fb:/tests/misc/dynamiclib.cpp diff --git a/tests/misc/dynamiclib.cpp b/tests/misc/dynamiclib.cpp index bf33350099..55d443c5a9 100644 --- a/tests/misc/dynamiclib.cpp +++ b/tests/misc/dynamiclib.cpp @@ -19,6 +19,11 @@ #include "wx/dynlib.h" +#ifdef __UNIX__ + #include "wx/filename.h" + #include "wx/log.h" +#endif + // ---------------------------------------------------------------------------- // test class // ---------------------------------------------------------------------------- @@ -46,7 +51,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( DynamicLibraryTestCase, "DynamicLibraryTe 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 +62,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 +86,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 +98,5 @@ void DynamicLibraryTestCase::Load() CPPUNIT_ASSERT_MESSAGE( errMsg2.ToStdString(), pfnStrlenAorW ); CPPUNIT_ASSERT( pfnStrlenAorW(wxT("foobar")) == 6 ); -#endif // __WXMSW__ +#endif // __WINDOWS__ }