SwModelTestBase: inherit from UnoApiXmlTest
it seems setUp/tearDown can also go as well. See the discussion in gerrit. Change-Id: I5e81dcdcb2e070eb4beb737f3cb25c86cb9d042b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142465 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
parent
d1e02f58a2
commit
4170b94c44
61 changed files with 85 additions and 89 deletions
|
@ -36,7 +36,7 @@ public:
|
|||
css::uno::Any executeMacro(const OUString& rScriptURL,
|
||||
const css::uno::Sequence<css::uno::Any>& rParams = {});
|
||||
|
||||
void save(const OUString& rFilter);
|
||||
void save(const OUString& rFilter, const char* pPassword = nullptr);
|
||||
void saveAndClose(const OUString& rFilter);
|
||||
void saveAndReload(const OUString& rFilter);
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_accessibilitycheck, \
|
|||
sal \
|
||||
svx \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
sw \
|
||||
swqahelper \
|
||||
test \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_attr, \
|
|||
editeng \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svx \
|
||||
svxcore \
|
||||
|
|
|
@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_crsr, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svxcore \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_doc, \
|
|||
editeng \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svxcore \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_docnode, \
|
|||
editeng \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
sw \
|
||||
swqahelper \
|
||||
test \
|
||||
|
|
|
@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_draw, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svxcore \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_edit, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svxcore \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_fields, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
sw \
|
||||
swqahelper \
|
||||
test \
|
||||
|
|
|
@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_frmedt, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svxcore \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_layout, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
sw \
|
||||
swqahelper \
|
||||
test \
|
||||
|
|
|
@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_objectpositioning, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svxcore \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_text, \
|
|||
editeng \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_tox, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
sw \
|
||||
swqahelper \
|
||||
test \
|
||||
|
|
|
@ -25,6 +25,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_txtnode, \
|
|||
editeng \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svxcore \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_undo, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svxcore \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -27,6 +27,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_unocore, \
|
|||
msword \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svt \
|
||||
svxcore \
|
||||
|
|
|
@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_view, \
|
|||
cppu \
|
||||
cppuhelper \
|
||||
sal \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svt \
|
||||
sw \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_docbookexport, \
|
|||
i18nlangtag \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
sw \
|
||||
swqahelper \
|
||||
test \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_filter_html, \
|
|||
editeng \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svx \
|
||||
svxcore \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_filter_ww8, \
|
|||
editeng \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svx \
|
||||
svxcore \
|
||||
|
|
|
@ -25,6 +25,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_filters_test, \
|
|||
$(eval $(call gb_CppunitTest_use_libraries,sw_filters_test, \
|
||||
sw \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svt \
|
||||
sot \
|
||||
|
|
|
@ -25,6 +25,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_filters_test2, \
|
|||
$(eval $(call gb_CppunitTest_use_libraries,sw_filters_test2, \
|
||||
sw \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svt \
|
||||
sot \
|
||||
|
|
|
@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_fodfexport, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
sw \
|
||||
swqahelper \
|
||||
test \
|
||||
|
|
|
@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_globalfilter, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svt \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -26,6 +26,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_htmlexport, \
|
|||
msfilter \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
sot \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -25,6 +25,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_htmlimport, \
|
|||
i18nlangtag \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svt \
|
||||
sw \
|
||||
|
|
|
@ -27,6 +27,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_indexingexport, \
|
|||
sal \
|
||||
sfx \
|
||||
sot \
|
||||
subsequenttest \
|
||||
sw \
|
||||
swqahelper \
|
||||
svl \
|
||||
|
|
|
@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_mailmerge, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_mailmerge2, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_odfexport, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_odfexport2, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -25,6 +25,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_odfimport, \
|
|||
sal \
|
||||
svt \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -25,6 +25,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_ooxmlexport8, \
|
|||
cppu \
|
||||
cppuhelper \
|
||||
sal \
|
||||
subsequenttest \
|
||||
test \
|
||||
unotest \
|
||||
utl \
|
||||
|
|
|
@ -26,6 +26,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_ooxmlimport, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
test \
|
||||
unotest \
|
||||
utl \
|
||||
|
|
|
@ -26,6 +26,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_ooxmlimport2, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
test \
|
||||
unotest \
|
||||
utl \
|
||||
|
|
|
@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_rtfimport, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
i18nlangtag \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_tiledrendering, \
|
|||
editeng \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svt \
|
||||
svxcore \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_txtencexport, \
|
|||
i18nlangtag \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
sw \
|
||||
swqahelper \
|
||||
test \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_txtexport, \
|
|||
i18nlangtag \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
sw \
|
||||
swqahelper \
|
||||
test \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_txtimport, \
|
|||
i18nlangtag \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
sw \
|
||||
swqahelper \
|
||||
test \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uibase_dochdl, \
|
|||
editeng \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svx \
|
||||
svxcore \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uibase_docvw, \
|
|||
editeng \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svx \
|
||||
svxcore \
|
||||
|
|
|
@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uibase_fldui, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svxcore \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uibase_frmdlg, \
|
|||
editeng \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svx \
|
||||
svxcore \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uibase_shells, \
|
|||
editeng \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svx \
|
||||
svxcore \
|
||||
|
|
|
@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uibase_uiview, \
|
|||
cppuhelper \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svxcore \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uibase_uno, \
|
|||
editeng \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svx \
|
||||
svxcore \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uibase_wrtsh, \
|
|||
editeng \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svx \
|
||||
svxcore \
|
||||
|
|
|
@ -27,6 +27,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_unowriter, \
|
|||
msword \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svt \
|
||||
svxcore \
|
||||
|
|
|
@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_ww8import, \
|
|||
cppuhelper \
|
||||
editeng \
|
||||
sal \
|
||||
subsequenttest \
|
||||
test \
|
||||
unotest \
|
||||
vcl \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_xhtmlexport, \
|
|||
i18nlangtag \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
sw \
|
||||
swqahelper \
|
||||
test \
|
||||
|
|
|
@ -46,6 +46,7 @@ $(eval $(call gb_Library_use_libraries,swqahelper,\
|
|||
sw \
|
||||
sfx \
|
||||
sot \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svt \
|
||||
svx \
|
||||
|
|
|
@ -30,6 +30,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_layoutwriter$(1), \
|
|||
msword \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svt \
|
||||
svxcore \
|
||||
|
|
|
@ -16,6 +16,7 @@ define sw_ooxmlexport_libraries
|
|||
editeng \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -23,10 +23,8 @@
|
|||
#include <com/sun/star/xml/AttributeData.hpp>
|
||||
|
||||
#include "swqahelperdllapi.h"
|
||||
#include <test/bootstrapfixture.hxx>
|
||||
#include <test/xmltesttools.hxx>
|
||||
#include <test/unoapixml_test.hxx>
|
||||
#include <test/testinteractionhandler.hxx>
|
||||
#include <unotest/macros_test.hxx>
|
||||
#include <unotools/tempfile.hxx>
|
||||
|
||||
#include <doc.hxx>
|
||||
|
@ -93,27 +91,21 @@ class PDFiumDocument;
|
|||
}
|
||||
|
||||
/// Base class for filter tests loading or roundtripping a document, then asserting the document model.
|
||||
class SWQAHELPER_DLLPUBLIC SwModelTestBase : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools
|
||||
class SWQAHELPER_DLLPUBLIC SwModelTestBase : public UnoApiXmlTest
|
||||
{
|
||||
private:
|
||||
OUString maFilterOptions;
|
||||
OUString maImportFilterOptions;
|
||||
OUString maImportFilterName;
|
||||
const OUString mpTestDocumentPath;
|
||||
bool mbExported; ///< Does maTempFile already contain something useful?
|
||||
|
||||
protected:
|
||||
css::uno::Reference< css::lang::XComponent > mxComponent;
|
||||
|
||||
rtl::Reference<TestInteractionHandler> xInteractionHandler;
|
||||
|
||||
xmlBufferPtr mpXmlBuffer;
|
||||
const char* mpFilter;
|
||||
|
||||
sal_uInt32 mnStartTime;
|
||||
utl::TempFileNamed maTempFile;
|
||||
SvMemoryStream maMemory; ///< Underlying memory for parsed PDF files.
|
||||
bool mbFontNameWYSIWYG;
|
||||
|
||||
virtual OUString getTestName() { return OUString(); }
|
||||
|
||||
|
@ -121,11 +113,6 @@ protected:
|
|||
void paste(std::u16string_view aFilename, css::uno::Reference<css::text::XTextRange> const& xTextRange);
|
||||
|
||||
public:
|
||||
void setFilterOptions(const OUString &rFilterOptions)
|
||||
{
|
||||
maFilterOptions = rFilterOptions;
|
||||
}
|
||||
|
||||
void setImportFilterOptions(const OUString &rFilterOptions)
|
||||
{
|
||||
maImportFilterOptions = rFilterOptions;
|
||||
|
@ -138,10 +125,6 @@ public:
|
|||
|
||||
SwModelTestBase(const OUString& pTestDocumentPath = OUString(), const char* pFilter = "");
|
||||
|
||||
void setUp() override;
|
||||
|
||||
void tearDown() override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Helper func used by each unit test to test the 'import' code.
|
||||
|
@ -327,11 +310,6 @@ protected:
|
|||
"com.sun.star.text.WebDocument", pName, pPassword);
|
||||
}
|
||||
|
||||
OUString createFileURL(std::u16string_view aFileName)
|
||||
{
|
||||
return m_directories.getSrcRootURL() + mpTestDocumentPath + "/" + aFileName;
|
||||
}
|
||||
|
||||
void setTestInteractionHandler(const char* pPassword, std::vector<beans::PropertyValue>& rFilterOptions);
|
||||
|
||||
void loadURLWithComponent(OUString const& rURL, OUString const& rComponent, const char* pName, const char* pPassword);
|
||||
|
@ -357,14 +335,6 @@ protected:
|
|||
/// Get shape count.
|
||||
int getShapes() const;
|
||||
|
||||
/**
|
||||
* Given that some problem doesn't affect the result in the importer, we
|
||||
* test the resulting file directly, by opening the zip file, parsing an
|
||||
* xml stream, and asserting an XPath expression. This method returns the
|
||||
* xml stream, so that you can do the asserting.
|
||||
*/
|
||||
xmlDocUniquePtr parseExport(const OUString& rStreamName);
|
||||
|
||||
/**
|
||||
* Returns an xml stream of an exported file.
|
||||
* To be used when the exporter doesn't create zip archives, but single files
|
||||
|
|
|
@ -55,37 +55,12 @@ void SwModelTestBase::paste(std::u16string_view aFilename,
|
|||
}
|
||||
|
||||
SwModelTestBase::SwModelTestBase(const OUString& pTestDocumentPath, const char* pFilter)
|
||||
: mpTestDocumentPath(pTestDocumentPath)
|
||||
: UnoApiXmlTest(pTestDocumentPath)
|
||||
, mbExported(false)
|
||||
, mpXmlBuffer(nullptr)
|
||||
, mpFilter(pFilter)
|
||||
, mnStartTime(0)
|
||||
, mbFontNameWYSIWYG(officecfg::Office::Common::Font::View::ShowFontBoxWYSIWYG::get())
|
||||
{
|
||||
maTempFile.EnableKillingFile();
|
||||
}
|
||||
|
||||
void SwModelTestBase::setUp()
|
||||
{
|
||||
test::BootstrapFixture::setUp();
|
||||
mxDesktop.set(
|
||||
css::frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory())));
|
||||
SfxApplication::GetOrCreate();
|
||||
std::shared_ptr<comphelper::ConfigurationChanges> xChanges(
|
||||
comphelper::ConfigurationChanges::create());
|
||||
officecfg::Office::Common::Font::View::ShowFontBoxWYSIWYG::set(false, xChanges);
|
||||
xChanges->commit();
|
||||
}
|
||||
|
||||
void SwModelTestBase::tearDown()
|
||||
{
|
||||
if (mxComponent.is())
|
||||
mxComponent->dispose();
|
||||
std::shared_ptr<comphelper::ConfigurationChanges> xChanges(
|
||||
comphelper::ConfigurationChanges::create());
|
||||
officecfg::Office::Common::Font::View::ShowFontBoxWYSIWYG::set(mbFontNameWYSIWYG, xChanges);
|
||||
xChanges->commit();
|
||||
test::BootstrapFixture::tearDown();
|
||||
}
|
||||
|
||||
void SwModelTestBase::executeImportTest(const char* filename, const char* pPassword)
|
||||
|
@ -552,28 +527,10 @@ void SwModelTestBase::reload(const char* pFilter, const char* pName, const char*
|
|||
|
||||
void SwModelTestBase::save(const OUString& aFilterName, const char* pName, const char* pPassword)
|
||||
{
|
||||
uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
|
||||
utl::MediaDescriptor aMediaDescriptor;
|
||||
aMediaDescriptor["FilterName"] <<= aFilterName;
|
||||
if (!maFilterOptions.isEmpty())
|
||||
aMediaDescriptor["FilterOptions"] <<= maFilterOptions;
|
||||
if (pPassword)
|
||||
{
|
||||
if (aFilterName != "Office Open XML Text")
|
||||
{
|
||||
aMediaDescriptor["Password"] <<= OUString::createFromAscii(pPassword);
|
||||
}
|
||||
else
|
||||
{
|
||||
OUString sPassword = OUString::createFromAscii(pPassword);
|
||||
css::uno::Sequence<css::beans::NamedValue> aEncryptionData{
|
||||
{ "CryptoType", css::uno::Any(OUString("Standard")) },
|
||||
{ "OOXPassword", css::uno::Any(sPassword) }
|
||||
};
|
||||
aMediaDescriptor[utl::MediaDescriptor::PROP_ENCRYPTIONDATA] <<= aEncryptionData;
|
||||
}
|
||||
}
|
||||
xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
|
||||
// FIXME: Merge skipValidation and mustValidate
|
||||
skipValidation();
|
||||
|
||||
UnoApiXmlTest::save(aFilterName, pPassword);
|
||||
|
||||
// TODO: for now, validate only ODF here
|
||||
if (mustValidate(pName) || aFilterName == "writer8"
|
||||
|
@ -640,13 +597,6 @@ int SwModelTestBase::getShapes() const
|
|||
return xDraws->getCount();
|
||||
}
|
||||
|
||||
xmlDocUniquePtr SwModelTestBase::parseExport(const OUString& rStreamName)
|
||||
{
|
||||
std::unique_ptr<SvStream> pStream(parseExportStream(maTempFile.GetURL(), rStreamName));
|
||||
|
||||
return parseXmlStream(pStream.get());
|
||||
}
|
||||
|
||||
xmlDocUniquePtr SwModelTestBase::parseExportedFile()
|
||||
{
|
||||
auto stream(SvFileStream(maTempFile.GetURL(), StreamMode::READ | StreamMode::TEMPORARY));
|
||||
|
|
|
@ -27,6 +27,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_rtfexport$(1), \
|
|||
i18nlangtag \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
sw \
|
||||
swqahelper \
|
||||
|
|
|
@ -18,6 +18,7 @@ define sw_uiwriter_libraries
|
|||
msword \
|
||||
sal \
|
||||
sfx \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svt \
|
||||
svxcore \
|
||||
|
|
|
@ -31,6 +31,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_ww8export$(1), \
|
|||
test \
|
||||
unotest \
|
||||
utl \
|
||||
subsequenttest \
|
||||
svl \
|
||||
svxcore \
|
||||
sw \
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <test/unoapi_test.hxx>
|
||||
|
||||
#include <com/sun/star/beans/NamedValue.hpp>
|
||||
#include <com/sun/star/frame/Desktop.hpp>
|
||||
#include <com/sun/star/frame/XStorable.hpp>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
|
@ -82,13 +83,31 @@ uno::Any UnoApiTest::executeMacro(const OUString& rScriptURL,
|
|||
return aRet;
|
||||
}
|
||||
|
||||
void UnoApiTest::save(const OUString& rFilter)
|
||||
void UnoApiTest::save(const OUString& rFilter, const char* pPassword)
|
||||
{
|
||||
utl::MediaDescriptor aMediaDescriptor;
|
||||
aMediaDescriptor["FilterName"] <<= rFilter;
|
||||
if (!maFilterOptions.isEmpty())
|
||||
aMediaDescriptor["FilterOptions"] <<= maFilterOptions;
|
||||
css::uno::Reference<frame::XStorable> xStorable(mxComponent, css::uno::UNO_QUERY_THROW);
|
||||
|
||||
if (pPassword)
|
||||
{
|
||||
if (rFilter != "Office Open XML Text")
|
||||
{
|
||||
aMediaDescriptor["Password"] <<= OUString::createFromAscii(pPassword);
|
||||
}
|
||||
else
|
||||
{
|
||||
OUString sPassword = OUString::createFromAscii(pPassword);
|
||||
uno::Sequence<beans::NamedValue> aEncryptionData{
|
||||
{ "CryptoType", uno::Any(OUString("Standard")) },
|
||||
{ "OOXPassword", uno::Any(sPassword) }
|
||||
};
|
||||
aMediaDescriptor[utl::MediaDescriptor::PROP_ENCRYPTIONDATA] <<= aEncryptionData;
|
||||
}
|
||||
}
|
||||
|
||||
xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
|
||||
|
||||
if (!mbSkipValidation)
|
||||
|
|
Loading…
Reference in a new issue