sd/CppunitTest_sd_layout_tests.mk | 77 ++++++++++++++++++++++++++++++++++++ sd/Module_sd.mk | 1 sd/qa/unit/data/pptx/tdf104722.pptx |binary sd/qa/unit/layout-tests.cxx | 48 ++++++++++++++++++++++ 4 files changed, 126 insertions(+)
New commits: commit 701b46ae0e8d6eb162d8cb307f5a72e35f4a36a8 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Wed Sep 23 15:27:51 2020 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Wed Sep 23 17:38:37 2020 +0200 tdf#104722: sd_layout_tests: Add unittest Change-Id: I5b255330a3cdd6bc9a5e6d47d894a6f6346d69bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103251 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sd/CppunitTest_sd_layout_tests.mk b/sd/CppunitTest_sd_layout_tests.mk new file mode 100644 index 000000000000..03075c2c7be8 --- /dev/null +++ b/sd/CppunitTest_sd_layout_tests.mk @@ -0,0 +1,77 @@ +# -*- 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,sd_layout_tests)) + +$(eval $(call gb_CppunitTest_use_externals,sd_layout_tests,\ + boost_headers \ + libxml2 \ +)) + +$(eval $(call gb_CppunitTest_use_common_precompiled_header,sd_layout_tests)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sd_layout_tests, \ + sd/qa/unit/layout-tests \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,sd_layout_tests, \ + $(call gb_Helper_optional,AVMEDIA,avmedia) \ + basegfx \ + comphelper \ + cppu \ + cppuhelper \ + drawinglayer \ + editeng \ + for \ + forui \ + i18nlangtag \ + msfilter \ + oox \ + sal \ + salhelper \ + sax \ + sd \ + sfx \ + sot \ + svl \ + svt \ + svx \ + svxcore \ + test \ + tl \ + tk \ + ucbhelper \ + unotest \ + utl \ + vcl \ + xo \ +)) + +$(eval $(call gb_CppunitTest_set_include,sd_layout_tests,\ + -I$(SRCDIR)/sd/source/ui/inc \ + -I$(SRCDIR)/sd/inc \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_CppunitTest_use_sdk_api,sd_layout_tests)) + +$(eval $(call gb_CppunitTest_use_ure,sd_layout_tests)) +$(eval $(call gb_CppunitTest_use_vcl,sd_layout_tests)) + +$(eval $(call gb_CppunitTest_use_rdb,sd_layout_tests,services)) + +$(eval $(call gb_CppunitTest_use_custom_headers,sd_layout_tests,\ + officecfg/registry \ +)) + +$(eval $(call gb_CppunitTest_use_configuration,sd_layout_tests)) + +# vim: set noet sw=4 ts=4: diff --git a/sd/Module_sd.mk b/sd/Module_sd.mk index d5c6b2ecab23..7ded538d3be0 100644 --- a/sd/Module_sd.mk +++ b/sd/Module_sd.mk @@ -35,6 +35,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sd,\ CppunitTest_sd_export_ooxml2 \ CppunitTest_sd_export_tests \ CppunitTest_sd_filters_test \ + CppunitTest_sd_layout_tests \ CppunitTest_sd_misc_tests \ CppunitTest_sd_uiimpress \ CppunitTest_sd_html_export_tests \ diff --git a/sd/qa/unit/data/pptx/tdf104722.pptx b/sd/qa/unit/data/pptx/tdf104722.pptx new file mode 100644 index 000000000000..27ea41958029 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf104722.pptx differ diff --git a/sd/qa/unit/layout-tests.cxx b/sd/qa/unit/layout-tests.cxx new file mode 100644 index 000000000000..d6643f82420a --- /dev/null +++ b/sd/qa/unit/layout-tests.cxx @@ -0,0 +1,48 @@ +/* -*- 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 "sdmodeltestbase.hxx" + +class SdLayoutTest : public SdModelTestBaseXML +{ +public: + void testTdf104722(); + + CPPUNIT_TEST_SUITE(SdLayoutTest); + + CPPUNIT_TEST(testTdf104722); + + CPPUNIT_TEST_SUITE_END(); +}; + +void SdLayoutTest::testTdf104722() +{ + sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf104722.pptx"), PPTX); + + std::shared_ptr<GDIMetaFile> xMetaFile = xDocShRef->GetPreviewMetaFile(); + MetafileXmlDump dumper; + + xmlDocUniquePtr pXmlDoc = XmlTestTools::dumpAndParse(dumper, *xMetaFile); + CPPUNIT_ASSERT(pXmlDoc); + + // Without the fix in place, this would have failed with + // - Expected: 2093 + // - Actual : -10276 + assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]", "x", "2093"); + + assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]", "y", "9273"); + + xDocShRef->DoClose(); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(SdLayoutTest); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits