From d3f629a1df701e29a03b4809984ef14e4db5ff71 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Tue, 4 Dec 2012 19:41:04 -0500 Subject: Fix the testPasswordExport test. Change-Id: I9ef9be5d31a08813db9ecfed8eeb0ba8579309e9 --- sc/qa/unit/subsequent_export-test.cxx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'sc/qa') diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 7fcbd67f0c6e..7b0fde81c8dc 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(); -- cgit v1.2.3