[Libreoffice-commits] core.git: 4 commits - sal/cppunittester sd/CppunitTest_sd_export_ooxml1.mk sd/CppunitTest_sd_export_ooxml2.mk sd/Module_sd.mk sd/qa sw/qa
Michael Stahl
mstahl at redhat.com
Fri Jul 1 09:25:35 UTC 2016
sal/cppunittester/cppunittester.cxx | 9
sd/CppunitTest_sd_export_ooxml1.mk | 84 ++
sd/CppunitTest_sd_export_ooxml2.mk | 84 ++
sd/Module_sd.mk | 2
sd/qa/unit/export-tests-ooxml1.cxx | 847 ++++++++++++++++++++
sd/qa/unit/export-tests-ooxml2.cxx | 677 ++++++++++++++++
sd/qa/unit/export-tests.cxx | 1214 ------------------------------
sd/qa/unit/sdmodeltestbase.hxx | 20
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 2
sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 8
sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 8
11 files changed, 1727 insertions(+), 1228 deletions(-)
New commits:
commit 3fc82623635ff8e57df2c92811abd9d7e481c046
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Jun 30 20:52:34 2016 +0200
sd: sd_export_ooxml still takes the most time, split it in 2
Change-Id: Ib102ba9b54c4b7730c583e3cb5e769f70fcb5b09
diff --git a/sd/CppunitTest_sd_export_ooxml.mk b/sd/CppunitTest_sd_export_ooxml.mk
deleted file mode 100644
index e7f1520..0000000
--- a/sd/CppunitTest_sd_export_ooxml.mk
+++ /dev/null
@@ -1,84 +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,sd_export_ooxml))
-
-$(eval $(call gb_CppunitTest_use_externals,sd_export_ooxml,\
- boost_headers \
- libxml2 \
-))
-
-$(eval $(call gb_CppunitTest_add_exception_objects,sd_export_ooxml, \
- sd/qa/unit/export-tests-ooxml \
-))
-
-$(eval $(call gb_CppunitTest_use_libraries,sd_export_ooxml, \
- $(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 \
- $(gb_UWINAPI) \
-))
-
-$(eval $(call gb_CppunitTest_set_include,sd_export_ooxml,\
- -I$(SRCDIR)/sd/source/ui/inc \
- -I$(SRCDIR)/sd/inc \
- $$(INCLUDE) \
-))
-
-$(eval $(call gb_CppunitTest_use_sdk_api,sd_export_ooxml))
-
-$(eval $(call gb_CppunitTest_use_ure,sd_export_ooxml))
-$(eval $(call gb_CppunitTest_use_vcl,sd_export_ooxml))
-
-$(eval $(call gb_CppunitTest_use_rdb,sd_export_ooxml,services))
-
-$(eval $(call gb_CppunitTest_use_custom_headers,sd_export_ooxml,\
- officecfg/registry \
-))
-
-$(eval $(call gb_CppunitTest_use_configuration,sd_export_ooxml))
-
-$(eval $(call gb_CppunitTest_add_arguments,sd_export_ooxml,\
- -env:SVG_DISABLE_FONT_EMBEDDING= \
-))
-
-$(call gb_CppunitTest_get_target,sd_export_ooxml): \
- $(call gb_AllLangResTarget_get_target,avmedia) \
- $(call gb_AllLangResTarget_get_target,sd)
-
-# vim: set noet sw=4 ts=4:
diff --git a/sd/CppunitTest_sd_export_ooxml1.mk b/sd/CppunitTest_sd_export_ooxml1.mk
new file mode 100644
index 0000000..9009de0
--- /dev/null
+++ b/sd/CppunitTest_sd_export_ooxml1.mk
@@ -0,0 +1,84 @@
+# -*- 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_export_ooxml1))
+
+$(eval $(call gb_CppunitTest_use_externals,sd_export_ooxml1,\
+ boost_headers \
+ libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sd_export_ooxml1, \
+ sd/qa/unit/export-tests-ooxml1 \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sd_export_ooxml1, \
+ $(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 \
+ $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sd_export_ooxml1,\
+ -I$(SRCDIR)/sd/source/ui/inc \
+ -I$(SRCDIR)/sd/inc \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sd_export_ooxml1))
+
+$(eval $(call gb_CppunitTest_use_ure,sd_export_ooxml1))
+$(eval $(call gb_CppunitTest_use_vcl,sd_export_ooxml1))
+
+$(eval $(call gb_CppunitTest_use_rdb,sd_export_ooxml1,services))
+
+$(eval $(call gb_CppunitTest_use_custom_headers,sd_export_ooxml1,\
+ officecfg/registry \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sd_export_ooxml1))
+
+$(eval $(call gb_CppunitTest_add_arguments,sd_export_ooxml1,\
+ -env:SVG_DISABLE_FONT_EMBEDDING= \
+))
+
+$(call gb_CppunitTest_get_target,sd_export_ooxml1): \
+ $(call gb_AllLangResTarget_get_target,avmedia) \
+ $(call gb_AllLangResTarget_get_target,sd)
+
+# vim: set noet sw=4 ts=4:
diff --git a/sd/CppunitTest_sd_export_ooxml2.mk b/sd/CppunitTest_sd_export_ooxml2.mk
new file mode 100644
index 0000000..143cd60
--- /dev/null
+++ b/sd/CppunitTest_sd_export_ooxml2.mk
@@ -0,0 +1,84 @@
+# -*- 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_export_ooxml2))
+
+$(eval $(call gb_CppunitTest_use_externals,sd_export_ooxml2,\
+ boost_headers \
+ libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sd_export_ooxml2, \
+ sd/qa/unit/export-tests-ooxml2 \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sd_export_ooxml2, \
+ $(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 \
+ $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sd_export_ooxml2,\
+ -I$(SRCDIR)/sd/source/ui/inc \
+ -I$(SRCDIR)/sd/inc \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sd_export_ooxml2))
+
+$(eval $(call gb_CppunitTest_use_ure,sd_export_ooxml2))
+$(eval $(call gb_CppunitTest_use_vcl,sd_export_ooxml2))
+
+$(eval $(call gb_CppunitTest_use_rdb,sd_export_ooxml2,services))
+
+$(eval $(call gb_CppunitTest_use_custom_headers,sd_export_ooxml2,\
+ officecfg/registry \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sd_export_ooxml2))
+
+$(eval $(call gb_CppunitTest_add_arguments,sd_export_ooxml2,\
+ -env:SVG_DISABLE_FONT_EMBEDDING= \
+))
+
+$(call gb_CppunitTest_get_target,sd_export_ooxml2): \
+ $(call gb_AllLangResTarget_get_target,avmedia) \
+ $(call gb_AllLangResTarget_get_target,sd)
+
+# vim: set noet sw=4 ts=4:
diff --git a/sd/Module_sd.mk b/sd/Module_sd.mk
index 7fe92e5..a6b4f9d 100644
--- a/sd/Module_sd.mk
+++ b/sd/Module_sd.mk
@@ -30,7 +30,8 @@ $(eval $(call gb_Module_add_check_targets,sd,\
$(if $(and $(filter $(COM),MSC),$(MERGELIBS)),, \
CppunitTest_sd_uimpress) \
CppunitTest_sd_import_tests \
- CppunitTest_sd_export_ooxml \
+ CppunitTest_sd_export_ooxml1 \
+ CppunitTest_sd_export_ooxml2 \
CppunitTest_sd_export_tests \
CppunitTest_sd_filters_test \
CppunitTest_sd_misc_tests \
diff --git a/sd/qa/unit/export-tests-ooxml.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
similarity index 60%
rename from sd/qa/unit/export-tests-ooxml.cxx
rename to sd/qa/unit/export-tests-ooxml1.cxx
index 9a4f4d9..80af08d 100644
--- a/sd/qa/unit/export-tests-ooxml.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -81,9 +81,10 @@
using namespace css;
using namespace css::animations;
-class SdOOXMLExportTest : public SdModelTestBase, public XmlTestTools
+class SdOOXMLExportTest1 : public SdModelTestBase, public XmlTestTools
{
public:
+ void testFdo90607();
void testBnc870233_1();
void testBnc870233_2();
void testN828390_4();
@@ -104,33 +105,11 @@ public:
void testMergedCells();
void testTableCellBorder();
void testBulletColor();
- void testTdf93883();
void testBulletCharAndFont();
void testBulletMarginAndIndentation();
void testParaMarginAndindentation();
- void testExportTransitionsPPTX();
- void testDatetimeFieldNumberFormat();
- void testDatetimeFieldNumberFormatPPTX();
- void testSlideNumberField();
- void testSlideNumberFieldPPTX();
- void testSlideCountField();
- void testSlideNameField();
- void testExtFileField();
- void testAuthorField();
- void testFdo90607();
- void testTdf91378();
-//This test gives errors due to ATL
-#if HAVE_FEATURE_ATL || !defined(_WIN32)
- void testBnc822341();
-#endif
- void testMathObject();
- void testMathObjectPPT2010();
- void testTdf80224();
- void testTdf92527();
- void testTdf99224();
-
- CPPUNIT_TEST_SUITE(SdOOXMLExportTest);
+ CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
CPPUNIT_TEST(testFdo90607);
CPPUNIT_TEST(testBnc870233_1);
@@ -153,29 +132,9 @@ public:
CPPUNIT_TEST(testMergedCells);
CPPUNIT_TEST(testTableCellBorder);
CPPUNIT_TEST(testBulletColor);
- CPPUNIT_TEST(testTdf93883);
CPPUNIT_TEST(testBulletCharAndFont);
CPPUNIT_TEST(testBulletMarginAndIndentation);
CPPUNIT_TEST(testParaMarginAndindentation);
- CPPUNIT_TEST(testTdf91378);
-//This test gives errors due to ATL
-#if HAVE_FEATURE_ATL || !defined(_WIN32)
- CPPUNIT_TEST(testBnc822341);
-#endif
- CPPUNIT_TEST(testMathObject);
- CPPUNIT_TEST(testMathObjectPPT2010);
- CPPUNIT_TEST(testTdf80224);
- CPPUNIT_TEST(testExportTransitionsPPTX);
- CPPUNIT_TEST(testTdf92527);
- CPPUNIT_TEST(testDatetimeFieldNumberFormat);
- CPPUNIT_TEST(testDatetimeFieldNumberFormatPPTX);
- CPPUNIT_TEST(testSlideNumberField);
- CPPUNIT_TEST(testSlideNumberFieldPPTX);
- CPPUNIT_TEST(testSlideCountField);
- CPPUNIT_TEST(testSlideNameField);
- CPPUNIT_TEST(testExtFileField);
- CPPUNIT_TEST(testAuthorField);
- CPPUNIT_TEST(testTdf99224);
CPPUNIT_TEST_SUITE_END();
@@ -245,7 +204,7 @@ void checkFontAttributes( const SdrTextObj* pObj, ItemValue nVal)
}
-void SdOOXMLExportTest::testBnc870233_1()
+void SdOOXMLExportTest1::testBnc870233_1()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_1.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
@@ -271,7 +230,7 @@ void SdOOXMLExportTest::testBnc870233_1()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testBnc870233_2()
+void SdOOXMLExportTest1::testBnc870233_2()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_2.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
@@ -301,7 +260,7 @@ void SdOOXMLExportTest::testBnc870233_2()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testN828390_4()
+void SdOOXMLExportTest1::testN828390_4()
{
bool bPassed = false;
::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/n828390_4.odp"), ODP );
@@ -337,7 +296,7 @@ void SdOOXMLExportTest::testN828390_4()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testN828390_5()
+void SdOOXMLExportTest1::testN828390_5()
{
::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/n828390_5.odp"), ODP );
@@ -357,7 +316,7 @@ void SdOOXMLExportTest::testN828390_5()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testFdo71961()
+void SdOOXMLExportTest1::testFdo71961()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/fdo71961.odp"), ODP);
@@ -384,7 +343,7 @@ void SdOOXMLExportTest::testFdo71961()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testN828390()
+void SdOOXMLExportTest1::testN828390()
{
bool bPassed = false;
::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/n828390.pptx"), PPTX );
@@ -418,7 +377,7 @@ void SdOOXMLExportTest::testN828390()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testBnc880763()
+void SdOOXMLExportTest1::testBnc880763()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc880763.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
@@ -439,7 +398,7 @@ void SdOOXMLExportTest::testBnc880763()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testBnc862510_5()
+void SdOOXMLExportTest1::testBnc862510_5()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_5.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
@@ -460,7 +419,7 @@ void SdOOXMLExportTest::testBnc862510_5()
// In numbering a bullet could be defined as empty (no character).
// When exporting to OOXML make sure that the bullet is ignored and
// not written into the file.
-void SdOOXMLExportTest::testBnc822347_EmptyBullet()
+void SdOOXMLExportTest1::testBnc822347_EmptyBullet()
{
sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/bnc822347_EmptyBullet.odp"), ODP);
xDocShRef = saveAndReload(xDocShRef, PPTX);
@@ -489,7 +448,7 @@ void SdOOXMLExportTest::testBnc822347_EmptyBullet()
}
//Bullets not having any text following them are not getting exported to pptx correctly.
-void SdOOXMLExportTest::testFdo90607()
+void SdOOXMLExportTest1::testFdo90607()
{
sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/fdo90607.pptx"), PPTX);
xDocShRef = saveAndReload(xDocShRef, PPTX);
@@ -503,7 +462,7 @@ void SdOOXMLExportTest::testFdo90607()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testFdo83751()
+void SdOOXMLExportTest1::testFdo83751()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/fdo83751.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
@@ -520,7 +479,7 @@ void SdOOXMLExportTest::testFdo83751()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testFdo79731()
+void SdOOXMLExportTest1::testFdo79731()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/fdo79731.odp"), ODP);
xDocShRef = saveAndReload(xDocShRef, PPTX);
@@ -529,7 +488,7 @@ void SdOOXMLExportTest::testFdo79731()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testTableCellFillProperties()
+void SdOOXMLExportTest1::testTableCellFillProperties()
{
std::shared_ptr< comphelper::ConfigurationChanges > batch(comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Cache::GraphicManager::TotalCacheSize::set(sal_Int32(1), batch);
@@ -578,7 +537,7 @@ void SdOOXMLExportTest::testTableCellFillProperties()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testBulletStartNumber()
+void SdOOXMLExportTest1::testBulletStartNumber()
{
::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/n90255.pptx"), PPTX );
xDocShRef = saveAndReload( xDocShRef, PPTX );
@@ -593,7 +552,7 @@ void SdOOXMLExportTest::testBulletStartNumber()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testLineStyle()
+void SdOOXMLExportTest1::testLineStyle()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/lineStyle.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
@@ -609,7 +568,7 @@ void SdOOXMLExportTest::testLineStyle()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testRightToLeftParaghraph()
+void SdOOXMLExportTest1::testRightToLeftParaghraph()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/rightToLeftParagraph.pptx"), PPTX);
@@ -627,7 +586,7 @@ void SdOOXMLExportTest::testRightToLeftParaghraph()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testTextboxWithHyperlink()
+void SdOOXMLExportTest1::testTextboxWithHyperlink()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/hyperlinktest.pptx"), PPTX);
@@ -653,7 +612,7 @@ void SdOOXMLExportTest::testTextboxWithHyperlink()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testBulletColor()
+void SdOOXMLExportTest1::testBulletColor()
{
::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bulletColor.pptx"), PPTX );
@@ -672,17 +631,7 @@ void SdOOXMLExportTest::testBulletColor()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testTdf93883()
-{
- ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf93883.odp"), ODP);
- xDocShRef = saveAndReload( xDocShRef, PPTX );
- uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
- uno::Reference<text::XTextRange> const xParagraph( getParagraphFromShape( 0, xShape ) );
- uno::Reference< beans::XPropertySet > xPropSet( xParagraph, uno::UNO_QUERY_THROW );
- CPPUNIT_ASSERT(!xPropSet->getPropertyValue("NumberingLevel").hasValue());
-}
-
-void SdOOXMLExportTest::testBulletCharAndFont()
+void SdOOXMLExportTest1::testBulletCharAndFont()
{
::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/odp/bulletCharAndFont.odp"), ODP);
xDocShRef = saveAndReload( xDocShRef, PPTX );
@@ -710,154 +659,7 @@ void SdOOXMLExportTest::testBulletCharAndFont()
xDocShRef->DoClose();
}
-//This test gives errors due to ATL
-#if HAVE_FEATURE_ATL || !defined(_WIN32)
-void SdOOXMLExportTest::testBnc822341()
-{
- // Check import / export of embedded text document
- ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/bnc822341.odp"), ODP);
- utl::TempFile tempFile1;
- xDocShRef = saveAndReload( xDocShRef, PPTX, &tempFile1 );
-
- // Export an LO specific ole object (imported from an ODP document)
- {
- xmlDocPtr pXmlDocCT = parseExport(tempFile1, "[Content_Types].xml");
- assertXPath(pXmlDocCT,
- "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.openxmlformats-officedocument.wordprocessingml.document']",
- "PartName",
- "/ppt/embeddings/oleObject1.docx");
-
- xmlDocPtr pXmlDocRels = parseExport(tempFile1, "ppt/slides/_rels/slide1.xml.rels");
- assertXPath(pXmlDocRels,
- "/rels:Relationships/rels:Relationship[@Target='../embeddings/oleObject1.docx']",
- "Type",
- "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package");
-
- xmlDocPtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml");
- assertXPath(pXmlDocContent,
- "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/p:oleObj",
- "progId",
- "Word.Document.12");
-
- const SdrPage *pPage = GetPage( 1, xDocShRef );
-
- const SdrObject* pObj = dynamic_cast<SdrObject*>( pPage->GetObj(0) );
- CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr);
- CPPUNIT_ASSERT_EQUAL( static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier() );
- }
-
- utl::TempFile tempFile2;
- xDocShRef = saveAndReload( xDocShRef, PPTX, &tempFile2 );
-
- // Export an MS specific ole object (imported from a PPTX document)
- {
- xmlDocPtr pXmlDocCT = parseExport(tempFile2, "[Content_Types].xml");
- assertXPath(pXmlDocCT,
- "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.openxmlformats-officedocument.wordprocessingml.document']",
- "PartName",
- "/ppt/embeddings/oleObject1.docx");
-
- xmlDocPtr pXmlDocRels = parseExport(tempFile2, "ppt/slides/_rels/slide1.xml.rels");
- assertXPath(pXmlDocRels,
- "/rels:Relationships/rels:Relationship[@Target='../embeddings/oleObject1.docx']",
- "Type",
- "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package");
-
- xmlDocPtr pXmlDocContent = parseExport(tempFile2, "ppt/slides/slide1.xml");
- assertXPath(pXmlDocContent,
- "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/p:oleObj",
- "progId",
- "Word.Document.12");
-
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
- const SdrPage *pPage = pDoc->GetPage(1);
- CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
-
- const SdrObject* pObj = dynamic_cast<SdrObject*>( pPage->GetObj(0) );
- CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr);
- CPPUNIT_ASSERT_EQUAL( static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier() );
- }
-
- xDocShRef->DoClose();
-}
-#endif
-
-void SdOOXMLExportTest::testMathObject()
-{
- // Check import / export of math object
- ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/math.odp"), ODP);
- utl::TempFile tempFile1;
- xDocShRef = saveAndReload(xDocShRef, PPTX, &tempFile1);
-
- // Export an LO specific ole object (imported from an ODP document)
- {
- xmlDocPtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml");
- assertXPath(pXmlDocContent,
- "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
- "Requires",
- "a14");
- assertXPathContent(pXmlDocContent,
- "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:txBody/a:p/a14:m/m:oMath/m:r[1]/m:t",
- "a");
-
- const SdrPage *pPage = GetPage(1, xDocShRef);
- const SdrObject* pObj = dynamic_cast<SdrObject*>(pPage->GetObj(0));
- CPPUNIT_ASSERT_MESSAGE("no object", pObj != nullptr);
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier());
- }
-
- utl::TempFile tempFile2;
- xDocShRef = saveAndReload( xDocShRef, PPTX, &tempFile2 );
-
- // Export an MS specific ole object (imported from a PPTX document)
- {
- xmlDocPtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml");
- assertXPath(pXmlDocContent,
- "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
- "Requires",
- "a14");
- assertXPathContent(pXmlDocContent,
- "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:txBody/a:p/a14:m/m:oMath/m:r[1]/m:t",
- "a");
-
- const SdrPage *pPage = GetPage(1, xDocShRef);
- const SdrObject* pObj = dynamic_cast<SdrObject*>(pPage->GetObj(0));
- CPPUNIT_ASSERT_MESSAGE("no object", pObj != nullptr);
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier());
- }
-
- xDocShRef->DoClose();
-}
-
-void SdOOXMLExportTest::testMathObjectPPT2010()
-{
- // Check import / export of math object
- ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/Math.pptx"), PPTX);
- utl::TempFile tempFile1;
- xDocShRef = saveAndReload(xDocShRef, PPTX, &tempFile1);
-
- // Export an MS specific ole object (imported from a PPTX document)
- {
- xmlDocPtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml");
- assertXPath(pXmlDocContent,
- "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
- "Requires",
- "a14");
- assertXPathContent(pXmlDocContent,
- "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:txBody/a:p/a14:m/m:oMath/m:sSup/m:e/m:r[1]/m:t",
- OUString::fromUtf8("\xf0\x9d\x91\x8e")); // non-BMP char
-
- const SdrPage *pPage = GetPage(1, xDocShRef);
- const SdrObject* pObj = dynamic_cast<SdrObject*>(pPage->GetObj(0));
- CPPUNIT_ASSERT_MESSAGE("no object", pObj != nullptr);
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier());
- }
-
- xDocShRef->DoClose();
-}
-
-void SdOOXMLExportTest::testBulletMarginAndIndentation()
+void SdOOXMLExportTest1::testBulletMarginAndIndentation()
{
::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bulletMarginAndIndent.pptx"), PPTX );
xDocShRef = saveAndReload( xDocShRef, PPTX );
@@ -877,7 +679,7 @@ void SdOOXMLExportTest::testBulletMarginAndIndentation()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testParaMarginAndindentation()
+void SdOOXMLExportTest1::testParaMarginAndindentation()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/paraMarginAndIndentation.pptx"), PPTX);
@@ -899,7 +701,7 @@ void SdOOXMLExportTest::testParaMarginAndindentation()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testCellLeftAndRightMargin()
+void SdOOXMLExportTest1::testCellLeftAndRightMargin()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/n90223.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
@@ -930,7 +732,7 @@ void SdOOXMLExportTest::testCellLeftAndRightMargin()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testMergedCells()
+void SdOOXMLExportTest1::testMergedCells()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/cellspan.odp"), ODP);
xDocShRef = saveAndReload( xDocShRef, PPTX );
@@ -947,7 +749,7 @@ void SdOOXMLExportTest::testMergedCells()
CPPUNIT_ASSERT_EQUAL( OUString("2,3"), xText2->getString() );
}
-void SdOOXMLExportTest::testTableCellBorder()
+void SdOOXMLExportTest1::testTableCellBorder()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/n90190.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
@@ -997,41 +799,6 @@ void SdOOXMLExportTest::testTableCellBorder()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest::testTdf80224()
-{
- ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf80224.odp"), ODP);
- xDocShRef = saveAndReload( xDocShRef, PPTX );
- uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
-
- uno::Reference<text::XTextRange> const xParagraph( getParagraphFromShape( 0, xShape ) );
- uno::Reference< beans::XPropertySet > xPropSet( xParagraph->getStart(), uno::UNO_QUERY_THROW );
-
- sal_Int32 nCharColor;
- xPropSet->getPropertyValue("CharColor") >>= nCharColor;
- CPPUNIT_ASSERT_EQUAL(sal_Int32(6644396), nCharColor);
- xDocShRef->DoClose();
-}
-
-void SdOOXMLExportTest::testTdf91378()
-{
-
- //Check For Import and Export Both
- ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf91378.pptx"), PPTX);
- for( sal_uInt32 i=0;i<2;i++)
- {
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
- uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier( xDocShRef->GetModel(), uno::UNO_QUERY );
- uno::Reference<document::XDocumentProperties> xProps( xDocumentPropertiesSupplier->getDocumentProperties(), uno::UNO_QUERY );
- uno::Reference<beans::XPropertySet> xUDProps( xProps->getUserDefinedProperties(), uno::UNO_QUERY );
- OUString propValue;
- xUDProps->getPropertyValue("Testing") >>= propValue;
- CPPUNIT_ASSERT(propValue.isEmpty());
- xDocShRef = saveAndReload( xDocShRef, PPTX );
- }
- xDocShRef->DoClose();
-}
-
bool checkTransitionOnPage(uno::Reference<drawing::XDrawPagesSupplier> xDoc, sal_Int32 nSlideNumber,
sal_Int16 nExpectedTransitionType, sal_Int16 nExpectedTransitionSubType,
bool bExpectedDirection = true)
@@ -1073,269 +840,7 @@ bool checkTransitionOnPage(uno::Reference<drawing::XDrawPagesSupplier> xDoc, sal
return true;
}
-void SdOOXMLExportTest::testExportTransitionsPPTX()
-{
- sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/AllTransitions.odp"), ODP);
- xDocShRef = saveAndReload(xDocShRef, PPTX);
- uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
-
- // WIPE TRANSITIONS
- CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 01, TransitionType::BARWIPE, TransitionSubType::TOPTOBOTTOM, false));
- CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 02, TransitionType::BARWIPE, TransitionSubType::LEFTTORIGHT));
- CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 03, TransitionType::BARWIPE, TransitionSubType::LEFTTORIGHT, false));
- CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 04, TransitionType::BARWIPE, TransitionSubType::TOPTOBOTTOM));
-
- // CUT THROUGH BLACK
- CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 31, TransitionType::BARWIPE, TransitionSubType::FADEOVERCOLOR));
-
- // COMB
- CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 41, TransitionType::PUSHWIPE, TransitionSubType::COMBHORIZONTAL));
- CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 42, TransitionType::PUSHWIPE, TransitionSubType::COMBVERTICAL));
-
- // OUTSIDE TURNING CUBE
- CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 57, TransitionType::MISCSHAPEWIPE, TransitionSubType::CORNERSOUT));
- // INSIDE TURNING CUBE
- CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 60, TransitionType::MISCSHAPEWIPE, TransitionSubType::CORNERSIN));
-
- // FALL
- CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 61, TransitionType::MISCSHAPEWIPE, TransitionSubType::LEFTTORIGHT));
-
- // VORTEX
- CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 70, TransitionType::MISCSHAPEWIPE, TransitionSubType::VERTICAL));
-
- // RIPPLE
- CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 71, TransitionType::MISCSHAPEWIPE, TransitionSubType::HORIZONTAL));
-
- // GLITTER
- CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 72, TransitionType::MISCSHAPEWIPE, TransitionSubType::DIAMOND));
-
- // HONEYCOMB
- CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 73, TransitionType::MISCSHAPEWIPE, TransitionSubType::HEART));
-
- // NEWSFLASH
- CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 74, TransitionType::ZOOM, TransitionSubType::ROTATEIN));
-
- // OVAL VERTICAL - cannot be exported to PPTX so fallback to circle
- //CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 76, TransitionType::ELLIPSEWIPE, TransitionSubType::VERTICAL));
- CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 76, TransitionType::ELLIPSEWIPE, TransitionSubType::CIRCLE));
-
- xDocShRef->DoClose();
-}
-
-void SdOOXMLExportTest::testTdf92527()
-{
- // We draw a diamond in an empty document. A newly created diamond shape does not have
- // CustomShapeGeometry - Path - Segments property, and previously DrawingML exporter
- // did not export custom shapes which did not have CustomShapeGeometry - Path - Segments property.
- sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/empty.fodp"), FODG );
- uno::Reference<css::lang::XMultiServiceFactory> xFactory(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY);
- uno::Reference<drawing::XShape> xShape1(xFactory->createInstance("com.sun.star.drawing.CustomShape"), uno::UNO_QUERY);
- uno::Reference<drawing::XDrawPagesSupplier> xDoc1(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
- uno::Reference<drawing::XDrawPage> xPage1(xDoc1->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
- xPage1->add(xShape1);
- xShape1->setSize(awt::Size(10000, 10000));
- xShape1->setPosition(awt::Point(1000, 1000));
- uno::Sequence<beans::PropertyValue> aShapeGeometry(comphelper::InitPropertySequence(
- {
- {"Type", uno::makeAny(OUString("diamond"))},
- }));
- uno::Reference<beans::XPropertySet> xPropertySet1(xShape1, uno::UNO_QUERY);
- xPropertySet1->setPropertyValue("CustomShapeGeometry", uno::makeAny(aShapeGeometry));
-
- xDocShRef = saveAndReload(xDocShRef, PPTX);
-
- uno::Reference<drawing::XDrawPagesSupplier> xDoc2(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
- uno::Reference<drawing::XDrawPage> xPage2(xDoc2->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
- uno::Reference<drawing::XShape> xShape2(xPage2->getByIndex(0), uno::UNO_QUERY_THROW);
- uno::Reference< beans::XPropertySet > xPropertySet2( xShape2, uno::UNO_QUERY_THROW );
- uno::Sequence<beans::PropertyValue> aProps;
- xPropertySet2->getPropertyValue("CustomShapeGeometry") >>= aProps;
- uno::Sequence<beans::PropertyValue> aPathProps;
- for (int i = 0; i < aProps.getLength(); ++i)
- {
- const beans::PropertyValue& rProp = aProps[i];
- if (rProp.Name == "Path")
- aPathProps = rProp.Value.get< uno::Sequence<beans::PropertyValue> >();
- }
- uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aCoordinates;
- for (int i = 0; i < aPathProps.getLength(); ++i)
- {
- const beans::PropertyValue& rProp = aPathProps[i];
- if (rProp.Name == "Coordinates")
- aCoordinates = rProp.Value.get< uno::Sequence<drawing::EnhancedCustomShapeParameterPair> >();
- }
-
- // 5 coordinate pairs, 1 MoveTo, 4 LineTo
- CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aCoordinates.getLength());
- xDocShRef->DoClose();
-}
-
-namespace {
-
-void matchNumberFormat( int nPage, uno::Reference< text::XTextField > xField)
-{
- uno::Reference< beans::XPropertySet > xPropSet( xField, uno::UNO_QUERY_THROW );
- sal_Int32 nNumFmt;
- xPropSet->getPropertyValue("NumberFormat") >>= nNumFmt;
- switch( nPage )
- {
- case 0: // 13/02/96
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(2), nNumFmt);
- break;
- case 1: // 13/02/1996
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(5), nNumFmt);
- break;
- case 2: // 13 February 1996
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(3), nNumFmt);
- break;
- case 3: // 13:49:38
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(2), nNumFmt);
- break;
- case 4: // 13:49
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(3), nNumFmt);
- break;
- case 5: // 01:49 PM
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(6), nNumFmt);
- break;
- case 6: // 01:49:38 PM
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(7), nNumFmt);
- }
-}
-
-}
-
-void SdOOXMLExportTest::testDatetimeFieldNumberFormat()
-{
- ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/numfmt.odp"), ODP);
-
- xDocShRef = saveAndReload( xDocShRef, PPTX );
-
- for(sal_uInt16 i = 0; i <= 6; ++i)
- {
- matchNumberFormat( i, getTextFieldFromPage(0, 0, 0, i, xDocShRef) );
- }
-
- xDocShRef->DoClose();
-}
-
-void SdOOXMLExportTest::testDatetimeFieldNumberFormatPPTX()
-{
- ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/numfmt.pptx"), PPTX);
-
- xDocShRef = saveAndReload( xDocShRef, PPTX );
-
- for(sal_uInt16 i = 0; i <= 6; ++i)
- {
- matchNumberFormat( i, getTextFieldFromPage(0, 0, 0, i, xDocShRef) );
- }
-
- xDocShRef->DoClose();
-}
-
-void SdOOXMLExportTest::testSlideNumberField()
-{
- ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/slidenum_field.odp"), ODP);
-
- xDocShRef = saveAndReload( xDocShRef, PPTX );
-
- uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef);
- CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
-
- xDocShRef->DoClose();
-}
-
-void SdOOXMLExportTest::testSlideNumberFieldPPTX()
-{
- ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/slidenum_field.pptx"), PPTX);
-
- xDocShRef = saveAndReload( xDocShRef, PPTX );
-
- uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef);
- CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
-
- xDocShRef->DoClose();
-}
-
-void SdOOXMLExportTest::testSlideCountField()
-{
- ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/slidecount_field.odp"), ODP);
-
- xDocShRef = saveAndReload( xDocShRef, PPTX );
-
- uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef);
- CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
-
- xDocShRef->DoClose();
-}
-
-void SdOOXMLExportTest::testSlideNameField()
-{
- ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/slidename_field.odp"), ODP);
-
- xDocShRef = saveAndReload( xDocShRef, PPTX );
-
- uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef);
- CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
-
- xDocShRef->DoClose();
-}
-
-void SdOOXMLExportTest::testExtFileField()
-{
- ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/extfile_field.odp"), ODP);
-
- xDocShRef = saveAndReload( xDocShRef, PPTX );
-
- for(sal_uInt16 i = 0; i <= 3; ++i)
- {
- uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, i, 0, xDocShRef);
- CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
-
- uno::Reference< beans::XPropertySet > xPropSet( xField, uno::UNO_QUERY_THROW );
- sal_Int32 nNumFmt;
- xPropSet->getPropertyValue("FileFormat") >>= nNumFmt;
- switch( i )
- {
- case 0: // Path/File name
- CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(0), nNumFmt);
- break;
- case 1: // Path
- CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(1), nNumFmt);
- break;
- case 2: // File name without extension
- CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(2), nNumFmt);
- break;
- case 3: // File name with extension
- CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(3), nNumFmt);
- }
- }
-
- xDocShRef->DoClose();
-}
-
-void SdOOXMLExportTest::testAuthorField()
-{
- ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/author_field.odp"), ODP);
-
- xDocShRef = saveAndReload( xDocShRef, PPTX );
-
- uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef);
- CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
-
- xDocShRef->DoClose();
-}
-
-void SdOOXMLExportTest::testTdf99224()
-{
- sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf99224.odp"), ODP);
- xShell = saveAndReload(xShell, PPTX);
- uno::Reference<drawing::XDrawPage> xPage = getPage(0, xShell);
- // This was 0: the image with text was lost on export.
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xPage->getCount());
- xShell->DoClose();
-}
-
-CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest);
+CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest1);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
new file mode 100644
index 0000000..fc90c82c
--- /dev/null
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -0,0 +1,677 @@
+/* -*- 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 <officecfg/Office/Common.hxx>
+#include "sdmodeltestbase.hxx"
+#include "Outliner.hxx"
+#include <test/xmltesttools.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/propertysequence.hxx>
+#include <svl/stritem.hxx>
+#include <editeng/editobj.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/escapementitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/numitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/bulletitem.hxx>
+
+#include <oox/drawingml/drawingmltypes.hxx>
+
+#include <rsc/rscsfx.hxx>
+
+#include <svx/svdoutl.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdoashp.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdomedia.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/xflclit.hxx>
+#include <animations/animationnodehelper.hxx>
+#include <unotools/mediadescriptor.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <rtl/ustring.hxx>
+
+#include <vcl/opengl/OpenGLWrapper.hxx>
+
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <com/sun/star/animations/XAnimate.hpp>
+#include <com/sun/star/animations/TransitionType.hpp>
+#include <com/sun/star/animations/TransitionSubType.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/chart/XChartDocument.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
+#include <com/sun/star/chart2/data/XDataSequence.hpp>
+#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/table/XTable.hpp>
+#include <com/sun/star/table/XMergeableCell.hpp>
+
+#include <svx/svdotable.hxx>
+#include <config_features.h>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+using namespace css;
+using namespace css::animations;
+
+class SdOOXMLExportTest2 : public SdModelTestBase, public XmlTestTools
+{
+public:
+ void testTdf93883();
+ void testTdf91378();
+//This test gives errors due to ATL
+#if HAVE_FEATURE_ATL || !defined(_WIN32)
+ void testBnc822341();
+#endif
+ void testMathObject();
+ void testMathObjectPPT2010();
+ void testTdf80224();
+ void testExportTransitionsPPTX();
+ void testTdf92527();
+ void testDatetimeFieldNumberFormat();
+ void testDatetimeFieldNumberFormatPPTX();
+ void testSlideNumberField();
+ void testSlideNumberFieldPPTX();
+ void testSlideCountField();
+ void testSlideNameField();
+ void testExtFileField();
+ void testAuthorField();
+ void testTdf99224();
+
+ CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
+
+ CPPUNIT_TEST(testTdf93883);
+ CPPUNIT_TEST(testTdf91378);
+//This test gives errors due to ATL
+#if HAVE_FEATURE_ATL || !defined(_WIN32)
+ CPPUNIT_TEST(testBnc822341);
+#endif
+ CPPUNIT_TEST(testMathObject);
+ CPPUNIT_TEST(testMathObjectPPT2010);
+ CPPUNIT_TEST(testTdf80224);
+ CPPUNIT_TEST(testExportTransitionsPPTX);
+ CPPUNIT_TEST(testTdf92527);
+ CPPUNIT_TEST(testDatetimeFieldNumberFormat);
+ CPPUNIT_TEST(testDatetimeFieldNumberFormatPPTX);
+ CPPUNIT_TEST(testSlideNumberField);
+ CPPUNIT_TEST(testSlideNumberFieldPPTX);
+ CPPUNIT_TEST(testSlideCountField);
+ CPPUNIT_TEST(testSlideNameField);
+ CPPUNIT_TEST(testExtFileField);
+ CPPUNIT_TEST(testAuthorField);
+ CPPUNIT_TEST(testTdf99224);
+
+ CPPUNIT_TEST_SUITE_END();
+
+ virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
+ {
+ struct { char const * pPrefix; char const * pURI; } namespaces[] =
+ {
+ // OOXML
+ { "ContentType", "http://schemas.openxmlformats.org/package/2006/content-types" },
+ { "rels", "http://schemas.openxmlformats.org/package/2006/relationships" },
+ { "mc", "http://schemas.openxmlformats.org/markup-compatibility/2006" },
+ { "v", "urn:schemas-microsoft-com:vml" },
+ { "a", "http://schemas.openxmlformats.org/drawingml/2006/main" },
+ { "c", "http://schemas.openxmlformats.org/drawingml/2006/chart" },
+ { "m", "http://schemas.openxmlformats.org/officeDocument/2006/math" },
+ { "pic", "http://schemas.openxmlformats.org/drawingml/2006/picture" },
+ { "wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" },
+ { "p", "http://schemas.openxmlformats.org/presentationml/2006/main" },
+ { "w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main" },
+ { "a14", "http://schemas.microsoft.com/office/drawing/2010/main" },
+ { "wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape" },
+ { "wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" },
+ };
+ for (size_t i = 0; i < SAL_N_ELEMENTS(namespaces); ++i)
+ {
+ xmlXPathRegisterNs(pXmlXPathCtx,
+ reinterpret_cast<xmlChar const *>(namespaces[i].pPrefix),
+ reinterpret_cast<xmlChar const *>(namespaces[i].pURI));
+ }
+ }
+
+ xmlDocPtr parseExport(utl::TempFile & rTempFile, OUString const& rStreamName)
+ {
+ OUString const url(rTempFile.GetURL());
+ uno::Reference<packages::zip::XZipFileAccess2> const xZipNames(
+ packages::zip::ZipFileAccess::createWithURL(
+ comphelper::getComponentContext(m_xSFactory), url));
+ uno::Reference<io::XInputStream> const xInputStream(
+ xZipNames->getByName(rStreamName), uno::UNO_QUERY);
+ std::unique_ptr<SvStream> const pStream(
+ utl::UcbStreamHelper::CreateStream(xInputStream, true));
+ xmlDocPtr const pXmlDoc = parseXmlStream(pStream.get());
+ pXmlDoc->name = reinterpret_cast<char *>(xmlStrdup(
+ reinterpret_cast<xmlChar const *>(OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr())));
+ return pXmlDoc;
+ }
+};
+
+void SdOOXMLExportTest2::testTdf93883()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf93883.odp"), ODP);
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+ uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
+ uno::Reference<text::XTextRange> const xParagraph( getParagraphFromShape( 0, xShape ) );
+ uno::Reference< beans::XPropertySet > xPropSet( xParagraph, uno::UNO_QUERY_THROW );
+ CPPUNIT_ASSERT(!xPropSet->getPropertyValue("NumberingLevel").hasValue());
+}
+
+//This test gives errors due to ATL
+#if HAVE_FEATURE_ATL || !defined(_WIN32)
+void SdOOXMLExportTest2::testBnc822341()
+{
+ // Check import / export of embedded text document
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/bnc822341.odp"), ODP);
+ utl::TempFile tempFile1;
+ xDocShRef = saveAndReload( xDocShRef, PPTX, &tempFile1 );
+
+ // Export an LO specific ole object (imported from an ODP document)
+ {
+ xmlDocPtr pXmlDocCT = parseExport(tempFile1, "[Content_Types].xml");
+ assertXPath(pXmlDocCT,
+ "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.openxmlformats-officedocument.wordprocessingml.document']",
+ "PartName",
+ "/ppt/embeddings/oleObject1.docx");
+
+ xmlDocPtr pXmlDocRels = parseExport(tempFile1, "ppt/slides/_rels/slide1.xml.rels");
+ assertXPath(pXmlDocRels,
+ "/rels:Relationships/rels:Relationship[@Target='../embeddings/oleObject1.docx']",
+ "Type",
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package");
+
+ xmlDocPtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml");
+ assertXPath(pXmlDocContent,
+ "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/p:oleObj",
+ "progId",
+ "Word.Document.12");
+
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
+
+ const SdrObject* pObj = dynamic_cast<SdrObject*>( pPage->GetObj(0) );
+ CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr);
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier() );
+ }
+
+ utl::TempFile tempFile2;
+ xDocShRef = saveAndReload( xDocShRef, PPTX, &tempFile2 );
+
+ // Export an MS specific ole object (imported from a PPTX document)
+ {
+ xmlDocPtr pXmlDocCT = parseExport(tempFile2, "[Content_Types].xml");
+ assertXPath(pXmlDocCT,
+ "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.openxmlformats-officedocument.wordprocessingml.document']",
+ "PartName",
+ "/ppt/embeddings/oleObject1.docx");
+
+ xmlDocPtr pXmlDocRels = parseExport(tempFile2, "ppt/slides/_rels/slide1.xml.rels");
+ assertXPath(pXmlDocRels,
+ "/rels:Relationships/rels:Relationship[@Target='../embeddings/oleObject1.docx']",
+ "Type",
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package");
+
+ xmlDocPtr pXmlDocContent = parseExport(tempFile2, "ppt/slides/slide1.xml");
+ assertXPath(pXmlDocContent,
+ "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/p:oleObj",
+ "progId",
+ "Word.Document.12");
+
+ SdDrawDocument *pDoc = xDocShRef->GetDoc();
+ CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
+ const SdrPage *pPage = pDoc->GetPage(1);
+ CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
+
+ const SdrObject* pObj = dynamic_cast<SdrObject*>( pPage->GetObj(0) );
+ CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr);
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier() );
+ }
+
+ xDocShRef->DoClose();
+}
+#endif
+
+void SdOOXMLExportTest2::testMathObject()
+{
+ // Check import / export of math object
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/math.odp"), ODP);
+ utl::TempFile tempFile1;
+ xDocShRef = saveAndReload(xDocShRef, PPTX, &tempFile1);
+
+ // Export an LO specific ole object (imported from an ODP document)
+ {
+ xmlDocPtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml");
+ assertXPath(pXmlDocContent,
+ "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
+ "Requires",
+ "a14");
+ assertXPathContent(pXmlDocContent,
+ "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:txBody/a:p/a14:m/m:oMath/m:r[1]/m:t",
+ "a");
+
+ const SdrPage *pPage = GetPage(1, xDocShRef);
+ const SdrObject* pObj = dynamic_cast<SdrObject*>(pPage->GetObj(0));
+ CPPUNIT_ASSERT_MESSAGE("no object", pObj != nullptr);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier());
+ }
+
+ utl::TempFile tempFile2;
+ xDocShRef = saveAndReload( xDocShRef, PPTX, &tempFile2 );
+
+ // Export an MS specific ole object (imported from a PPTX document)
+ {
+ xmlDocPtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml");
+ assertXPath(pXmlDocContent,
+ "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
+ "Requires",
+ "a14");
+ assertXPathContent(pXmlDocContent,
+ "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:txBody/a:p/a14:m/m:oMath/m:r[1]/m:t",
+ "a");
+
+ const SdrPage *pPage = GetPage(1, xDocShRef);
+ const SdrObject* pObj = dynamic_cast<SdrObject*>(pPage->GetObj(0));
+ CPPUNIT_ASSERT_MESSAGE("no object", pObj != nullptr);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier());
+ }
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest2::testMathObjectPPT2010()
+{
+ // Check import / export of math object
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/Math.pptx"), PPTX);
+ utl::TempFile tempFile1;
+ xDocShRef = saveAndReload(xDocShRef, PPTX, &tempFile1);
+
+ // Export an MS specific ole object (imported from a PPTX document)
+ {
+ xmlDocPtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml");
+ assertXPath(pXmlDocContent,
+ "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
+ "Requires",
+ "a14");
+ assertXPathContent(pXmlDocContent,
+ "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:txBody/a:p/a14:m/m:oMath/m:sSup/m:e/m:r[1]/m:t",
+ OUString::fromUtf8("\xf0\x9d\x91\x8e")); // non-BMP char
+
+ const SdrPage *pPage = GetPage(1, xDocShRef);
+ const SdrObject* pObj = dynamic_cast<SdrObject*>(pPage->GetObj(0));
+ CPPUNIT_ASSERT_MESSAGE("no object", pObj != nullptr);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier());
+ }
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest2::testTdf80224()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf80224.odp"), ODP);
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+ uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
+
+ uno::Reference<text::XTextRange> const xParagraph( getParagraphFromShape( 0, xShape ) );
+ uno::Reference< beans::XPropertySet > xPropSet( xParagraph->getStart(), uno::UNO_QUERY_THROW );
+
+ sal_Int32 nCharColor;
+ xPropSet->getPropertyValue("CharColor") >>= nCharColor;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(6644396), nCharColor);
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest2::testTdf91378()
+{
+
+ //Check For Import and Export Both
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf91378.pptx"), PPTX);
+ for( sal_uInt32 i=0;i<2;i++)
+ {
+ SdDrawDocument *pDoc = xDocShRef->GetDoc();
+ CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
+ uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier( xDocShRef->GetModel(), uno::UNO_QUERY );
+ uno::Reference<document::XDocumentProperties> xProps( xDocumentPropertiesSupplier->getDocumentProperties(), uno::UNO_QUERY );
+ uno::Reference<beans::XPropertySet> xUDProps( xProps->getUserDefinedProperties(), uno::UNO_QUERY );
+ OUString propValue;
+ xUDProps->getPropertyValue("Testing") >>= propValue;
+ CPPUNIT_ASSERT(propValue.isEmpty());
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+ }
+ xDocShRef->DoClose();
+}
+
+bool checkTransitionOnPage(uno::Reference<drawing::XDrawPagesSupplier> xDoc, sal_Int32 nSlideNumber,
+ sal_Int16 nExpectedTransitionType, sal_Int16 nExpectedTransitionSubType,
+ bool bExpectedDirection = true)
+{
+ sal_Int32 nSlideIndex = nSlideNumber - 1;
+
+ CPPUNIT_ASSERT_MESSAGE("Slide/Page index out of range", nSlideIndex < xDoc->getDrawPages()->getCount());
+
+ uno::Reference<drawing::XDrawPage> xPage(xDoc->getDrawPages()->getByIndex(nSlideIndex), uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropSet(xPage, uno::UNO_QUERY);
+
+ sal_Int16 nTransitionType = 0;
+ xPropSet->getPropertyValue("TransitionType") >>= nTransitionType;
+
+ if (nExpectedTransitionType != nTransitionType)
+ {
+ std::cerr << "Transition type: " << nTransitionType << " " << nExpectedTransitionType << std::endl;
+ return false;
+ }
+
+ sal_Int16 nTransitionSubtype = 0;
+ xPropSet->getPropertyValue("TransitionSubtype") >>= nTransitionSubtype;
+ if (nExpectedTransitionSubType != nTransitionSubtype)
+ {
+ std::cerr << "Transition Subtype: " << nTransitionSubtype << " " << nExpectedTransitionSubType << std::endl;
+ return false;
+ }
+
+ bool bDirection = false;
+ xPropSet->getPropertyValue("TransitionDirection") >>= bDirection;
+
+ if (bExpectedDirection != bDirection)
+ {
+ std::cerr << "Transition Direction: " << (bExpectedDirection ? "normal" : "reversed")
+ << " " << (bDirection ? "normal" : "reversed") << std::endl;
+ return false;
+ }
+
+ return true;
+}
+
+void SdOOXMLExportTest2::testExportTransitionsPPTX()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/AllTransitions.odp"), ODP);
+ xDocShRef = saveAndReload(xDocShRef, PPTX);
+ uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+
+ // WIPE TRANSITIONS
+ CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 01, TransitionType::BARWIPE, TransitionSubType::TOPTOBOTTOM, false));
+ CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 02, TransitionType::BARWIPE, TransitionSubType::LEFTTORIGHT));
+ CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 03, TransitionType::BARWIPE, TransitionSubType::LEFTTORIGHT, false));
+ CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 04, TransitionType::BARWIPE, TransitionSubType::TOPTOBOTTOM));
+
+ // CUT THROUGH BLACK
+ CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 31, TransitionType::BARWIPE, TransitionSubType::FADEOVERCOLOR));
+
+ // COMB
+ CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 41, TransitionType::PUSHWIPE, TransitionSubType::COMBHORIZONTAL));
+ CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 42, TransitionType::PUSHWIPE, TransitionSubType::COMBVERTICAL));
+
+ // OUTSIDE TURNING CUBE
+ CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 57, TransitionType::MISCSHAPEWIPE, TransitionSubType::CORNERSOUT));
+ // INSIDE TURNING CUBE
+ CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 60, TransitionType::MISCSHAPEWIPE, TransitionSubType::CORNERSIN));
+
+ // FALL
+ CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 61, TransitionType::MISCSHAPEWIPE, TransitionSubType::LEFTTORIGHT));
+
+ // VORTEX
+ CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 70, TransitionType::MISCSHAPEWIPE, TransitionSubType::VERTICAL));
+
+ // RIPPLE
+ CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 71, TransitionType::MISCSHAPEWIPE, TransitionSubType::HORIZONTAL));
+
+ // GLITTER
+ CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 72, TransitionType::MISCSHAPEWIPE, TransitionSubType::DIAMOND));
+
+ // HONEYCOMB
+ CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 73, TransitionType::MISCSHAPEWIPE, TransitionSubType::HEART));
+
+ // NEWSFLASH
+ CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 74, TransitionType::ZOOM, TransitionSubType::ROTATEIN));
+
+ // OVAL VERTICAL - cannot be exported to PPTX so fallback to circle
+ //CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 76, TransitionType::ELLIPSEWIPE, TransitionSubType::VERTICAL));
+ CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 76, TransitionType::ELLIPSEWIPE, TransitionSubType::CIRCLE));
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest2::testTdf92527()
+{
+ // We draw a diamond in an empty document. A newly created diamond shape does not have
+ // CustomShapeGeometry - Path - Segments property, and previously DrawingML exporter
+ // did not export custom shapes which did not have CustomShapeGeometry - Path - Segments property.
+ sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/empty.fodp"), FODG );
+ uno::Reference<css::lang::XMultiServiceFactory> xFactory(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShape1(xFactory->createInstance("com.sun.star.drawing.CustomShape"), uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPagesSupplier> xDoc1(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XDrawPage> xPage1(xDoc1->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
+ xPage1->add(xShape1);
+ xShape1->setSize(awt::Size(10000, 10000));
+ xShape1->setPosition(awt::Point(1000, 1000));
+ uno::Sequence<beans::PropertyValue> aShapeGeometry(comphelper::InitPropertySequence(
+ {
+ {"Type", uno::makeAny(OUString("diamond"))},
+ }));
+ uno::Reference<beans::XPropertySet> xPropertySet1(xShape1, uno::UNO_QUERY);
+ xPropertySet1->setPropertyValue("CustomShapeGeometry", uno::makeAny(aShapeGeometry));
+
+ xDocShRef = saveAndReload(xDocShRef, PPTX);
+
+ uno::Reference<drawing::XDrawPagesSupplier> xDoc2(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XDrawPage> xPage2(xDoc2->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XShape> xShape2(xPage2->getByIndex(0), uno::UNO_QUERY_THROW);
+ uno::Reference< beans::XPropertySet > xPropertySet2( xShape2, uno::UNO_QUERY_THROW );
+ uno::Sequence<beans::PropertyValue> aProps;
+ xPropertySet2->getPropertyValue("CustomShapeGeometry") >>= aProps;
+ uno::Sequence<beans::PropertyValue> aPathProps;
+ for (int i = 0; i < aProps.getLength(); ++i)
+ {
+ const beans::PropertyValue& rProp = aProps[i];
+ if (rProp.Name == "Path")
+ aPathProps = rProp.Value.get< uno::Sequence<beans::PropertyValue> >();
+ }
+ uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aCoordinates;
+ for (int i = 0; i < aPathProps.getLength(); ++i)
+ {
+ const beans::PropertyValue& rProp = aPathProps[i];
+ if (rProp.Name == "Coordinates")
+ aCoordinates = rProp.Value.get< uno::Sequence<drawing::EnhancedCustomShapeParameterPair> >();
+ }
+
+ // 5 coordinate pairs, 1 MoveTo, 4 LineTo
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aCoordinates.getLength());
+ xDocShRef->DoClose();
+}
+
+namespace {
+
+void matchNumberFormat( int nPage, uno::Reference< text::XTextField > xField)
+{
+ uno::Reference< beans::XPropertySet > xPropSet( xField, uno::UNO_QUERY_THROW );
+ sal_Int32 nNumFmt;
+ xPropSet->getPropertyValue("NumberFormat") >>= nNumFmt;
+ switch( nPage )
+ {
+ case 0: // 13/02/96
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(2), nNumFmt);
+ break;
+ case 1: // 13/02/1996
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(5), nNumFmt);
+ break;
+ case 2: // 13 February 1996
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(3), nNumFmt);
+ break;
+ case 3: // 13:49:38
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(2), nNumFmt);
+ break;
+ case 4: // 13:49
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(3), nNumFmt);
+ break;
+ case 5: // 01:49 PM
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(6), nNumFmt);
+ break;
+ case 6: // 01:49:38 PM
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(7), nNumFmt);
+ }
+}
+
+}
+
+void SdOOXMLExportTest2::testDatetimeFieldNumberFormat()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/numfmt.odp"), ODP);
+
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+ for(sal_uInt16 i = 0; i <= 6; ++i)
+ {
+ matchNumberFormat( i, getTextFieldFromPage(0, 0, 0, i, xDocShRef) );
+ }
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest2::testDatetimeFieldNumberFormatPPTX()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/numfmt.pptx"), PPTX);
+
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+ for(sal_uInt16 i = 0; i <= 6; ++i)
+ {
+ matchNumberFormat( i, getTextFieldFromPage(0, 0, 0, i, xDocShRef) );
+ }
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest2::testSlideNumberField()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/slidenum_field.odp"), ODP);
+
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+ uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef);
+ CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest2::testSlideNumberFieldPPTX()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/slidenum_field.pptx"), PPTX);
+
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+ uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef);
+ CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest2::testSlideCountField()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/slidecount_field.odp"), ODP);
+
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+ uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef);
+ CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest2::testSlideNameField()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/slidename_field.odp"), ODP);
+
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+ uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef);
+ CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest2::testExtFileField()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/extfile_field.odp"), ODP);
+
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+ for(sal_uInt16 i = 0; i <= 3; ++i)
+ {
+ uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, i, 0, xDocShRef);
+ CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
+
+ uno::Reference< beans::XPropertySet > xPropSet( xField, uno::UNO_QUERY_THROW );
+ sal_Int32 nNumFmt;
+ xPropSet->getPropertyValue("FileFormat") >>= nNumFmt;
+ switch( i )
+ {
+ case 0: // Path/File name
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(0), nNumFmt);
+ break;
+ case 1: // Path
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(1), nNumFmt);
+ break;
+ case 2: // File name without extension
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(2), nNumFmt);
+ break;
+ case 3: // File name with extension
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(3), nNumFmt);
+ }
+ }
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest2::testAuthorField()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/author_field.odp"), ODP);
+
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+ uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef);
+ CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest2::testTdf99224()
+{
+ sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf99224.odp"), ODP);
+ xShell = saveAndReload(xShell, PPTX);
+ uno::Reference<drawing::XDrawPage> xPage = getPage(0, xShell);
+ // This was 0: the image with text was lost on export.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xPage->getCount());
+ xShell->DoClose();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 0a93639221a9de78eb548cf73a616f74c464d7ce
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Jun 30 17:12:23 2016 +0200
sd: split up sd_export_tests
Move all PPTX export tests to a new file.
Change-Id: Idb90baf6b145cdfaf5301583489a7257c5fa23a4
diff --git a/sd/CppunitTest_sd_export_ooxml.mk b/sd/CppunitTest_sd_export_ooxml.mk
new file mode 100644
index 0000000..e7f1520
--- /dev/null
+++ b/sd/CppunitTest_sd_export_ooxml.mk
@@ -0,0 +1,84 @@
+# -*- 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_export_ooxml))
+
+$(eval $(call gb_CppunitTest_use_externals,sd_export_ooxml,\
+ boost_headers \
+ libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sd_export_ooxml, \
+ sd/qa/unit/export-tests-ooxml \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sd_export_ooxml, \
+ $(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 \
+ $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sd_export_ooxml,\
+ -I$(SRCDIR)/sd/source/ui/inc \
+ -I$(SRCDIR)/sd/inc \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sd_export_ooxml))
+
+$(eval $(call gb_CppunitTest_use_ure,sd_export_ooxml))
+$(eval $(call gb_CppunitTest_use_vcl,sd_export_ooxml))
+
+$(eval $(call gb_CppunitTest_use_rdb,sd_export_ooxml,services))
+
+$(eval $(call gb_CppunitTest_use_custom_headers,sd_export_ooxml,\
+ officecfg/registry \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sd_export_ooxml))
+
+$(eval $(call gb_CppunitTest_add_arguments,sd_export_ooxml,\
+ -env:SVG_DISABLE_FONT_EMBEDDING= \
+))
+
+$(call gb_CppunitTest_get_target,sd_export_ooxml): \
+ $(call gb_AllLangResTarget_get_target,avmedia) \
+ $(call gb_AllLangResTarget_get_target,sd)
+
+# vim: set noet sw=4 ts=4:
diff --git a/sd/Module_sd.mk b/sd/Module_sd.mk
index 80f31fa..7fe92e5 100644
--- a/sd/Module_sd.mk
+++ b/sd/Module_sd.mk
@@ -30,6 +30,7 @@ $(eval $(call gb_Module_add_check_targets,sd,\
$(if $(and $(filter $(COM),MSC),$(MERGELIBS)),, \
CppunitTest_sd_uimpress) \
CppunitTest_sd_import_tests \
+ CppunitTest_sd_export_ooxml \
CppunitTest_sd_export_tests \
CppunitTest_sd_filters_test \
CppunitTest_sd_misc_tests \
diff --git a/sd/qa/unit/export-tests-ooxml.cxx b/sd/qa/unit/export-tests-ooxml.cxx
new file mode 100644
index 0000000..9a4f4d9
--- /dev/null
+++ b/sd/qa/unit/export-tests-ooxml.cxx
@@ -0,0 +1,1342 @@
+/* -*- 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 <officecfg/Office/Common.hxx>
+#include "sdmodeltestbase.hxx"
+#include "Outliner.hxx"
+#include <test/xmltesttools.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/propertysequence.hxx>
+#include <svl/stritem.hxx>
+#include <editeng/editobj.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/escapementitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/numitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/bulletitem.hxx>
+
+#include <oox/drawingml/drawingmltypes.hxx>
+
+#include <rsc/rscsfx.hxx>
+
+#include <svx/svdoutl.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdoashp.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdomedia.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/xflclit.hxx>
+#include <animations/animationnodehelper.hxx>
+#include <unotools/mediadescriptor.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <rtl/ustring.hxx>
+
+#include <vcl/opengl/OpenGLWrapper.hxx>
+
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <com/sun/star/animations/XAnimate.hpp>
+#include <com/sun/star/animations/TransitionType.hpp>
+#include <com/sun/star/animations/TransitionSubType.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/chart/XChartDocument.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
+#include <com/sun/star/chart2/data/XDataSequence.hpp>
+#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/table/XTable.hpp>
+#include <com/sun/star/table/XMergeableCell.hpp>
+
+#include <svx/svdotable.hxx>
+#include <config_features.h>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+using namespace css;
+using namespace css::animations;
+
+class SdOOXMLExportTest : public SdModelTestBase, public XmlTestTools
+{
+public:
+ void testBnc870233_1();
+ void testBnc870233_2();
+ void testN828390_4();
+ void testN828390_5();
+ void testFdo71961();
+ void testN828390();
+ void testBnc880763();
+ void testBnc862510_5();
+ void testBnc822347_EmptyBullet();
+ void testFdo83751();
+ void testFdo79731();
+ void testTableCellFillProperties();
+ void testBulletStartNumber();
+ void testLineStyle();
+ void testCellLeftAndRightMargin();
+ void testRightToLeftParaghraph();
+ void testTextboxWithHyperlink();
+ void testMergedCells();
+ void testTableCellBorder();
+ void testBulletColor();
+ void testTdf93883();
+ void testBulletCharAndFont();
+ void testBulletMarginAndIndentation();
+ void testParaMarginAndindentation();
+ void testExportTransitionsPPTX();
+ void testDatetimeFieldNumberFormat();
+ void testDatetimeFieldNumberFormatPPTX();
+ void testSlideNumberField();
+ void testSlideNumberFieldPPTX();
+ void testSlideCountField();
+ void testSlideNameField();
+ void testExtFileField();
+ void testAuthorField();
+
+ void testFdo90607();
+ void testTdf91378();
+//This test gives errors due to ATL
+#if HAVE_FEATURE_ATL || !defined(_WIN32)
+ void testBnc822341();
+#endif
+ void testMathObject();
+ void testMathObjectPPT2010();
+ void testTdf80224();
+ void testTdf92527();
+ void testTdf99224();
+
+ CPPUNIT_TEST_SUITE(SdOOXMLExportTest);
+
+ CPPUNIT_TEST(testFdo90607);
+ CPPUNIT_TEST(testBnc870233_1);
+ CPPUNIT_TEST(testBnc870233_2);
+ CPPUNIT_TEST(testN828390_4);
+ CPPUNIT_TEST(testN828390_5);
+ CPPUNIT_TEST(testFdo71961);
+ CPPUNIT_TEST(testN828390);
+ CPPUNIT_TEST(testBnc880763);
+ CPPUNIT_TEST(testBnc862510_5);
+ CPPUNIT_TEST(testBnc822347_EmptyBullet);
+ CPPUNIT_TEST(testFdo83751);
+ CPPUNIT_TEST(testFdo79731);
+ CPPUNIT_TEST(testTableCellFillProperties);
+ CPPUNIT_TEST(testBulletStartNumber);
+ CPPUNIT_TEST(testLineStyle);
+ CPPUNIT_TEST(testCellLeftAndRightMargin);
+ CPPUNIT_TEST(testRightToLeftParaghraph);
+ CPPUNIT_TEST(testTextboxWithHyperlink);
+ CPPUNIT_TEST(testMergedCells);
+ CPPUNIT_TEST(testTableCellBorder);
+ CPPUNIT_TEST(testBulletColor);
+ CPPUNIT_TEST(testTdf93883);
+ CPPUNIT_TEST(testBulletCharAndFont);
+ CPPUNIT_TEST(testBulletMarginAndIndentation);
+ CPPUNIT_TEST(testParaMarginAndindentation);
+ CPPUNIT_TEST(testTdf91378);
+//This test gives errors due to ATL
+#if HAVE_FEATURE_ATL || !defined(_WIN32)
+ CPPUNIT_TEST(testBnc822341);
+#endif
+ CPPUNIT_TEST(testMathObject);
+ CPPUNIT_TEST(testMathObjectPPT2010);
+ CPPUNIT_TEST(testTdf80224);
+ CPPUNIT_TEST(testExportTransitionsPPTX);
+ CPPUNIT_TEST(testTdf92527);
+ CPPUNIT_TEST(testDatetimeFieldNumberFormat);
+ CPPUNIT_TEST(testDatetimeFieldNumberFormatPPTX);
+ CPPUNIT_TEST(testSlideNumberField);
+ CPPUNIT_TEST(testSlideNumberFieldPPTX);
+ CPPUNIT_TEST(testSlideCountField);
+ CPPUNIT_TEST(testSlideNameField);
+ CPPUNIT_TEST(testExtFileField);
+ CPPUNIT_TEST(testAuthorField);
+ CPPUNIT_TEST(testTdf99224);
+
+ CPPUNIT_TEST_SUITE_END();
+
+ virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
+ {
+ struct { char const * pPrefix; char const * pURI; } namespaces[] =
+ {
+ // OOXML
+ { "ContentType", "http://schemas.openxmlformats.org/package/2006/content-types" },
+ { "rels", "http://schemas.openxmlformats.org/package/2006/relationships" },
+ { "mc", "http://schemas.openxmlformats.org/markup-compatibility/2006" },
+ { "v", "urn:schemas-microsoft-com:vml" },
+ { "a", "http://schemas.openxmlformats.org/drawingml/2006/main" },
+ { "c", "http://schemas.openxmlformats.org/drawingml/2006/chart" },
+ { "m", "http://schemas.openxmlformats.org/officeDocument/2006/math" },
+ { "pic", "http://schemas.openxmlformats.org/drawingml/2006/picture" },
+ { "wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" },
+ { "p", "http://schemas.openxmlformats.org/presentationml/2006/main" },
+ { "w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main" },
+ { "a14", "http://schemas.microsoft.com/office/drawing/2010/main" },
+ { "wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape" },
+ { "wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" },
+ };
+ for (size_t i = 0; i < SAL_N_ELEMENTS(namespaces); ++i)
+ {
+ xmlXPathRegisterNs(pXmlXPathCtx,
+ reinterpret_cast<xmlChar const *>(namespaces[i].pPrefix),
+ reinterpret_cast<xmlChar const *>(namespaces[i].pURI));
+ }
+ }
+
+ xmlDocPtr parseExport(utl::TempFile & rTempFile, OUString const& rStreamName)
+ {
+ OUString const url(rTempFile.GetURL());
+ uno::Reference<packages::zip::XZipFileAccess2> const xZipNames(
+ packages::zip::ZipFileAccess::createWithURL(
+ comphelper::getComponentContext(m_xSFactory), url));
+ uno::Reference<io::XInputStream> const xInputStream(
+ xZipNames->getByName(rStreamName), uno::UNO_QUERY);
+ std::unique_ptr<SvStream> const pStream(
+ utl::UcbStreamHelper::CreateStream(xInputStream, true));
+ xmlDocPtr const pXmlDoc = parseXmlStream(pStream.get());
+ pXmlDoc->name = reinterpret_cast<char *>(xmlStrdup(
+ reinterpret_cast<xmlChar const *>(OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr())));
+ return pXmlDoc;
+ }
+};
+
+namespace {
+
+template< typename ItemValue, typename ItemType >
+void checkFontAttributes( const SdrTextObj* pObj, ItemValue nVal)
+{
+ CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr);
+ const EditTextObject& aEdit = pObj->GetOutlinerParaObject()->GetTextObject();
+ std::vector<EECharAttrib> rLst;
+ aEdit.GetCharAttribs(0, rLst);
+ for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
+ {
+ const ItemType* pAttrib = dynamic_cast<const ItemType *>((*it).pAttr);
+ if (pAttrib)
+ {
+ CPPUNIT_ASSERT_EQUAL( nVal, static_cast<ItemValue>(pAttrib->GetValue()));
+ }
+ }
+}
+
+}
+
+void SdOOXMLExportTest::testBnc870233_1()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_1.pptx"), PPTX);
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
+
+ // The problem was all shapes had the same font (the last parsed font attributes overwrote all previous ones)
+
+ // First shape has red, bold font
+ {
+ const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 0 ) );
+ checkFontAttributes<Color, SvxColorItem>( pObj, Color(0xff0000) );
+ checkFontAttributes<FontWeight, SvxWeightItem>( pObj, WEIGHT_BOLD );
+ }
+
+ // Second shape has blue, italic font
+ {
+ const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 1 ) );
+ checkFontAttributes<Color, SvxColorItem>( pObj, Color(0x0000ff) );
+ checkFontAttributes<FontItalic, SvxPostureItem>( pObj, ITALIC_NORMAL );
+ }
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest::testBnc870233_2()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_2.pptx"), PPTX);
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
+
+ // The problem was in some SmartArts font color was wrong
+
+ // First smart art has blue font color (direct formatting)
+ {
+ const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 0 ) );
+ checkFontAttributes<Color, SvxColorItem>( pObj, Color(0x0000ff) );
+ }
+
+ // Second smart art has "dk2" font color (style)
+ {
+ const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 1 ) );
+ checkFontAttributes<Color, SvxColorItem>( pObj, Color(0x1F497D) );
+ }
+
+ // Third smart art has white font color (style)
+ {
+ const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 2 ) );
+ checkFontAttributes<Color, SvxColorItem>( pObj, Color(0xffffff) );
+ }
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest::testN828390_4()
+{
+ bool bPassed = false;
+ ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/n828390_4.odp"), ODP );
+
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
+ {
+ std::vector<EECharAttrib> rLst;
+ SdrObject *pObj = pPage->GetObj(0);
+ SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
+ CPPUNIT_ASSERT( pTxtObj );
+ const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
+ aEdit.GetCharAttribs(1, rLst);
+ for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
+ {
+ const SvxFontHeightItem * pFontHeight = dynamic_cast<const SvxFontHeightItem *>((*it).pAttr);
+ if( pFontHeight )
+ CPPUNIT_ASSERT_MESSAGE( "Font height is wrong", pFontHeight->GetHeight() == 1129 );
+ const SvxFontItem *pFont = dynamic_cast<const SvxFontItem *>((*it).pAttr);
+ if( pFont )
+ {
+ CPPUNIT_ASSERT_MESSAGE( "Font is wrong", pFont->GetFamilyName() == "Arial");
+ bPassed = true;
+ }
+ const SvxWeightItem *pWeight = dynamic_cast<const SvxWeightItem *>((*it).pAttr);
+ if( pWeight )
+ CPPUNIT_ASSERT_MESSAGE( "Font Weight is wrong", pWeight->GetWeight() == WEIGHT_BOLD);
+ }
+ }
+ CPPUNIT_ASSERT(bPassed);
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest::testN828390_5()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/n828390_5.odp"), ODP );
+
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
+ {
+ SdrObject *pObj = pPage->GetObj(0);
+ SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
+ CPPUNIT_ASSERT( pTxtObj );
+ const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
+ const SvxNumBulletItem *pNumFmt = dynamic_cast<const SvxNumBulletItem *>(aEdit.GetPool()->GetItem2(EE_PARA_NUMBULLET, 5));
+ CPPUNIT_ASSERT( pNumFmt );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's relative size is wrong!", pNumFmt->GetNumRule()->GetLevel(1).GetBulletRelSize(), sal_uInt16(75) ); // != 25
+ }
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest::testFdo71961()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/fdo71961.odp"), ODP);
+
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
+
+ // Export to .pptx changes all text frames to custom shape objects, which obey TextWordWrap property
+ // (which is false for text frames otherwise and is ignored). Check that frames that should wrap still do.
+ SdrObjCustomShape *pTxtObj = dynamic_cast<SdrObjCustomShape *>( pPage->GetObj( 1 ));
+ CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != nullptr);
+ CPPUNIT_ASSERT_EQUAL( OUString( "Text to be always wrapped" ), pTxtObj->GetOutlinerParaObject()->GetTextObject().GetText(0));
+ CPPUNIT_ASSERT_EQUAL( true, (static_cast<const SdrOnOffItem&>(pTxtObj->GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue());
+
+ pTxtObj = dynamic_cast<SdrObjCustomShape *>( pPage->GetObj( 2 ));
+ CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != nullptr);
+ CPPUNIT_ASSERT_EQUAL( OUString( "Custom shape non-wrapped text" ), pTxtObj->GetOutlinerParaObject()->GetTextObject().GetText(0));
+ CPPUNIT_ASSERT_EQUAL( false, (static_cast<const SdrOnOffItem&>(pTxtObj->GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue());
+
+ pTxtObj = dynamic_cast<SdrObjCustomShape *>( pPage->GetObj( 3 ));
+ CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != nullptr);
+ CPPUNIT_ASSERT_EQUAL( OUString( "Custom shape wrapped text" ), pTxtObj->GetOutlinerParaObject()->GetTextObject().GetText(0));
+ CPPUNIT_ASSERT_EQUAL( true, (static_cast<const SdrOnOffItem&>(pTxtObj->GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue());
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest::testN828390()
+{
+ bool bPassed = false;
+ ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/n828390.pptx"), PPTX );
+
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
+ {
+ std::vector<EECharAttrib> rLst;
+ // Get the object
+ SdrObject *pObj = pPage->GetObj(0);
+ SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
+ CPPUNIT_ASSERT( pTxtObj );
+ const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
+ aEdit.GetCharAttribs(0, rLst);
+ for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
+ {
+ const SvxEscapementItem *pFontEscapement = dynamic_cast<const SvxEscapementItem *>((*it).pAttr);
+ if(pFontEscapement)
+ {
+ if( pFontEscapement->GetEsc() == -25 )
+ {
+ bPassed = true;
+ break;
+ }
+ }
+ }
+ }
+ CPPUNIT_ASSERT_MESSAGE("Subscript not exported properly", bPassed);
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest::testBnc880763()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc880763.pptx"), PPTX);
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
+
+ // Check z-order of the two shapes, use background color to identify them
+ // First object in the background has blue background color
+ const SdrObject *pObj = dynamic_cast<SdrObject *>( pPage->GetObj( 0 ) );
+ CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr);
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32(0x0000ff),(static_cast< const XColorItem& >(pObj->GetMergedItem(XATTR_FILLCOLOR))).GetColorValue().GetColor());
+
+ // Second object at the front has green background color
+ pObj = dynamic_cast<SdrObject *>( pPage->GetObj( 1 ) );
+ CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr);
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32(0x00ff00),(static_cast< const XColorItem& >(pObj->GetMergedItem(XATTR_FILLCOLOR))).GetColorValue().GetColor());
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest::testBnc862510_5()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_5.pptx"), PPTX);
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
+
+ // Same as testBnc870237, but here we check the horizontal spacing
+ const SdrObject* pObj = dynamic_cast<SdrObject*>( pPage->GetObj( 1 ) );
+ CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr);
+ CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrMetricItem& >(pObj->GetMergedItem(SDRATTR_TEXT_UPPERDIST))).GetValue());
+ CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrMetricItem& >(pObj->GetMergedItem(SDRATTR_TEXT_LOWERDIST))).GetValue());
+ CPPUNIT_ASSERT_EQUAL( sal_Int32(7510), (static_cast< const SdrMetricItem& >(pObj->GetMergedItem(SDRATTR_TEXT_RIGHTDIST))).GetValue());
+ CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrMetricItem& >(pObj->GetMergedItem(SDRATTR_TEXT_LEFTDIST))).GetValue());
+
+ xDocShRef->DoClose();
+}
+
+// In numbering a bullet could be defined as empty (no character).
+// When exporting to OOXML make sure that the bullet is ignored and
+// not written into the file.
+void SdOOXMLExportTest::testBnc822347_EmptyBullet()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/bnc822347_EmptyBullet.odp"), ODP);
+ xDocShRef = saveAndReload(xDocShRef, PPTX);
+
+ SdDrawDocument* pDoc = xDocShRef->GetDoc();
+ SdrOutliner* pOutliner = pDoc->GetInternalOutliner();
+ const SdrPage* pPage = pDoc->GetPage(1);
+ SdrObject* pObject = pPage->GetObj(0);
+ SdrTextObj* pTextObject = dynamic_cast<SdrTextObj*>(pObject);
+ CPPUNIT_ASSERT(pTextObject);
+
+ OutlinerParaObject* pOutlinerParagraphObject = pTextObject->GetOutlinerParaObject();
+ const EditTextObject& aEdit = pOutlinerParagraphObject->GetTextObject();
+
+ OUString sText = aEdit.GetText(0);
+ CPPUNIT_ASSERT_EQUAL(OUString("M3 Feature Test"), sText);
+
+ pOutliner->SetText(*pOutlinerParagraphObject);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pOutliner->GetParagraphCount());
+
+ const sal_Int16 nDepth = pOutliner->GetDepth(0);
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(-1), nDepth); // depth >= 0 means that the paragraph has bullets enabled
+
+ xDocShRef->DoClose();
+}
+
+//Bullets not having any text following them are not getting exported to pptx correctly.
+void SdOOXMLExportTest::testFdo90607()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/fdo90607.pptx"), PPTX);
+ xDocShRef = saveAndReload(xDocShRef, PPTX);
+
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
+ SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pPage->GetObj(1) );
+ CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != nullptr);
+ OutlinerParaObject* pOutlinerParagraphObject = pTxtObj->GetOutlinerParaObject();
+ const sal_Int16 nDepth = pOutlinerParagraphObject->GetDepth(0);
+ CPPUNIT_ASSERT_MESSAGE("not equal", nDepth != -1);
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest::testFdo83751()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/fdo83751.pptx"), PPTX);
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+ SdDrawDocument *pDoc = xDocShRef->GetDoc();
+ CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
+
+ uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier( xDocShRef->GetModel(), uno::UNO_QUERY );
+ uno::Reference<document::XDocumentProperties> xProps( xDocumentPropertiesSupplier->getDocumentProperties(), uno::UNO_QUERY );
+ uno::Reference<beans::XPropertySet> xUDProps( xProps->getUserDefinedProperties(), uno::UNO_QUERY );
+ OUString propValue;
+ xUDProps->getPropertyValue("Testing") >>= propValue;
+ CPPUNIT_ASSERT_EQUAL(OUString("Document"), propValue);
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest::testFdo79731()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/fdo79731.odp"), ODP);
+ xDocShRef = saveAndReload(xDocShRef, PPTX);
+ SdDrawDocument *pDoc = xDocShRef->GetDoc();
+ CPPUNIT_ASSERT(pDoc);
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest::testTableCellFillProperties()
+{
+ std::shared_ptr< comphelper::ConfigurationChanges > batch(comphelper::ConfigurationChanges::create());
+ officecfg::Office::Common::Cache::GraphicManager::TotalCacheSize::set(sal_Int32(1), batch);
+ batch->commit();
+
+ // Load the original file
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/Table_with_Cell_Fill.odp"), ODP);
+
+ // Export the document and import again for a check
+ uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY);
+ uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
+ utl::MediaDescriptor aMediaDescriptor;
+ aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[PPTX].pFilterName), RTL_TEXTENCODING_UTF8);
+
+ utl::TempFile aTempFile;
+ aTempFile.EnableKillingFile();
+ xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
+ xComponent.set(xStorable, uno::UNO_QUERY);
+ xComponent->dispose();
+ xDocShRef = loadURL(aTempFile.GetURL(), PPTX);
+
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
+
+ sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
+ CPPUNIT_ASSERT( pTableObj );
+ uno::Reference< table::XCellRange > xTable(pTableObj->getTable(), uno::UNO_QUERY_THROW);
+ uno::Reference< beans::XPropertySet > xCell;
+
+ // Test Solid fill color
+ sal_Int32 nColor;
+ xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
+ xCell->getPropertyValue("FillColor") >>= nColor;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(6750207), nColor);
+
+ // Test Picture fill type for cell
+ drawing::FillStyle aFillStyle( drawing::FillStyle_NONE );
+ xCell.set(xTable->getCellByPosition(0, 1), uno::UNO_QUERY_THROW);
+ xCell->getPropertyValue("FillStyle") >>= aFillStyle;
+ CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP, aFillStyle);
+
+ // Test Gradient fill type for cell
+ xCell.set(xTable->getCellByPosition(1, 0), uno::UNO_QUERY_THROW);
+ xCell->getPropertyValue("FillStyle") >>= aFillStyle;
+ CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, aFillStyle);
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest::testBulletStartNumber()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/n90255.pptx"), PPTX );
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
+ SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pPage->GetObj(0) );
+ CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != nullptr);
+ const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
+ const SvxNumBulletItem *pNumFmt = dynamic_cast<const SvxNumBulletItem *>(aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET));
+ CPPUNIT_ASSERT(pNumFmt);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's start number is wrong!", sal_Int16(pNumFmt->GetNumRule()->GetLevel(0).GetStart()), sal_Int16(3) );
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest::testLineStyle()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/lineStyle.pptx"), PPTX);
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
+ SdrObject const* pShape = pPage->GetObj(0);
+ CPPUNIT_ASSERT_MESSAGE("no shape", pShape != nullptr);
+
+ const XLineStyleItem& rStyleItem = dynamic_cast<const XLineStyleItem&>(
+ pShape->GetMergedItem(XATTR_LINESTYLE));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong style",drawing::LineStyle_SOLID, rStyleItem.GetValue());
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest::testRightToLeftParaghraph()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/rightToLeftParagraph.pptx"), PPTX);
+
+ xDocShRef = saveAndReload( xDocShRef, PPTX );
+ uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
+
+ // Get first paragraph
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list