diff options
-rw-r--r-- | basic/CppunitTest_basic_macros.mk | 3 | ||||
-rw-r--r-- | basic/qa/cppunit/test_vba.cxx | 24 |
2 files changed, 25 insertions, 2 deletions
diff --git a/basic/CppunitTest_basic_macros.mk b/basic/CppunitTest_basic_macros.mk index 13e9235341ac..8d64f40a65f7 100644 --- a/basic/CppunitTest_basic_macros.mk +++ b/basic/CppunitTest_basic_macros.mk @@ -42,6 +42,9 @@ $(eval $(call gb_CppunitTest_use_libraries,basic_macros, \ ifeq ($(OS),WNT) $(eval $(call gb_CppunitTest_use_system_win32_libs,basic_macros, \ oleaut32 \ + $(if $(filter 140,$(VCVER)),legacy_stdio_definitions) \ + odbc32 \ + odbccp32 \ )) endif diff --git a/basic/qa/cppunit/test_vba.cxx b/basic/qa/cppunit/test_vba.cxx index 265aaf6f7e91..83d243d21dc0 100644 --- a/basic/qa/cppunit/test_vba.cxx +++ b/basic/qa/cppunit/test_vba.cxx @@ -10,6 +10,13 @@ #include <comphelper/processfactory.hxx> #include <unotools/syslocaleoptions.hxx> +#ifdef WIN32 +#include <string.h> + +#include <windows.h> +#include <odbcinst.h> +#endif + using namespace ::com::sun::star; namespace @@ -96,13 +103,26 @@ void VBATest::testMiscOLEStuff() 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(); + bOk = xADODB.is(); } if ( !bOk ) return; // can't do anything, skip test + sal_Unicode sBuf[1024*4]; + SQLGetInstalledDriversW( sBuf, sizeof( sBuf ), nullptr ); + + const sal_Unicode *pODBCDriverName = sBuf; + bool bFound = false; + for (; wcslen( pODBCDriverName ) != 0; pODBCDriverName += wcslen( pODBCDriverName ) + 1 ) { + if ( wcsstr( pODBCDriverName, L"Microsoft Excel Driver" ) != nullptr ) { + bFound = true; + break; + } + } + if ( !bFound ) + return; // can't find ODBC driver needed test, so skip test + const char* macroSource[] = { "ole_ObjAssignNoDflt.vb", "ole_ObjAssignToNothing.vb", |