diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-09-17 14:56:54 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-09-17 16:39:32 +0200 |
commit | 44e1dbb95de4b2cf326ef5d29be6432e195dfb01 (patch) | |
tree | 8aa16d00fa347c22d36ee82e650ec4a4c6642afc /sc | |
parent | d02f39f67539682fd6fc673796e95f935dd139f0 (diff) |
CppunitTest_sc_subsequent_filters_test: simplify code
Change-Id: I0019a40a34c48f59af72d73f1f83f2fc18602920
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122249
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/subsequent_filters_test.cxx | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/sc/qa/unit/subsequent_filters_test.cxx b/sc/qa/unit/subsequent_filters_test.cxx index cc7fe47271be..1bdfceb446ba 100644 --- a/sc/qa/unit/subsequent_filters_test.cxx +++ b/sc/qa/unit/subsequent_filters_test.cxx @@ -1854,25 +1854,10 @@ void ScFiltersTest::testPassword_Impl(std::u16string_view aFileNameBase) createFileURL(aFileNameBase, aFileExtension, aFileName); OUString aFilterType(getFileFormats()[0].pTypeName, strlen(getFileFormats()[0].pTypeName), RTL_TEXTENCODING_UTF8); - auto pFilter = std::make_shared<SfxFilter>( - aFilterName, - OUString(), getFileFormats()[0].nFormatType, - SotClipboardFormatId::STARCALC_8, - aFilterType, OUString(), - OUString(), "private:factory/scalc*" ); - pFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); - - ScDocShellRef xDocSh = new ScDocShell; - SfxMedium* pMedium = new SfxMedium(aFileName, StreamMode::STD_READWRITE); - SfxItemSet* pSet = pMedium->GetItemSet(); - pSet->Put(SfxStringItem(SID_PASSWORD, "test")); - pMedium->SetFilter(pFilter); - if (!xDocSh->DoLoad(pMedium)) - { - xDocSh->DoClose(); - // load failed. - xDocSh.clear(); - } + SfxFilterFlags nFormatType = getFileFormats()[0].nFormatType; + OUString aPass("test"); + ScDocShellRef xDocSh = ScBootstrapFixture::load(aFileName, aFilterName, OUString(), aFilterType, + nFormatType, SotClipboardFormatId::STARCALC_8, SOFFICE_FILEFORMAT_CURRENT, &aPass); CPPUNIT_ASSERT_MESSAGE("Failed to load password.ods", xDocSh.is()); xDocSh->DoClose(); |