diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-11-13 23:50:48 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-11-14 10:15:16 +0100 |
commit | 2a6976dfa90adcf9390713a6dcb5bc5e2679c3b4 (patch) | |
tree | 813962e5f6ebb396d5327cf018e928e46fe61f2c /basic | |
parent | 1b3e9bcdfa0376c29685be9ab8a838aa61af9814 (diff) |
-Werror,-Wunused-member-function
Change-Id: I32e4a80e99885c561a30e8f059c9b9a24c4bd3c7
Diffstat (limited to 'basic')
-rw-r--r-- | basic/qa/cppunit/test_vba.cxx | 58 |
1 files changed, 24 insertions, 34 deletions
diff --git a/basic/qa/cppunit/test_vba.cxx b/basic/qa/cppunit/test_vba.cxx index cf047907f657..94637f380858 100644 --- a/basic/qa/cppunit/test_vba.cxx +++ b/basic/qa/cppunit/test_vba.cxx @@ -17,7 +17,6 @@ namespace class VBATest : public test::BootstrapFixture { - bool hasOLEEnv(); public: VBATest() : BootstrapFixture(true, false) {} ~VBATest(){} @@ -28,44 +27,13 @@ namespace // Declares the method as a test to call CPPUNIT_TEST(testMiscVBAFunctions); -// not much point even trying to run except on windows -#if defined(WNT) CPPUNIT_TEST(testMiscOLEStuff); -#endif // End of test suite definition CPPUNIT_TEST_SUITE_END(); }; -bool VBATest::hasOLEEnv() -{ - // test if we have the necessary runtime environment - // to run the OLE tests. - static uno::Reference< lang::XMultiServiceFactory > xOLEFactory; - if ( !xOLEFactory.is() ) - { - uno::Reference< uno::XComponentContext > xContext( - comphelper::getProcessComponentContext() ); - if( xContext.is() ) - { - uno::Reference<lang::XMultiComponentFactory> xSMgr = xContext->getServiceManager(); - xOLEFactory = uno::Reference<lang::XMultiServiceFactory>( - xSMgr->createInstanceWithContext( - "com.sun.star.bridge.OleObjectFactory", - xContext ), uno::UNO_QUERY ); - } - } - bool bOk = false; - if( xOLEFactory.is() ) - { - uno::Reference< uno::XInterface > xExcel = xOLEFactory->createInstance( "Excel.Application" ); - uno::Reference< uno::XInterface > xADODB = xOLEFactory->createInstance( "ADODB.Connection" ); - bOk = xExcel.is() && xADODB.is(); - } - return bOk; -} - void VBATest::testMiscVBAFunctions() { const char* macroSource[] = { @@ -107,8 +75,29 @@ void VBATest::testMiscVBAFunctions() void VBATest::testMiscOLEStuff() { - bool bCanRunOleTests = hasOLEEnv(); - if ( !bCanRunOleTests ) +// not much point even trying to run except on windows +#if defined(WNT) + // test if we have the necessary runtime environment + // to run the OLE tests. + uno::Reference< lang::XMultiServiceFactory > xOLEFactory; + uno::Reference< uno::XComponentContext > xContext( + comphelper::getProcessComponentContext() ); + if( xContext.is() ) + { + uno::Reference<lang::XMultiComponentFactory> xSMgr = xContext->getServiceManager(); + xOLEFactory = uno::Reference<lang::XMultiServiceFactory>( + xSMgr->createInstanceWithContext( + "com.sun.star.bridge.OleObjectFactory", + xContext ), uno::UNO_QUERY ); + } + bool bOk = false; + if( xOLEFactory.is() ) + { + uno::Reference< uno::XInterface > xExcel = xOLEFactory->createInstance( "Excel.Application" ); + uno::Reference< uno::XInterface > xADODB = xOLEFactory->createInstance( "ADODB.Connection" ); + bOk = xExcel.is() && xADODB.is(); + } + if ( !bOk ) return; // can't do anything, skip test const char* macroSource[] = { @@ -142,6 +131,7 @@ void VBATest::testMiscOLEStuff() CPPUNIT_ASSERT_MESSAGE("No return variable huh?", pReturn != NULL ); CPPUNIT_ASSERT_MESSAGE("Result not as expected", pReturn->GetOUString() == "OK" ); } +#endif } // Put the test suite in the registry |