summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-12-04 19:41:04 -0500
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-12-04 19:41:58 -0500
commitd3f629a1df701e29a03b4809984ef14e4db5ff71 (patch)
treea1ab23d67fcdb89d26615b8a6abbf53dd1dddbba /sc/qa
parent75e4c6fc621e57734a1dddaccc7e3cbe3ba03d8e (diff)
Fix the testPasswordExport test.
Change-Id: I9ef9be5d31a08813db9ecfed8eeb0ba8579309e9
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx14
1 files changed, 10 insertions, 4 deletions
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();