diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-11-28 21:02:17 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-12-05 13:23:48 +0000 |
commit | 042bf6f00c5e01b44ec1d95371ad809db4c5269f (patch) | |
tree | e1741c323369bb7bdb4013453d2f28d81b88d19c /sw | |
parent | 57db9a4fdbee6db24b381f3ea48b3df089c555fc (diff) |
Revert: "split sw_filters unit test"
This commit reverts 1c2ea35b983c1159fe4633e449f8302ac9a7a024
it shouldn't be needed anymore after
cdac145768488dc11b32b744bc753ab16aa08c6e "reduce cost of
SwpHints::Check"
Change-Id: I32a1d963f7bf90838c68db3bfefc8c8750e94128
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143417
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/CppunitTest_sw_filters_test2.mk | 66 | ||||
-rw-r--r-- | sw/Module_sw.mk | 1 | ||||
-rw-r--r-- | sw/qa/core/filters-test.cxx | 4 | ||||
-rw-r--r-- | sw/qa/core/filters-test2.cxx | 150 |
4 files changed, 4 insertions, 217 deletions
diff --git a/sw/CppunitTest_sw_filters_test2.mk b/sw/CppunitTest_sw_filters_test2.mk deleted file mode 100644 index 71f7796ff853..000000000000 --- a/sw/CppunitTest_sw_filters_test2.mk +++ /dev/null @@ -1,66 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -#************************************************************************* -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -#************************************************************************* - -$(eval $(call gb_CppunitTest_CppunitTest,sw_filters_test2)) - -$(eval $(call gb_CppunitTest_use_externals,sw_filters_test2,\ - boost_headers \ - libxml2 \ -)) - -$(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_filters_test2)) - -$(eval $(call gb_CppunitTest_add_exception_objects,sw_filters_test2, \ - sw/qa/core/filters-test2 \ -)) - -$(eval $(call gb_CppunitTest_use_libraries,sw_filters_test2, \ - sw \ - sfx \ - subsequenttest \ - svl \ - svt \ - sot \ - test \ - tl \ - ucbhelper \ - unotest \ - utl \ - vcl \ - i18nlangtag \ - comphelper \ - cppu \ - cppuhelper \ - sal \ -)) - -$(eval $(call gb_CppunitTest_set_include,sw_filters_test2,\ - -I$(SRCDIR)/sw/inc \ - $$(INCLUDE) \ -)) - -$(eval $(call gb_CppunitTest_use_api,sw_filters_test2,\ - udkapi \ - offapi \ - oovbaapi \ -)) - -$(eval $(call gb_CppunitTest_use_ure,sw_filters_test2)) -$(eval $(call gb_CppunitTest_use_vcl,sw_filters_test2)) - -$(eval $(call gb_CppunitTest_use_rdb,sw_filters_test2,services)) - -$(eval $(call gb_CppunitTest_use_configuration,sw_filters_test2)) - -$(call gb_CppunitTest_get_target,sw_filters_test2): \ - $(call gb_Package_get_target,extras_tplwizdesktop) - -# vim: set noet sw=4 ts=4: diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index 1f7a90605a11..8a217a85fbf6 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -167,7 +167,6 @@ endif ifneq ($(DISABLE_CVE_TESTS),TRUE) $(eval $(call gb_Module_add_slowcheck_targets,sw,\ CppunitTest_sw_filters_test \ - CppunitTest_sw_filters_test2 \ )) endif diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx index e880e428fc34..f4723b0e94cd 100644 --- a/sw/qa/core/filters-test.cxx +++ b/sw/qa/core/filters-test.cxx @@ -148,6 +148,10 @@ void SwFiltersTest::testCVEs() m_directories.getURLFromSrc(u"/sw/qa/core/data/ww8/"), FILTER_WW8); + testDir("MS WinWord 6.0", + m_directories.getURLFromSrc(u"/sw/qa/core/data/ww6/"), + sWW6); + testDir("MS WinWord 5", m_directories.getURLFromSrc(u"/sw/qa/core/data/ww5/"), sWW5); diff --git a/sw/qa/core/filters-test2.cxx b/sw/qa/core/filters-test2.cxx deleted file mode 100644 index 08736b962a85..000000000000 --- a/sw/qa/core/filters-test2.cxx +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include <unotest/filters-test.hxx> -#include <test/bootstrapfixture.hxx> - -#include <sfx2/app.hxx> -#include <sfx2/docfilt.hxx> -#include <sfx2/docfile.hxx> -#include <sfx2/sfxsids.hrc> -#include <sfx2/fcontnr.hxx> - -#include <svl/stritem.hxx> -#include <unotools/tempfile.hxx> - -#include <iodetect.hxx> -#include <docsh.hxx> - -typedef tools::SvRef<SwDocShell> SwDocShellRef; - -using namespace ::com::sun::star; - -/* Implementation of Filters test */ - -class SwFiltersTest2 : public test::FiltersTest, public test::BootstrapFixture -{ -public: - virtual bool load(const OUString& rFilter, const OUString& rURL, const OUString& rUserData, - SfxFilterFlags nFilterFlags, SotClipboardFormatId nClipboardID, - unsigned int nFilterVersion) override; - virtual bool save(const OUString& rFilter, const OUString& rURL, const OUString& rUserData, - SfxFilterFlags nFilterFlags, SotClipboardFormatId nClipboardID, - unsigned int nFilterVersion) override; - virtual void setUp() override; - virtual void tearDown() override; - - // Ensure CVEs remain unbroken - void testCVEs(); - - CPPUNIT_TEST_SUITE(SwFiltersTest2); - CPPUNIT_TEST(testCVEs); - CPPUNIT_TEST_SUITE_END(); - -private: - bool filter(const OUString& rFilter, const OUString& rURL, const OUString& rUserData, - SfxFilterFlags nFilterFlags, SotClipboardFormatId nClipboardID, - unsigned int nFilterVersion, bool bExport); - uno::Reference<uno::XInterface> m_xWriterComponent; -}; - -bool SwFiltersTest2::load(const OUString& rFilter, const OUString& rURL, const OUString& rUserData, - SfxFilterFlags nFilterFlags, SotClipboardFormatId nClipboardID, - unsigned int nFilterVersion) -{ - return filter(rFilter, rURL, rUserData, nFilterFlags, nClipboardID, nFilterVersion, false); -} - -bool SwFiltersTest2::save(const OUString& rFilter, const OUString& rURL, const OUString& rUserData, - SfxFilterFlags nFilterFlags, SotClipboardFormatId nClipboardID, - unsigned int nFilterVersion) -{ - return filter(rFilter, rURL, rUserData, nFilterFlags, nClipboardID, nFilterVersion, true); -} - -bool SwFiltersTest2::filter(const OUString& rFilter, const OUString& rURL, - const OUString& rUserData, SfxFilterFlags nFilterFlags, - SotClipboardFormatId nClipboardID, unsigned int nFilterVersion, - bool bExport) -{ - auto pFilter = std::make_shared<SfxFilter>(rFilter, OUString(), nFilterFlags, nClipboardID, - OUString(), OUString(), rUserData, OUString()); - pFilter->SetVersion(nFilterVersion); - - SwDocShellRef xDocShRef = new SwDocShell; - SfxMedium* pSrcMed = new SfxMedium(rURL, StreamMode::STD_READ); - - std::shared_ptr<const SfxFilter> pImportFilter; - std::shared_ptr<const SfxFilter> pExportFilter; - if (bExport) - { - SfxGetpApp()->GetFilterMatcher().GuessFilter(*pSrcMed, pImportFilter, - SfxFilterFlags::IMPORT, SfxFilterFlags::NONE); - pExportFilter = pFilter; - } - else - pImportFilter = pFilter; - - pSrcMed->SetFilter(pImportFilter); - - if (rUserData == FILTER_TEXT_DLG) - { - pSrcMed->GetItemSet()->Put( - SfxStringItem(SID_FILE_FILTEROPTIONS, "UTF8,LF,Liberation Mono,en-US")); - } - - bool bLoaded = xDocShRef->DoLoad(pSrcMed); - if (!bExport) - { - if (xDocShRef.is()) - xDocShRef->DoClose(); - return bLoaded; - } - - // How come an error may be set, and still DoLoad() returns success? Strange... - if (bLoaded) - xDocShRef->ResetError(); - - utl::TempFileNamed aTempFile; - aTempFile.EnableKillingFile(); - SfxMedium aDstMed(aTempFile.GetURL(), StreamMode::STD_WRITE); - aDstMed.SetFilter(pExportFilter); - bool bSaved = xDocShRef->DoSaveAs(aDstMed); - if (xDocShRef.is()) - xDocShRef->DoClose(); - return bSaved; -} - -void SwFiltersTest2::testCVEs() -{ - testDir("MS WinWord 6.0", m_directories.getURLFromSrc(u"/sw/qa/core/data/ww6/"), sWW6); -} - -void SwFiltersTest2::setUp() -{ - test::BootstrapFixture::setUp(); - - //This is a bit of a fudge, we do this to ensure that SwGlobals::ensure, - //which is a private symbol to us, gets called - m_xWriterComponent - = getMultiServiceFactory()->createInstance("com.sun.star.comp.Writer.TextDocument"); - CPPUNIT_ASSERT_MESSAGE("no writer component!", m_xWriterComponent.is()); -} - -void SwFiltersTest2::tearDown() -{ - uno::Reference<lang::XComponent>(m_xWriterComponent, uno::UNO_QUERY_THROW)->dispose(); - m_xWriterComponent.clear(); -} - -CPPUNIT_TEST_SUITE_REGISTRATION(SwFiltersTest2); - -CPPUNIT_PLUGIN_IMPLEMENT(); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |