summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basic/qa/cppunit/test_vba.cxx25
-rw-r--r--basic/qa/vba_tests/ole_ObjAssignNoDflt.vb4
-rw-r--r--basic/qa/vba_tests/ole_ObjAssignToNothing.vb4
-rw-r--r--basic/qa/vba_tests/ole_dfltObjDflMethod.vb2
4 files changed, 20 insertions, 15 deletions
diff --git a/basic/qa/cppunit/test_vba.cxx b/basic/qa/cppunit/test_vba.cxx
index 4028ec461a40..91b26d8f6eb7 100644
--- a/basic/qa/cppunit/test_vba.cxx
+++ b/basic/qa/cppunit/test_vba.cxx
@@ -86,10 +86,10 @@ void VBATest::testMiscVBAFunctions()
void VBATest::testMiscOLEStuff()
{
-// Not much point even trying to run except on Windows. Does not work
-// on 64-bit Windows with Excel installed. (Without Excel doesn't
-// really do anything anyway, see "so skip test" below.)
-#if defined(_WIN32) && !defined(_WIN64)
+// Not much point even trying to run except on Windows.
+// (Without Excel doesn't really do anything anyway,
+// see "so skip test" below.)
+#if defined(_WIN32)
// test if we have the necessary runtime environment
// to run the OLE tests.
uno::Reference< lang::XMultiServiceFactory > xOLEFactory;
@@ -110,13 +110,15 @@ void VBATest::testMiscOLEStuff()
if ( !bOk )
return; // can't do anything, skip test
- sal_Unicode sBuf[1024*4];
- SQLGetInstalledDriversW( sBuf, sizeof( sBuf ), nullptr );
+ const int nBufSize = 1024 * 4;
+ sal_Unicode sBuf[nBufSize];
+ SQLGetInstalledDriversW( sBuf, nBufSize, 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 ) {
+ if( wcscmp( pODBCDriverName, L"Microsoft Excel Driver (*.xls)" ) == 0 ||
+ wcscmp( pODBCDriverName, L"Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)" ) == 0 ) {
bFound = true;
break;
}
@@ -127,18 +129,21 @@ void VBATest::testMiscOLEStuff()
const char* macroSource[] = {
"ole_ObjAssignNoDflt.vb",
"ole_ObjAssignToNothing.vb",
+#if !defined(_WIN64)
+ // This test uses Microsoft.Jet.OLEDB.4.0 Provider, that is unavailable on Win64
"ole_dfltObjDflMethod.vb",
+#endif
};
OUString sMacroPathURL = m_directories.getURLFromSrc("/basic/qa/vba_tests/");
- uno::Sequence< uno::Any > aArgs(1);
+ uno::Sequence< uno::Any > aArgs(2);
// path to test document
- OUString sPath = m_directories.getPathFromSrc("/basic/qa/vba_tests/data/")
- + "ADODBdata.xls";
+ OUString sPath = m_directories.getPathFromSrc("/basic/qa/vba_tests/data/ADODBdata.xls");
sPath = sPath.replaceAll( "/", "\\" );
aArgs[ 0 ] = uno::makeAny( sPath );
+ aArgs[ 1 ] = uno::makeAny( OUString(pODBCDriverName) );
for ( sal_uInt32 i=0; i<SAL_N_ELEMENTS( macroSource ); ++i )
{
diff --git a/basic/qa/vba_tests/ole_ObjAssignNoDflt.vb b/basic/qa/vba_tests/ole_ObjAssignNoDflt.vb
index 048ad5eb5e84..9a86424d3df5 100644
--- a/basic/qa/vba_tests/ole_ObjAssignNoDflt.vb
+++ b/basic/qa/vba_tests/ole_ObjAssignNoDflt.vb
@@ -1,5 +1,5 @@
Option VBASupport 1
-Function doUnitTest( TestData as String) as String
+Function doUnitTest(TestData as String, Driver as String) as String
Rem Ensure object assignment is by reference
Rem when object member is used ( as lhs )
Dim origTimeout As Long
@@ -9,7 +9,7 @@ origTimeout = cn.CommandTimeout
modifiedTimeout = origTimeout * 2
cn.CommandTimeout = modifiedTimeout
Dim conStr As String
-conStr = "Provider=MSDASQL;Driver={Microsoft Excel Driver (*.xls)};DBQ="
+conStr = "Provider=MSDASQL;Driver={" & Driver & "};DBQ="
conStr = conStr & TestData & "; ReadOnly=False;"
cn.Open conStr
Set objCmd = New ADODB.Command
diff --git a/basic/qa/vba_tests/ole_ObjAssignToNothing.vb b/basic/qa/vba_tests/ole_ObjAssignToNothing.vb
index b34163db73ce..d68664b41b72 100644
--- a/basic/qa/vba_tests/ole_ObjAssignToNothing.vb
+++ b/basic/qa/vba_tests/ole_ObjAssignToNothing.vb
@@ -1,12 +1,12 @@
Option VBASupport 1
-Function doUnitTest( TestData as String) as String
+Function doUnitTest(TestData as String, Driver as String) as String
Rem Ensure object assignment is by reference
Rem when object member is used ( as lhs )
Rem This time we are testing assigning with special Nothing
Rem keyword
Set cn = New ADODB.Connection
Dim conStr As String
-conStr = "Provider=MSDASQL;Driver={Microsoft Excel Driver (*.xls)};DBQ="
+conStr = "Provider=MSDASQL;Driver={" & Driver & "};DBQ="
conStr = conStr & TestData & "; ReadOnly=False;"
cn.Open conStr
Set objCmd = New ADODB.Command
diff --git a/basic/qa/vba_tests/ole_dfltObjDflMethod.vb b/basic/qa/vba_tests/ole_dfltObjDflMethod.vb
index f24786098e48..9ac50d9b5f9e 100644
--- a/basic/qa/vba_tests/ole_dfltObjDflMethod.vb
+++ b/basic/qa/vba_tests/ole_dfltObjDflMethod.vb
@@ -3,7 +3,7 @@ Option Explicit
Rem Test accessing an object that has default object member
Rem which in turn has a default member that is a method
-Function doUnitTest(TestData As String) As String
+Function doUnitTest(TestData As String, Driver as String) As String
doUnitTest = "Begin"
Dim modifiedTimout As Long
Dim cnn1 As New ADODB.Connection