Split CppunitTest_chart2_export into two
it already had 148 tests Change-Id: I83e0055bcf1449cd48a28149a6ef0b149a1d6901 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116914 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
parent
dbd86edb55
commit
94fdd0191f
10 changed files with 1654 additions and 1422 deletions
|
@ -9,130 +9,7 @@
|
|||
#
|
||||
#*************************************************************************
|
||||
|
||||
$(eval $(call gb_CppunitTest_CppunitTest,chart2_export))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_externals,chart2_export, \
|
||||
boost_headers \
|
||||
libxml2 \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_add_exception_objects,chart2_export, \
|
||||
chart2/qa/extras/chart2export \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_libraries,chart2_export, \
|
||||
$(call gb_Helper_optional,AVMEDIA,avmedia) \
|
||||
basegfx \
|
||||
comphelper \
|
||||
cppu \
|
||||
cppuhelper \
|
||||
drawinglayer \
|
||||
editeng \
|
||||
for \
|
||||
forui \
|
||||
i18nlangtag \
|
||||
msfilter \
|
||||
oox \
|
||||
sal \
|
||||
salhelper \
|
||||
sax \
|
||||
sb \
|
||||
sc \
|
||||
sw \
|
||||
sd \
|
||||
sfx \
|
||||
sot \
|
||||
svl \
|
||||
svt \
|
||||
svx \
|
||||
svxcore \
|
||||
test \
|
||||
tl \
|
||||
tk \
|
||||
ucbhelper \
|
||||
unotest \
|
||||
utl \
|
||||
vbahelper \
|
||||
vcl \
|
||||
xo \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_set_include,chart2_export,\
|
||||
-I$(SRCDIR)/chart2/inc \
|
||||
$$(INCLUDE) \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_sdk_api,chart2_export))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_ure,chart2_export))
|
||||
$(eval $(call gb_CppunitTest_use_vcl,chart2_export))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_components,chart2_export,\
|
||||
basic/util/sb \
|
||||
animations/source/animcore/animcore \
|
||||
chart2/source/controller/chartcontroller \
|
||||
chart2/source/chartcore \
|
||||
comphelper/util/comphelp \
|
||||
configmgr/source/configmgr \
|
||||
dbaccess/util/dba \
|
||||
embeddedobj/util/embobj \
|
||||
emfio/emfio \
|
||||
eventattacher/source/evtatt \
|
||||
filter/source/config/cache/filterconfig1 \
|
||||
filter/source/odfflatxml/odfflatxml \
|
||||
filter/source/storagefilterdetect/storagefd \
|
||||
filter/source/xmlfilteradaptor/xmlfa \
|
||||
filter/source/xmlfilterdetect/xmlfd \
|
||||
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 \
|
||||
$(call gb_Helper_optional,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 \
|
||||
vcl/vcl.common \
|
||||
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 \
|
||||
uui/util/uui \
|
||||
writerfilter/util/writerfilter \
|
||||
xmloff/util/xo \
|
||||
xmlscript/util/xmlscript \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_uiconfigs,chart2_export, \
|
||||
modules/swriter \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_configuration,chart2_export))
|
||||
|
||||
$(call gb_CppunitTest_get_target,chart2_export): $(call gb_Package_get_target,postprocess_images)
|
||||
# empty second argument (i.e. no 1)
|
||||
$(eval $(call chart2_export_test,))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
||||
|
|
14
chart2/CppunitTest_chart2_export2.mk
Normal file
14
chart2/CppunitTest_chart2_export2.mk
Normal file
|
@ -0,0 +1,14 @@
|
|||
# -*- 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 chart2_export_test,2))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
|
@ -7,6 +7,8 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
|
||||
include $(SRCDIR)/chart2/export_setup.mk
|
||||
|
||||
$(eval $(call gb_Module_Module,chart2))
|
||||
|
||||
$(eval $(call gb_Module_add_targets,chart2,\
|
||||
|
@ -26,6 +28,7 @@ $(eval $(call gb_Module_add_check_targets,chart2,\
|
|||
|
||||
$(eval $(call gb_Module_add_slowcheck_targets,chart2,\
|
||||
CppunitTest_chart2_export \
|
||||
CppunitTest_chart2_export2 \
|
||||
CppunitTest_chart2_import \
|
||||
CppunitTest_chart2_trendcalculators \
|
||||
CppunitTest_chart2_dump \
|
||||
|
|
143
chart2/export_setup.mk
Normal file
143
chart2/export_setup.mk
Normal file
|
@ -0,0 +1,143 @@
|
|||
# -*- 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/.
|
||||
#
|
||||
#*************************************************************************
|
||||
|
||||
# template for export tests
|
||||
define chart2_export$(1)_test
|
||||
|
||||
$(eval $(call gb_CppunitTest_CppunitTest,chart2_export$(1)))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_externals,chart2_export$(1), \
|
||||
boost_headers \
|
||||
libxml2 \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_add_exception_objects,chart2_export$(1), \
|
||||
chart2/qa/extras/chart2export$(1) \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_libraries,chart2_export$(1), \
|
||||
$(call gb_Helper_optional,AVMEDIA,avmedia) \
|
||||
basegfx \
|
||||
comphelper \
|
||||
cppu \
|
||||
cppuhelper \
|
||||
drawinglayer \
|
||||
editeng \
|
||||
for \
|
||||
forui \
|
||||
i18nlangtag \
|
||||
msfilter \
|
||||
oox \
|
||||
sal \
|
||||
salhelper \
|
||||
sax \
|
||||
sb \
|
||||
sc \
|
||||
sw \
|
||||
sd \
|
||||
sfx \
|
||||
sot \
|
||||
svl \
|
||||
svt \
|
||||
svx \
|
||||
svxcore \
|
||||
test \
|
||||
tl \
|
||||
tk \
|
||||
ucbhelper \
|
||||
unotest \
|
||||
utl \
|
||||
vbahelper \
|
||||
vcl \
|
||||
xo \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_set_include,chart2_export$(1),\
|
||||
-I$(SRCDIR)/chart2/inc \
|
||||
$$(INCLUDE) \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_sdk_api,chart2_export$(1)))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_ure,chart2_export$(1)))
|
||||
$(eval $(call gb_CppunitTest_use_vcl,chart2_export$(1)))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_components,chart2_export$(1),\
|
||||
basic/util/sb \
|
||||
animations/source/animcore/animcore \
|
||||
chart2/source/controller/chartcontroller \
|
||||
chart2/source/chartcore \
|
||||
comphelper/util/comphelp \
|
||||
configmgr/source/configmgr \
|
||||
dbaccess/util/dba \
|
||||
embeddedobj/util/embobj \
|
||||
emfio/emfio \
|
||||
eventattacher/source/evtatt \
|
||||
filter/source/config/cache/filterconfig1 \
|
||||
filter/source/odfflatxml/odfflatxml \
|
||||
filter/source/storagefilterdetect/storagefd \
|
||||
filter/source/xmlfilteradaptor/xmlfa \
|
||||
filter/source/xmlfilterdetect/xmlfd \
|
||||
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 \
|
||||
$(call gb_Helper_optional,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 \
|
||||
vcl/vcl.common \
|
||||
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 \
|
||||
uui/util/uui \
|
||||
writerfilter/util/writerfilter \
|
||||
xmloff/util/xo \
|
||||
xmlscript/util/xmlscript \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_uiconfigs,chart2_export$(1), \
|
||||
modules/swriter \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_configuration,chart2_export$(1)))
|
||||
|
||||
$(call gb_CppunitTest_get_target,chart2_export$(1)): $(call gb_Package_get_target,postprocess_images)
|
||||
|
||||
endef
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
|
@ -85,7 +85,7 @@
|
|||
} \
|
||||
}
|
||||
|
||||
class Chart2DumpTest : public ChartTest, public XmlTestTools
|
||||
class Chart2DumpTest : public ChartTest
|
||||
{
|
||||
protected:
|
||||
Chart2DumpTest(bool bDumpMode)
|
||||
|
|
File diff suppressed because it is too large
Load diff
1427
chart2/qa/extras/chart2export2.cxx
Normal file
1427
chart2/qa/extras/chart2export2.cxx
Normal file
File diff suppressed because it is too large
Load diff
|
@ -28,7 +28,7 @@
|
|||
using uno::Reference;
|
||||
using beans::XPropertySet;
|
||||
|
||||
class Chart2GeometryTest : public ChartTest, public XmlTestTools
|
||||
class Chart2GeometryTest : public ChartTest
|
||||
{
|
||||
protected:
|
||||
virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override;
|
||||
|
@ -71,72 +71,8 @@ public:
|
|||
CPPUNIT_TEST(testTdf135366_CustomLabelText);
|
||||
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Given that some problem doesn't affect the result in the importer, we
|
||||
* test the resulting file directly, by opening the zip file, parsing an
|
||||
* xml stream, and asserting an XPath expression. This method returns the
|
||||
* xml stream, so that you can do the asserting.
|
||||
*/
|
||||
xmlDocUniquePtr parseExport(const OUString& rDir, const OUString& rFilterFormat);
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
// This is copied from Chart2ExportTest. It allows to access the chart from a MS Office document
|
||||
// without knowing whether the file is a chart1.xml or chart2.xml... As of August 2020, Calc
|
||||
// and Impress use a static variable for the number and therefore the number depends on whether
|
||||
// there had already been savings before.
|
||||
struct CheckForChartName
|
||||
{
|
||||
private:
|
||||
OUString aDir;
|
||||
|
||||
public:
|
||||
explicit CheckForChartName(const OUString& rDir)
|
||||
: aDir(rDir)
|
||||
{
|
||||
}
|
||||
|
||||
bool operator()(const OUString& rName)
|
||||
{
|
||||
if (!rName.startsWith(aDir))
|
||||
return false;
|
||||
|
||||
if (!rName.endsWith(".xml"))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
OUString findChartFile(const OUString& rDir, uno::Reference<container::XNameAccess> const& xNames)
|
||||
{
|
||||
uno::Sequence<OUString> aNames = xNames->getElementNames();
|
||||
OUString* pElement = std::find_if(aNames.begin(), aNames.end(), CheckForChartName(rDir));
|
||||
|
||||
CPPUNIT_ASSERT(pElement != aNames.end());
|
||||
return *pElement;
|
||||
}
|
||||
}
|
||||
|
||||
xmlDocUniquePtr Chart2GeometryTest::parseExport(const OUString& rDir, const OUString& rFilterFormat)
|
||||
{
|
||||
std::shared_ptr<utl::TempFile> pTempFile = save(rFilterFormat);
|
||||
|
||||
// Read the XML stream we're interested in.
|
||||
uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
|
||||
= packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory),
|
||||
pTempFile->GetURL());
|
||||
uno::Reference<io::XInputStream> xInputStream(
|
||||
xNameAccess->getByName(findChartFile(rDir, xNameAccess)), uno::UNO_QUERY);
|
||||
CPPUNIT_ASSERT(xInputStream.is());
|
||||
std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true));
|
||||
|
||||
return parseXmlStream(pStream.get());
|
||||
}
|
||||
|
||||
void Chart2GeometryTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx)
|
||||
{
|
||||
XmlTestTools::registerOOXMLNamespaces(pXmlXPathCtx);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <test/bootstrapfixture.hxx>
|
||||
#include <test/xmltesttools.hxx>
|
||||
#include <unotest/macros_test.hxx>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <comphelper/propertysequence.hxx>
|
||||
|
@ -27,6 +28,7 @@
|
|||
#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
|
||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||
#include <com/sun/star/frame/XStorable.hpp>
|
||||
#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
|
||||
|
||||
#include <unotools/tempfile.hxx>
|
||||
#include <rtl/math.hxx>
|
||||
|
@ -60,6 +62,8 @@
|
|||
#include <com/sun/star/embed/XVisualObject.hpp>
|
||||
#include <com/sun/star/chart2/RelativeSize.hpp>
|
||||
|
||||
#include <unotools/ucbstreamhelper.hxx>
|
||||
|
||||
using namespace css;
|
||||
using namespace css::uno;
|
||||
|
||||
|
@ -68,7 +72,41 @@ namespace com::sun::star::chart2 { class XDiagram; }
|
|||
namespace com::sun::star::table { class XTableCharts; }
|
||||
namespace com::sun::star::table { class XTablePivotCharts; }
|
||||
|
||||
class ChartTest : public test::BootstrapFixture, public unotest::MacrosTest
|
||||
namespace {
|
||||
|
||||
struct CheckForChartName
|
||||
{
|
||||
private:
|
||||
OUString aDir;
|
||||
|
||||
public:
|
||||
explicit CheckForChartName( const OUString& rDir ):
|
||||
aDir(rDir) {}
|
||||
|
||||
bool operator()(const OUString& rName)
|
||||
{
|
||||
if(!rName.startsWith(aDir))
|
||||
return false;
|
||||
|
||||
if(!rName.endsWith(".xml"))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
OUString findChartFile(const OUString& rDir, uno::Reference< container::XNameAccess > const & xNames )
|
||||
{
|
||||
uno::Sequence<OUString> aNames = xNames->getElementNames();
|
||||
OUString* pElement = std::find_if(aNames.begin(), aNames.end(), CheckForChartName(rDir));
|
||||
|
||||
CPPUNIT_ASSERT(pElement != aNames.end());
|
||||
return *pElement;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ChartTest : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools
|
||||
{
|
||||
public:
|
||||
ChartTest():mbSkipValidation(false) {}
|
||||
|
@ -93,6 +131,14 @@ protected:
|
|||
Reference< lang::XComponent > mxComponent;
|
||||
OUString maServiceName;
|
||||
bool mbSkipValidation; // if you set this flag for a new test I'm going to haunt you!
|
||||
|
||||
/**
|
||||
* Given that some problem doesn't affect the result in the importer, we
|
||||
* test the resulting file directly, by opening the zip file, parsing an
|
||||
* xml stream, and asserting an XPath expression. This method returns the
|
||||
* xml stream, so that you can do the asserting.
|
||||
*/
|
||||
xmlDocUniquePtr parseExport(const OUString& rDir, const OUString& rFilterFormat);
|
||||
};
|
||||
|
||||
OUString ChartTest::getFileExtension( const OUString& aFileName )
|
||||
|
@ -639,4 +685,17 @@ getShapeByName(const uno::Reference<drawing::XShapes>& rShapes, const OUString&
|
|||
return uno::Reference<drawing::XShape>();
|
||||
}
|
||||
|
||||
xmlDocUniquePtr ChartTest::parseExport(const OUString& rDir, const OUString& rFilterFormat)
|
||||
{
|
||||
std::shared_ptr<utl::TempFile> pTempFile = save(rFilterFormat);
|
||||
|
||||
// Read the XML stream we're interested in.
|
||||
uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), pTempFile->GetURL());
|
||||
uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName(findChartFile(rDir, xNameAccess)), uno::UNO_QUERY);
|
||||
CPPUNIT_ASSERT(xInputStream.is());
|
||||
std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true));
|
||||
|
||||
return parseXmlStream(pStream.get());
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <fstream>
|
||||
#include <string_view>
|
||||
|
||||
class Chart2XShapeTest : public ChartTest, public XmlTestTools
|
||||
class Chart2XShapeTest : public ChartTest
|
||||
{
|
||||
public:
|
||||
void testFdo75075();
|
||||
|
|
Loading…
Reference in a new issue