diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-11-11 16:44:59 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-11-11 20:09:41 +0100 |
commit | 7986d35eee84fdf391c563602fb348758e1cd254 (patch) | |
tree | 0be65fbf8655c1461f712537ba0130f99b4d8da2 /sw | |
parent | 4c9093c95445c154c4ce7db1756ca936ea0752ca (diff) |
move password handling from SwModelTestBase to UnoApiTest
so other places inheriting from UnoApiTest can also import/export
protected documents
Change-Id: I0e2716204dbb171c9e17e3939b266977e1b96dda
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142592
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/inc/swmodeltestbase.hxx | 17 | ||||
-rw-r--r-- | sw/qa/unit/swmodeltestbase.cxx | 48 |
2 files changed, 1 insertions, 64 deletions
diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx index 7bbd5c06d5bb..dbc78e893aac 100644 --- a/sw/qa/inc/swmodeltestbase.hxx +++ b/sw/qa/inc/swmodeltestbase.hxx @@ -24,7 +24,6 @@ #include "swqahelperdllapi.h" #include <test/unoapixml_test.hxx> -#include <test/testinteractionhandler.hxx> #include <unotools/tempfile.hxx> #include <doc.hxx> @@ -94,13 +93,9 @@ class PDFiumDocument; class SWQAHELPER_DLLPUBLIC SwModelTestBase : public UnoApiXmlTest { private: - OUString maImportFilterOptions; - OUString maImportFilterName; bool mbExported; ///< Does maTempFile already contain something useful? protected: - rtl::Reference<TestInteractionHandler> xInteractionHandler; - xmlBufferPtr mpXmlBuffer; const char* mpFilter; @@ -112,16 +107,6 @@ protected: void paste(std::u16string_view aFilename, css::uno::Reference<css::text::XTextRange> const& xTextRange); public: - void setImportFilterOptions(const OUString &rFilterOptions) - { - maImportFilterOptions = rFilterOptions; - } - - void setImportFilterName(const OUString &rFilterName) - { - maImportFilterName = rFilterName; - } - SwModelTestBase(const OUString& pTestDocumentPath = OUString(), const char* pFilter = ""); protected: @@ -361,8 +346,6 @@ protected: bool isExported(){ return mbExported; } private: - void setTestInteractionHandler(const char* pPassword, std::vector<beans::PropertyValue>& rFilterOptions); - void loadURL(OUString const& rURL, const char* pName, const char* pPassword); void load(const char* pName, const char* pPassword = nullptr) diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx index 7a9e51f3d697..07ba9e28205e 100644 --- a/sw/qa/unit/swmodeltestbase.cxx +++ b/sw/qa/unit/swmodeltestbase.cxx @@ -20,7 +20,6 @@ #include <comphelper/processfactory.hxx> #include <comphelper/propertyvalue.hxx> -#include <comphelper/sequence.hxx> #include <officecfg/Office/Common.hxx> #include <rtl/ustrbuf.hxx> #include <sfx2/app.hxx> @@ -448,48 +447,10 @@ uno::Reference<drawing::XShape> SwModelTestBase::getTextFrameByName(const OUStri return xShape; } -void SwModelTestBase::setTestInteractionHandler(const char* pPassword, - std::vector<beans::PropertyValue>& rFilterOptions) -{ - OUString sPassword = OUString::createFromAscii(pPassword); - rFilterOptions.emplace_back(); - xInteractionHandler - = rtl::Reference<TestInteractionHandler>(new TestInteractionHandler(sPassword)); - uno::Reference<task::XInteractionHandler2> const xInteraction(xInteractionHandler); - rFilterOptions[0].Name = "InteractionHandler"; - rFilterOptions[0].Value <<= xInteraction; -} - void SwModelTestBase::header() {} void SwModelTestBase::loadURL(OUString const& rURL, const char* pName, const char* pPassword) { - if (mxComponent.is()) - mxComponent->dispose(); - - std::vector<beans::PropertyValue> aFilterOptions; - - if (pPassword) - { - setTestInteractionHandler(pPassword, aFilterOptions); - } - - if (!maImportFilterOptions.isEmpty()) - { - beans::PropertyValue aValue; - aValue.Name = "FilterOptions"; - aValue.Value <<= maImportFilterOptions; - aFilterOptions.push_back(aValue); - } - - if (!maImportFilterName.isEmpty()) - { - beans::PropertyValue aValue; - aValue.Name = "FilterName"; - aValue.Value <<= maImportFilterName; - aFilterOptions.push_back(aValue); - } - // Output name at load time, so in the case of a hang, the name of the hanging input file is visible. if (!isExported()) { @@ -498,14 +459,7 @@ void SwModelTestBase::loadURL(OUString const& rURL, const char* pName, const cha mnStartTime = osl_getGlobalTimer(); } - mxComponent - = loadFromDesktop(rURL, OUString(), comphelper::containerToSequence(aFilterOptions)); - - if (pPassword) - { - CPPUNIT_ASSERT_MESSAGE("Password set but not requested", - xInteractionHandler->wasPasswordRequested()); - } + UnoApiXmlTest::load(rURL, pPassword); discardDumpedLayout(); if (pName && mustCalcLayoutOf(pName)) |