-Werror,-Wunused-member-function
Change-Id: I32e4a80e99885c561a30e8f059c9b9a24c4bd3c7
This commit is contained in:
@@ -17,7 +17,6 @@ namespace
|
|||||||
|
|
||||||
class VBATest : public test::BootstrapFixture
|
class VBATest : public test::BootstrapFixture
|
||||||
{
|
{
|
||||||
bool hasOLEEnv();
|
|
||||||
public:
|
public:
|
||||||
VBATest() : BootstrapFixture(true, false) {}
|
VBATest() : BootstrapFixture(true, false) {}
|
||||||
~VBATest(){}
|
~VBATest(){}
|
||||||
@@ -28,44 +27,13 @@ namespace
|
|||||||
|
|
||||||
// Declares the method as a test to call
|
// Declares the method as a test to call
|
||||||
CPPUNIT_TEST(testMiscVBAFunctions);
|
CPPUNIT_TEST(testMiscVBAFunctions);
|
||||||
// not much point even trying to run except on windows
|
|
||||||
#if defined(WNT)
|
|
||||||
CPPUNIT_TEST(testMiscOLEStuff);
|
CPPUNIT_TEST(testMiscOLEStuff);
|
||||||
#endif
|
|
||||||
|
|
||||||
// End of test suite definition
|
// End of test suite definition
|
||||||
CPPUNIT_TEST_SUITE_END();
|
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()
|
void VBATest::testMiscVBAFunctions()
|
||||||
{
|
{
|
||||||
const char* macroSource[] = {
|
const char* macroSource[] = {
|
||||||
@@ -107,8 +75,29 @@ void VBATest::testMiscVBAFunctions()
|
|||||||
|
|
||||||
void VBATest::testMiscOLEStuff()
|
void VBATest::testMiscOLEStuff()
|
||||||
{
|
{
|
||||||
bool bCanRunOleTests = hasOLEEnv();
|
// not much point even trying to run except on windows
|
||||||
if ( !bCanRunOleTests )
|
#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
|
return; // can't do anything, skip test
|
||||||
|
|
||||||
const char* macroSource[] = {
|
const char* macroSource[] = {
|
||||||
@@ -142,6 +131,7 @@ void VBATest::testMiscOLEStuff()
|
|||||||
CPPUNIT_ASSERT_MESSAGE("No return variable huh?", pReturn != NULL );
|
CPPUNIT_ASSERT_MESSAGE("No return variable huh?", pReturn != NULL );
|
||||||
CPPUNIT_ASSERT_MESSAGE("Result not as expected", pReturn->GetOUString() == "OK" );
|
CPPUNIT_ASSERT_MESSAGE("Result not as expected", pReturn->GetOUString() == "OK" );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put the test suite in the registry
|
// Put the test suite in the registry
|
||||||
|
Reference in New Issue
Block a user