sc/qa/unit/subsequent_filters_test.cxx |   23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

New commits:
commit 44e1dbb95de4b2cf326ef5d29be6432e195dfb01
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Sep 17 14:56:54 2021 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Sep 17 16:39:32 2021 +0200

    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 <xiscofa...@libreoffice.org>

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();

Reply via email to