From 59dfa5518097138f1c1864cd3b6d7f5072572e74 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 22 Feb 2012 14:04:28 +0200 Subject: cppunittester hacks for iOS, intermediate commit For iOS cppunit plugins aren't really "plugins" (shared libraries), but just static archives. In the real main program of a cppunit app (such are not yet written), which calls the lo_main() (the SAL_IMPLEMENT_MAIN() in cppunittester.cxx) we specifically will call the initialize methods of the CppUnitTestPlugIns that we statically link to the app executable. Hopefully that will work out as expected. --- sal/cppunittester/cppunittester.cxx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'sal/cppunittester') diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx index d422613e5c19..a34ea6142a79 100644 --- a/sal/cppunittester/cppunittester.cxx +++ b/sal/cppunittester/cppunittester.cxx @@ -128,9 +128,17 @@ public: } bool run() const { +#ifdef IOS + // For iOS cppunit plugins aren't really "plugins" (shared + // libraries), but just static archives. In the real main + // program of a cppunit app, which calls the lo_main() that + // the SAL_IMPLEMENT_MAIN() below expands to, we specifically + // call the initialize methods of the CppUnitTestPlugIns that + // we statically link to the app executable. +#else CppUnit::PlugInManager manager; manager.load(testlib, args); - +#endif CppUnit::TestRunner runner; runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); @@ -198,10 +206,18 @@ SAL_IMPLEMENT_MAIN() { if (rtl_getAppCommandArgCount() - index < 3) { usageFailure(); } +#ifndef IOS rtl::OUString lib(getArgument(index + 1)); rtl::OUString sym(getArgument(index + 2)); modules.push_back(new osl::Module(lib, SAL_LOADMODULE_GLOBAL)); oslGenericFunction fn = modules.back().getFunctionSymbol(sym); +#else + // The only "protector" we ever use is the unoexceptionprotector... + // Oh the joys of over-engineering. + rtl::OUString lib(RTL_CONSTASCII_USTRINGPARAM("")); + rtl::OUString sym(RTL_CONSTASCII_USTRINGPARAM("unoexceptionprotector")); + oslGenericFunction fn = (oslGenericFunction) unoexceptionprotector; +#endif throw_protector = fn == 0 ? 0 : (*reinterpret_cast< cppunittester::ProtectorFactory * >(fn))(); -- cgit v1.2.3