[Libreoffice-commits] .: sc/qa

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Dec 4 16:41:47 PST 2012


 sc/qa/unit/subsequent_export-test.cxx |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit d3f629a1df701e29a03b4809984ef14e4db5ff71
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue Dec 4 19:41:04 2012 -0500

    Fix the testPasswordExport test.
    
    Change-Id: I9ef9be5d31a08813db9ecfed8eeb0ba8579309e9

diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 7fcbd67..7b0fde8 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -92,7 +92,8 @@ private:
 
     ScDocShellRef load(
         const OUString& rURL, const OUString& rFilter, const OUString &rUserData,
-        const OUString& rTypeName, sal_Int32 nFormat, sal_uLong nFormatType );
+        const OUString& rTypeName, sal_Int32 nFormat, sal_uLong nFormatType,
+        const OUString* pPassword = NULL );
 
     ScDocShellRef saveAndReload( ScDocShell* pShell, sal_Int32 nFormat );
     ScDocShellRef loadDocument( const rtl::OUString& rFileNameBase, sal_Int32 nFormat );
@@ -120,7 +121,6 @@ void ScExportTest::createCSVPath(const rtl::OUString& aFileBase, rtl::OUString&
 ScDocShellRef ScExportTest::saveAndReloadPassword(ScDocShell* pShell, const rtl::OUString &rFilter,
     const rtl::OUString &rUserData, const rtl::OUString& rTypeName, sal_uLong nFormatType)
 {
-
     utl::TempFile aTempFile;
     aTempFile.EnableKillingFile();
     SfxMedium aStoreMedium( aTempFile.GetURL(), STREAM_STD_WRITE );
@@ -151,7 +151,8 @@ ScDocShellRef ScExportTest::saveAndReloadPassword(ScDocShell* pShell, const rtl:
     if (nFormatType)
         nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS;
 
-    return load(aTempFile.GetURL(), rFilter, rUserData, rTypeName, nFormat, nFormatType);
+    OUString aPass("test");
+    return load(aTempFile.GetURL(), rFilter, rUserData, rTypeName, nFormat, nFormatType, &aPass);
 }
 
 ScDocShellRef ScExportTest::saveAndReload(ScDocShell* pShell, const rtl::OUString &rFilter,
@@ -184,7 +185,7 @@ ScDocShellRef ScExportTest::saveAndReload(ScDocShell* pShell, const rtl::OUStrin
 
 ScDocShellRef ScExportTest::load(
     const OUString& rURL, const OUString& rFilter, const OUString &rUserData,
-    const OUString& rTypeName, sal_Int32 nFormat, sal_uLong nFormatType )
+    const OUString& rTypeName, sal_Int32 nFormat, sal_uLong nFormatType, const OUString* pPassword )
 {
     SfxFilter* pFilter = new SfxFilter(
         rFilter,
@@ -197,6 +198,11 @@ ScDocShellRef ScExportTest::load(
     SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ);
     pSrcMed->SetFilter(pFilter);
     pSrcMed->UseInteractionHandler(false);
+    if (pPassword)
+    {
+        SfxItemSet* pSet = pSrcMed->GetItemSet();
+        pSet->Put(SfxStringItem(SID_PASSWORD, *pPassword));
+    }
     if (!xDocShRef->DoLoad(pSrcMed))
     {
         xDocShRef->DoClose();


More information about the Libreoffice-commits mailing list