[Libreoffice-commits] core.git: sc/qa

Noel Power noel.power at suse.com
Mon May 13 07:26:20 PDT 2013


 sc/qa/extras/macros-test.cxx             |   26 +++++++++++++++++++-------
 sc/qa/extras/testdocuments/Workbooks.xls |binary
 2 files changed, 19 insertions(+), 7 deletions(-)

New commits:
commit f34c31560bb29f90d579a795cd9f7707163c025f
Author: Noel Power <noel.power at suse.com>
Date:   Mon May 13 15:22:30 2013 +0100

    fix Workbooks.xls unit test ( was failing on windows )
    
    Change-Id: Id1e3a761765c1e860f611f40a78a6c24fa17d055

diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index 65f7d01..347db65 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 a732167..2e8a7e7 100755
Binary files a/sc/qa/extras/testdocuments/Workbooks.xls and b/sc/qa/extras/testdocuments/Workbooks.xls differ


More information about the Libreoffice-commits mailing list