fix Workbooks.xls unit test ( was failing on windows )
Change-Id: Id1e3a761765c1e860f611f40a78a6c24fa17d055
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user