diff --git a/chart2/CppunitTest_chart2_xshape.mk b/chart2/CppunitTest_chart2_xshape.mk new file mode 100644 index 000000000000..f2b3c15635b2 --- /dev/null +++ b/chart2/CppunitTest_chart2_xshape.mk @@ -0,0 +1,130 @@ +# -*- 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,chart2_xshape)) + +$(eval $(call gb_CppunitTest_use_externals,chart2_xshape, \ + boost_headers \ + libxml2 \ +)) + +$(eval $(call gb_CppunitTest_add_exception_objects,chart2_xshape, \ + chart2/qa/extras/xshape/chart2xshape \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,chart2_xshape, \ + avmedia \ + basegfx \ + comphelper \ + cppu \ + cppuhelper \ + drawinglayer \ + editeng \ + for \ + forui \ + i18nlangtag \ + msfilter \ + vcl \ + oox \ + sal \ + salhelper \ + sax \ + sb \ + sc \ + sw \ + sd \ + sfx \ + sot \ + svl \ + svt \ + svx \ + svxcore \ + test \ + tl \ + tk \ + ucbhelper \ + unotest \ + utl \ + vbahelper \ + xo \ + sw \ + $(gb_UWINAPI) \ +)) + +$(eval $(call gb_CppunitTest_set_include,chart2_xshape,\ + -I$(SRCDIR)/chart2/qa/extras \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_CppunitTest_use_api,chart2_xshape,\ + offapi \ + udkapi \ +)) + +$(eval $(call gb_CppunitTest_use_ure,chart2_xshape)) + +$(eval $(call gb_CppunitTest_use_components,chart2_xshape,\ + basic/util/sb \ + animations/source/animcore/animcore \ + chart2/source/controller/chartcontroller \ + chart2/source/chartcore \ + comphelper/util/comphelp \ + configmgr/source/configmgr \ + dtrans/util/mcnttype \ + embeddedobj/util/embobj \ + eventattacher/source/evtatt \ + filter/source/config/cache/filterconfig1 \ + forms/util/frm \ + framework/util/fwk \ + i18npool/util/i18npool \ + linguistic/source/lng \ + oox/util/oox \ + package/source/xstor/xstor \ + package/util/package2 \ + sax/source/expatwrap/expwrap \ + sc/util/sc \ + sc/util/scd \ + sc/util/scfilt \ + sw/util/sw \ + sw/util/swd \ + sw/util/msword \ + sd/util/sd \ + sd/util/sdfilt \ + sd/util/sdd \ + $(if $(filter TRUE,$(DISABLE_SCRIPTING)),, \ + sc/util/vbaobj) \ + scaddins/source/analysis/analysis \ + scaddins/source/datefunc/date \ + scripting/source/basprov/basprov \ + scripting/util/scriptframe \ + sfx2/util/sfx \ + sot/util/sot \ + svl/source/fsstor/fsstorage \ + svl/util/svl \ + svtools/util/svt \ + svx/util/svx \ + svx/util/svxcore \ + toolkit/util/tk \ + ucb/source/core/ucb1 \ + ucb/source/ucp/file/ucpfile1 \ + ucb/source/ucp/tdoc/ucptdoc1 \ + unotools/util/utl \ + unoxml/source/rdf/unordf \ + unoxml/source/service/unoxml \ + writerfilter/util/writerfilter \ + xmloff/util/xo \ +)) + +$(eval $(call gb_CppunitTest_use_configuration,chart2_xshape)) + +$(eval $(call gb_CppunitTest_use_unittest_configuration,chart2_xshape)) + +# vim: set noet sw=4 ts=4: diff --git a/chart2/Module_chart2.mk b/chart2/Module_chart2.mk index 611e699705a9..dba950679e9d 100644 --- a/chart2/Module_chart2.mk +++ b/chart2/Module_chart2.mk @@ -28,6 +28,13 @@ $(eval $(call gb_Module_add_slowcheck_targets,chart2,\ CppunitTest_chart2_import \ )) +ifeq ($(ENABLE_CHART_TESTS),TRUE) +$(eval $(call gb_Module_add_slowcheck_targets,chart2,\ + CppunitTest_chart2_xshape \ +)) + +endif + $(eval $(call gb_Module_add_subsequentcheck_targets,chart2,\ JunitTest_chart2_unoapi \ )) diff --git a/chart2/qa/extras/xshape/chart2xshape.cxx b/chart2/qa/extras/xshape/chart2xshape.cxx new file mode 100644 index 000000000000..ba100a694082 --- /dev/null +++ b/chart2/qa/extras/xshape/chart2xshape.cxx @@ -0,0 +1,86 @@ +/* -*- 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 "charttest.hxx" +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include + +class Chart2XShapeTest : public ChartTest +{ +public: + + void testFdo75075(); + + CPPUNIT_TEST_SUITE(Chart2XShapeTest); + CPPUNIT_TEST(testFdo75075); + CPPUNIT_TEST_SUITE_END(); + +private: + + void compareAgainstReference(const OUString& rReferenceFile, bool bCreateReference = false); + +}; + +namespace { + +bool checkDumpAgainstFile( const OUString& rDump, const OUString aFilePath) +{ + OString aOFile = OUStringToOString(aFilePath, RTL_TEXTENCODING_UTF8); + + CPPUNIT_ASSERT_MESSAGE("dump is empty", !rDump.isEmpty()); + + OString aDump = OUStringToOString(rDump, RTL_TEXTENCODING_UTF8); + return doXMLDiff(aOFile.getStr(), aDump.getStr(), + static_cast(rDump.getLength()), NULL); +} + +} + +void Chart2XShapeTest::compareAgainstReference(const OUString& rReferenceFile, bool bCreateReference) +{ + uno::Reference< chart::XChartDocument > xChartDoc ( getChartCompFromSheet( 0, mxComponent ), UNO_QUERY_THROW); + uno::Reference< qa::XDumper > xDumper( xChartDoc, UNO_QUERY_THROW ); + OUString aDump = xDumper->dump(); + OUString aReference = getPathFromSrc("/chart2/qa/extras/xshape/data/reference/") + rReferenceFile; + if(bCreateReference) + { + OString aOFile = OUStringToOString(aReference, RTL_TEXTENCODING_UTF8); + OString aODump = OUStringToOString(aDump, RTL_TEXTENCODING_UTF8); + std::ofstream aReferenceFile(aOFile.getStr()); + aReferenceFile << aODump.getStr(); + } + else + { + checkDumpAgainstFile(aDump, aReference); + } +} + +void Chart2XShapeTest::testFdo75075() +{ + load("chart2/qa/extras/xshape/data/ods/", "fdo75075.ods"); + compareAgainstReference("fdo75075.xml"); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(Chart2XShapeTest); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/qa/extras/xshape/data/ods/fdo75075.ods b/chart2/qa/extras/xshape/data/ods/fdo75075.ods new file mode 100644 index 000000000000..d2a1be49bf48 Binary files /dev/null and b/chart2/qa/extras/xshape/data/ods/fdo75075.ods differ diff --git a/chart2/qa/extras/xshape/data/reference/fdo75075.xml b/chart2/qa/extras/xshape/data/reference/fdo75075.xml new file mode 100644 index 000000000000..38572489ef8b --- /dev/null +++ b/chart2/qa/extras/xshape/data/reference/fdo75075.xml @@ -0,0 +1,1690 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config_host.mk.in b/config_host.mk.in index bcb4e975a461..6eb2c1ac2f77 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -107,6 +107,7 @@ export EBOOK_CFLAGS=$(gb_SPACE)@EBOOK_CFLAGS@ export EBOOK_LIBS=$(gb_SPACE)@EBOOK_LIBS@ export ENABLE_AVAHI=@ENABLE_AVAHI@ export ENABLE_CAIRO_CANVAS=@ENABLE_CAIRO_CANVAS@ +export ENABLE_CHART_TESTS=@ENABLE_CHART_TESTS@ export ENABLE_CMIS=@ENABLE_CMIS@ export ENABLE_COINMP=@ENABLE_COINMP@ export ENABLE_CRASHDUMP=@ENABLE_CRASHDUMP@ diff --git a/configure.ac b/configure.ac index 3726dfad8f41..940d260f5603 100644 --- a/configure.ac +++ b/configure.ac @@ -1130,6 +1130,11 @@ AC_ARG_ENABLE(cve-tests, [Prevent CVE tests to be executed]), ,) +AC_ARG_ENABLE(chart-tests, + AS_HELP_STRING([--enable-chart-tests], + [Executes chart XShape tests]), +,) + AC_ARG_ENABLE(build-unowinreg, AS_HELP_STRING([--enable-build-unowinreg], [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++ @@ -9193,6 +9198,18 @@ else AC_MSG_RESULT([yes]) fi +dnl =================================================================== +dnl Check for enabling chart XShape tests +dnl =================================================================== +AC_MSG_CHECKING([whether to execute chart XShape tests]) +if test "$enable_chart_tests" = "yes"; then + AC_MSG_RESULT([yes]) + ENABLE_CHART_TESTS=TRUE + AC_SUBST(ENABLE_CHART_TESTS) +else + AC_MSG_RESULT([no]) +fi + dnl =================================================================== dnl Check for system openssl dnl ===================================================================