[Libreoffice-commits] core.git: basic/CppunitTest_basic_macros.mk basic/qa

Tomofumi Yagi yagit at mknada.sakura.ne.jp
Mon May 30 09:31:00 UTC 2016


 basic/CppunitTest_basic_macros.mk |    3 +++
 basic/qa/cppunit/test_vba.cxx     |   24 ++++++++++++++++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)

New commits:
commit d2a44e62704f185a0acecbb6320b92a4df3063b9
Author: Tomofumi Yagi <yagit at mknada.sakura.ne.jp>
Date:   Sat May 21 19:38:48 2016 +0900

    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 at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/basic/CppunitTest_basic_macros.mk b/basic/CppunitTest_basic_macros.mk
index 13e9235..8d64f40 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 265aaf6..83d243d 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",


More information about the Libreoffice-commits mailing list