diff options
author | Tomofumi Yagi <yagit@mknada.sakura.ne.jp> | 2016-05-21 19:38:48 +0900 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-05-30 09:30:33 +0000 |
commit | d2a44e62704f185a0acecbb6320b92a4df3063b9 (patch) | |
tree | c31ffb4cc15cc89b74c92dcb410d3ac84a8feffa /basic | |
parent | 46a987fe08c6f7d20da437eed621d670ce44aea7 (diff) |
tdf#99696 fix build error for 64bit Windows in unit tests using ADODB
This patch fixes the problem that the build for x64 fails in basic module
on 64bit Windows installed 32bit Excel Application.
New code checks the existance of ODBC driver for excel insted of the
existance of Excel application(at this time the bitness of ODBC driver for
excel would match that of building LibreOffice).
What we need is probably not Excel Application but ODBC drivers for proper
bitness.
Change-Id: I62285eb2351f2022754fc34cb2d54db1bd9e8142
Reviewed-on: https://gerrit.libreoffice.org/25301
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'basic')
-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", |