summaryrefslogtreecommitdiff
path: root/sd/qa
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2017-08-31 18:32:58 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-09-07 10:18:20 +0200
commit7b65e7eea560da718c3cbc76a049a8d60b2809e9 (patch)
treea2a6d5f09fce606a5d32107bf7861a448f8f1d5c /sd/qa
parent4e80c53e20845e0ffcdbd890bd0c3730c15dff42 (diff)
tdf#111884: Implement export of group shapes in pptx.
Contains also: tdf#111884: Unit test. related tdf#111884: GroupShapes are now handled in oox. Change-Id: If12984c0670db6396cbfd0dcb8ae1f5a9b591705 Reviewed-on: https://gerrit.libreoffice.org/41766 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jan Holesovsky <kendy@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/41997 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sd/qa')
-rw-r--r--sd/qa/unit/data/pptx/tdf111884.pptxbin0 -> 30898 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml1.cxx43
2 files changed, 35 insertions, 8 deletions
diff --git a/sd/qa/unit/data/pptx/tdf111884.pptx b/sd/qa/unit/data/pptx/tdf111884.pptx
new file mode 100644
index 000000000000..9d08b668defa
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf111884.pptx
Binary files differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index 2fc233bf836a..3daf058daa9c 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -104,6 +104,7 @@ public:
void testBulletCharAndFont();
void testBulletMarginAndIndentation();
void testParaMarginAndindentation();
+ void testTdf111884();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
@@ -131,6 +132,7 @@ public:
CPPUNIT_TEST(testBulletCharAndFont);
CPPUNIT_TEST(testBulletMarginAndIndentation);
CPPUNIT_TEST(testParaMarginAndindentation);
+ CPPUNIT_TEST(testTdf111884);
CPPUNIT_TEST_SUITE_END();
@@ -221,20 +223,26 @@ void SdOOXMLExportTest1::testBnc870233_2()
// First smart art has blue font color (direct formatting)
{
- const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 0 ) );
- checkFontAttributes<Color, SvxColorItem>( pObj, Color(0x0000ff) );
+ const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(0));
+ CPPUNIT_ASSERT(pObjGroup);
+ const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>(pObjGroup->GetSubList()->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 ) );
+ const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(2)); // FIXME should be 1, smartart import creates an additional empty group for some reason
+ CPPUNIT_ASSERT(pObjGroup);
+ const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>(pObjGroup->GetSubList()->GetObj(0));
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) );
+ const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(4)); // FIXME should be 2, smartart import creates an additional empty group for some reason
+ CPPUNIT_ASSERT(pObjGroup);
+ const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>(pObjGroup->GetSubList()->GetObj(0));
+ checkFontAttributes<Color, SvxColorItem>(pObj, Color(0xffffff));
}
xDocShRef->DoClose();
@@ -366,12 +374,14 @@ void SdOOXMLExportTest1::testBnc880763()
// 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 ) );
+ const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(0));
+ CPPUNIT_ASSERT(pObjGroup);
+ const SdrObject *pObj = dynamic_cast<SdrObject *>(pObjGroup->GetSubList()->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 ) );
+ pObj = dynamic_cast<SdrObject *>(pPage->GetObj(2)); // FIXME should be 1, smartart import creates an additional empty group for some reason
CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr);
CPPUNIT_ASSERT_EQUAL( sal_uInt32(0x00ff00),(static_cast< const XColorItem& >(pObj->GetMergedItem(XATTR_FILLCOLOR))).GetColorValue().GetColor());
@@ -386,7 +396,9 @@ void SdOOXMLExportTest1::testBnc862510_5()
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 ) );
+ const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(0));
+ CPPUNIT_ASSERT(pObjGroup);
+ const SdrObject* pObj = dynamic_cast<SdrObject*>(pObjGroup->GetSubList()->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());
@@ -779,6 +791,21 @@ void SdOOXMLExportTest1::testTableCellBorder()
xDocShRef->DoClose();
}
+void SdOOXMLExportTest1::testTdf111884()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf111884.pptx"), PPTX);
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
+
+ const SdrPage *pPage = GetPage(1, xDocShRef);
+ SdrObject const* pShape = pPage->GetObj(2);
+ CPPUNIT_ASSERT_MESSAGE("no shape", pShape != nullptr);
+
+ // must be a group shape
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(OBJ_GRUP), pShape->GetObjIdentifier());
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest1);
CPPUNIT_PLUGIN_IMPLEMENT();