diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-11-08 18:27:05 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-11-09 11:34:05 +0100 |
commit | 4170b94c443b3bd68b4cc75b8c344ecca3c249b0 (patch) | |
tree | f38255bdc4279e405133f8ef2d2d37e1945be7c3 /test | |
parent | d1e02f58a211111dd745a54ae93114a56cfdda0c (diff) |
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>
Diffstat (limited to 'test')
-rw-r--r-- | test/source/unoapi_test.cxx | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/test/source/unoapi_test.cxx b/test/source/unoapi_test.cxx index a0c41da78ec5..6918f7a7a174 100644 --- a/test/source/unoapi_test.cxx +++ b/test/source/unoapi_test.cxx @@ -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) |