[Libreoffice-commits] .: Branch 'libreoffice-4-0' - 5 commits - sc/qa
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Dec 4 16:42:32 PST 2012
sc/qa/unit/subsequent_export-test.cxx | 63 +++++++++++++---------------------
1 file changed, 25 insertions(+), 38 deletions(-)
New commits:
commit dc2882aaa0b8d6d9e307a445e264a6200194480e
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();
commit f2913486b391eb28e3f480becfbce484e6926ff4
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Dec 4 19:12:27 2012 -0500
Remove duplicate code blocks.
Change-Id: If44f44ad076313ab67968fd70f244d781356028d
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index c7930b4..7fcbd67 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -90,6 +90,10 @@ private:
rtl::OUString m_aBaseString;
uno::Reference<uno::XInterface> m_xCalcComponent;
+ ScDocShellRef load(
+ const OUString& rURL, const OUString& rFilter, const OUString &rUserData,
+ const OUString& rTypeName, sal_Int32 nFormat, sal_uLong nFormatType );
+
ScDocShellRef saveAndReload( ScDocShell* pShell, sal_Int32 nFormat );
ScDocShellRef loadDocument( const rtl::OUString& rFileNameBase, sal_Int32 nFormat );
void createFileURL( const rtl::OUString& aFileBase, const rtl::OUString& rFileExtension, rtl::OUString& rFilePath);
@@ -146,27 +150,8 @@ ScDocShellRef ScExportTest::saveAndReloadPassword(ScDocShell* pShell, const rtl:
sal_uInt32 nFormat = 0;
if (nFormatType)
nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS;
- SfxFilter* pFilter = new SfxFilter(
- rFilter,
- rtl::OUString(), nFormatType, nFormat, rTypeName, 0, rtl::OUString(),
- rUserData, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc*")) );
- pFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
- ScDocShellRef xDocShRef = new ScDocShell;
- xDocShRef->GetDocument()->EnableUserInteraction(false);
- SfxMedium* pSrcMed = new SfxMedium(aTempFile.GetURL(), STREAM_STD_READ);
- pSrcMed->UseInteractionHandler(false);
- SfxItemSet* pSet = pSrcMed->GetItemSet();
- pSet->Put(SfxStringItem(SID_PASSWORD, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("test"))));
- pSrcMed->SetFilter(pFilter);
- if (!xDocShRef->DoLoad(pSrcMed))
- {
- xDocShRef->DoClose();
- // load failed.
- xDocShRef.Clear();
- }
-
- return xDocShRef;
+ return load(aTempFile.GetURL(), rFilter, rUserData, rTypeName, nFormat, nFormatType);
}
ScDocShellRef ScExportTest::saveAndReload(ScDocShell* pShell, const rtl::OUString &rFilter,
@@ -193,15 +178,23 @@ ScDocShellRef ScExportTest::saveAndReload(ScDocShell* pShell, const rtl::OUStrin
sal_uInt32 nFormat = 0;
if (nFormatType)
nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS;
+
+ return load(aTempFile.GetURL(), rFilter, rUserData, rTypeName, nFormat, nFormatType);
+}
+
+ScDocShellRef ScExportTest::load(
+ const OUString& rURL, const OUString& rFilter, const OUString &rUserData,
+ const OUString& rTypeName, sal_Int32 nFormat, sal_uLong nFormatType )
+{
SfxFilter* pFilter = new SfxFilter(
rFilter,
rtl::OUString(), nFormatType, nFormat, rTypeName, 0, rtl::OUString(),
- rUserData, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc*")) );
+ rUserData, OUString("private:factory/scalc*"));
pFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
ScDocShellRef xDocShRef = new ScDocShell;
xDocShRef->GetDocument()->EnableUserInteraction(false);
- SfxMedium* pSrcMed = new SfxMedium(aTempFile.GetURL(), STREAM_STD_READ);
+ SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ);
pSrcMed->SetFilter(pFilter);
pSrcMed->UseInteractionHandler(false);
if (!xDocShRef->DoLoad(pSrcMed))
@@ -235,25 +228,7 @@ ScDocShellRef ScExportTest::loadDocument(const rtl::OUString& rFileName, sal_Int
unsigned int nFormatType = aFileFormats[nFormat].nFormatType;
unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
- SfxFilter* pFilter = new SfxFilter(
- aFilterName,
- rtl::OUString(), nFormatType, nClipboardId, aFilterType, 0, rtl::OUString(),
- rtl::OUString(), rtl::OUString("private:factory/scalc*") );
- pFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
-
- ScDocShellRef xDocShRef = new ScDocShell;
- xDocShRef->GetDocument()->EnableUserInteraction(false);
- SfxMedium* pSrcMed = new SfxMedium(aFileName, STREAM_STD_READ);
- pSrcMed->SetFilter(pFilter);
- pSrcMed->UseInteractionHandler(false);
- if (!xDocShRef->DoLoad(pSrcMed))
- {
- xDocShRef->DoClose();
- // load failed.
- xDocShRef.Clear();
- }
-
- return xDocShRef;
+ return load(aFileName, aFilterName, OUString(), aFilterType, nClipboardId, nFormatType);
}
void ScExportTest::test()
commit 9693dbd397724ec88a99d364c69f361ecc874315
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Dec 4 18:39:43 2012 -0500
More adjustment of file load code in the unit test.
And remove the try catch block, which shouldn't really be necessary
there.
Change-Id: I91db12203332b31b208b107db810c33705a57f0b
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 8d4eb82..c7930b4 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -200,8 +200,10 @@ ScDocShellRef ScExportTest::saveAndReload(ScDocShell* pShell, const rtl::OUStrin
pFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
ScDocShellRef xDocShRef = new ScDocShell;
+ xDocShRef->GetDocument()->EnableUserInteraction(false);
SfxMedium* pSrcMed = new SfxMedium(aTempFile.GetURL(), STREAM_STD_READ);
pSrcMed->SetFilter(pFilter);
+ pSrcMed->UseInteractionHandler(false);
if (!xDocShRef->DoLoad(pSrcMed))
{
xDocShRef->DoClose();
@@ -240,8 +242,10 @@ ScDocShellRef ScExportTest::loadDocument(const rtl::OUString& rFileName, sal_Int
pFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
ScDocShellRef xDocShRef = new ScDocShell;
+ xDocShRef->GetDocument()->EnableUserInteraction(false);
SfxMedium* pSrcMed = new SfxMedium(aFileName, STREAM_STD_READ);
pSrcMed->SetFilter(pFilter);
+ pSrcMed->UseInteractionHandler(false);
if (!xDocShRef->DoLoad(pSrcMed))
{
xDocShRef->DoClose();
diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx
index c5d4b30..896f648 100644
--- a/sc/source/filter/oox/workbookfragment.cxx
+++ b/sc/source/filter/oox/workbookfragment.cxx
@@ -28,7 +28,6 @@
#include "oox/helper/propertyset.hxx"
#include "oox/ole/olestorage.hxx"
#include "vcl/msgbox.hxx"
-#include <vcl/svapp.hxx>
#include "biffinputstream.hxx"
#include "chartsheetfragment.hxx"
@@ -331,11 +330,7 @@ void WorkbookFragment::finalizeImport()
pDocSh->GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_XLS));
- try
- {
- bHardRecalc = aBox.Execute() == RET_YES;
- }
- catch (Application::DialogCancelledException const&) {/* ignore */}
+ bHardRecalc = aBox.Execute() == RET_YES;
}
if (bHardRecalc)
commit 66aeeafabf67dd531e0f387fb0b3fb5da28c781e
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Dec 4 18:27:56 2012 -0500
Disable user interaction here too, to prevent dialog launches.
Change-Id: I6b193ddf7e03dd6706326e9fe8a523423435812f
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index d67224f..8d4eb82 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -153,7 +153,9 @@ ScDocShellRef ScExportTest::saveAndReloadPassword(ScDocShell* pShell, const rtl:
pFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
ScDocShellRef xDocShRef = new ScDocShell;
+ xDocShRef->GetDocument()->EnableUserInteraction(false);
SfxMedium* pSrcMed = new SfxMedium(aTempFile.GetURL(), STREAM_STD_READ);
+ pSrcMed->UseInteractionHandler(false);
SfxItemSet* pSet = pSrcMed->GetItemSet();
pSet->Put(SfxStringItem(SID_PASSWORD, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("test"))));
pSrcMed->SetFilter(pFilter);
commit b608d17e0c6c838899cbf4f30732b32a1aafea57
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Dec 4 23:38:08 2012 +0100
WorkbookFragment::finalizeImport(): catch DialogCancelledException
... so sc tests don't terminate with unhandled exception.
Change-Id: Id6bcfa8b181bcb1f6df63a7918e88c68ff7940e5
diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx
index 896f648..c5d4b30 100644
--- a/sc/source/filter/oox/workbookfragment.cxx
+++ b/sc/source/filter/oox/workbookfragment.cxx
@@ -28,6 +28,7 @@
#include "oox/helper/propertyset.hxx"
#include "oox/ole/olestorage.hxx"
#include "vcl/msgbox.hxx"
+#include <vcl/svapp.hxx>
#include "biffinputstream.hxx"
#include "chartsheetfragment.hxx"
@@ -330,7 +331,11 @@ void WorkbookFragment::finalizeImport()
pDocSh->GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_XLS));
- bHardRecalc = aBox.Execute() == RET_YES;
+ try
+ {
+ bHardRecalc = aBox.Execute() == RET_YES;
+ }
+ catch (Application::DialogCancelledException const&) {/* ignore */}
}
if (bHardRecalc)
More information about the Libreoffice-commits
mailing list