summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2013-05-13 15:22:30 +0100
committerNoel Power <noel.power@suse.com>2013-05-13 15:23:46 +0100
commitf34c31560bb29f90d579a795cd9f7707163c025f (patch)
treeb804d1a26bead01d429b1fcda7e745b79e5df322 /sc
parent935d074e9fd4d4feab4dd393e5b4938bf32de1cb (diff)
fix Workbooks.xls unit test ( was failing on windows )
Change-Id: Id1e3a761765c1e860f611f40a78a6c24fa17d055
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/extras/macros-test.cxx26
-rwxr-xr-xsc/qa/extras/testdocuments/Workbooks.xlsbin37888 -> 29184 bytes
2 files changed, 19 insertions, 7 deletions
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<SAL_N_ELEMENTS( testInfo ); ++i )
{
OUString aFileName;
@@ -204,6 +199,15 @@ void ScMacrosTest::testVba()
Any aRet;
Sequence< sal_Int16 > 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
--- a/sc/qa/extras/testdocuments/Workbooks.xls
+++ b/sc/qa/extras/testdocuments/Workbooks.xls
Binary files differ