diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index 65f7d01712d1..347db6539f98 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -175,23 +175,18 @@ void ScMacrosTest::testVba() OUString("MiscControlTests."), OUString("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document") }, -#if 0 { OUString("Workbooks."), OUString("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document") }, -#endif }; OUString sTempDir; OUString sTempDirURL; osl::FileBase:: getTempDirURL( sTempDirURL ); osl::FileBase::getSystemPathFromFileURL( sTempDirURL, sTempDir ); + sTempDir += OUString( SAL_PATHDELIMITER ); + OUString sTestFileName("My Test WorkBook.xls"); Sequence< uno::Any > aParams; - if ( !sTempDir.isEmpty() ) - { - aParams.realloc(1); - aParams[ 0 ] <<= sTempDir; - } for ( sal_uInt32 i=0; i aOutParamIndex; Sequence< Any > aOutParam; + bool bWorkbooksHandling = OUString( testInfo[i].sFileBaseName ).equalsAscii("Workbooks.") && !sTempDir.isEmpty() ; + + if ( bWorkbooksHandling ) + { + aParams.realloc(2); + aParams[ 0 ] <<= sTempDir; + aParams[ 1 ] <<= sTestFileName; + } + SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent); CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); @@ -215,6 +219,14 @@ void ScMacrosTest::testVba() std::cout << "value of Ret " << OUStringToOString( aStringRes, RTL_TEXTENCODING_UTF8 ).getStr() << std::endl; CPPUNIT_ASSERT_MESSAGE( "script reported failure",aStringRes == "OK" ); pFoundShell->DoClose(); + if ( bWorkbooksHandling ) + { + OUString sFileUrl; + OUString sFilePath = sTempDir + sTestFileName; + osl::FileBase::getFileURLFromSystemPath( sFilePath, sFileUrl ); + if ( !sFileUrl.isEmpty() ) + osl::File::remove( sFileUrl ); + } } } diff --git a/sc/qa/extras/testdocuments/Workbooks.xls b/sc/qa/extras/testdocuments/Workbooks.xls index a732167be71b..2e8a7e78b44f 100755 Binary files a/sc/qa/extras/testdocuments/Workbooks.xls and b/sc/qa/extras/testdocuments/Workbooks.xls differ