summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-11-30 14:31:39 +0100
committerAndras Timar <andras.timar@collabora.com>2014-12-13 16:00:51 +0100
commitc0de68f5361958044ee68fa9f414dd085141b899 (patch)
treeea217d32c956fb7e0258cba1c141ecd1b1072c3d /sd
parentf593d99b7e53193e5f5073e3c16c1d1f1ce96644 (diff)
PPTX import: fix import of shape line properties defined by theme
See also: 81cd386facedfbb15be6dffc10351262abf733f3 (cherry picked from commit 664a56b3c81503bdf199edf1806676f0a35b956f) Signed-off-by: Andras Timar <andras.timar@collabora.com> Conflicts: sd/qa/unit/import-tests.cxx Change-Id: Ibb21d3e5b52a4d4996202acd4a989910fa223632
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/pptx/ShapeLineProperties.pptxbin0 -> 25433 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx73
2 files changed, 73 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/ShapeLineProperties.pptx b/sd/qa/unit/data/pptx/ShapeLineProperties.pptx
new file mode 100644
index 000000000000..36ece8caebac
--- /dev/null
+++ b/sd/qa/unit/data/pptx/ShapeLineProperties.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index b92b475d2088..316740e4de32 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -31,6 +31,9 @@
#include <svx/svdoole2.hxx>
#include <svx/svdotable.hxx>
#include <svx/xflclit.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlnwtit.hxx>
#include <animations/animationnodehelper.hxx>
#include <sax/tools/converter.hxx>
@@ -93,6 +96,7 @@ public:
void testBnc584721_4();
void testFdo79731();
void testBnc904423();
+ void testShapeLineStyle();
CPPUNIT_TEST_SUITE(SdFiltersTest);
CPPUNIT_TEST(testDocumentLayout);
@@ -127,6 +131,7 @@ public:
CPPUNIT_TEST(testBnc584721_4);
CPPUNIT_TEST(testFdo79731);
CPPUNIT_TEST(testBnc904423);
+ CPPUNIT_TEST(testShapeLineStyle);
CPPUNIT_TEST_SUITE_END();
};
@@ -1171,6 +1176,74 @@ void SdFiltersTest::testBnc904423()
xDocShRef->DoClose();
}
+void SdFiltersTest::testShapeLineStyle()
+{
+ // Here the problem was that different line properties were applied in wrong order on the shape
+ // Right order: 1) master slide line style, 2) theme, 3) direct formatting
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/ShapeLineProperties.pptx"));
+
+ SdDrawDocument *pDoc = xDocShRef->GetDoc();
+ CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
+ const SdrPage *pPage = pDoc->GetPage(1);
+ CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
+
+ // First shape's line style is defined on master slide
+ {
+ SdrObject *const pObj = pPage->GetObj(0);
+ CPPUNIT_ASSERT(pObj);
+
+ const XLineStyleItem& rStyleItem = dynamic_cast<const XLineStyleItem&>(
+ pObj->GetMergedItem(XATTR_LINESTYLE));
+ CPPUNIT_ASSERT_EQUAL(XLINE_DASH, rStyleItem.GetValue());
+
+ const XLineColorItem& rColorItem = dynamic_cast<const XLineColorItem&>(
+ pObj->GetMergedItem(XATTR_LINECOLOR));
+ CPPUNIT_ASSERT_EQUAL(ColorData(0xFF0000), rColorItem.GetColorValue().GetColor());
+
+ const XLineWidthItem& rWidthItem = dynamic_cast<const XLineWidthItem&>(
+ pObj->GetMergedItem(XATTR_LINEWIDTH));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(132), rWidthItem.GetValue());
+ }
+
+ // Second shape's line style is defined by theme
+ {
+ SdrObject *const pObj = pPage->GetObj(1);
+ CPPUNIT_ASSERT(pObj);
+
+ const XLineStyleItem& rStyleItem = dynamic_cast<const XLineStyleItem&>(
+ pObj->GetMergedItem(XATTR_LINESTYLE));
+ CPPUNIT_ASSERT_EQUAL(XLINE_SOLID, rStyleItem.GetValue());
+
+ const XLineColorItem& rColorItem = dynamic_cast<const XLineColorItem&>(
+ pObj->GetMergedItem(XATTR_LINECOLOR));
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x3333CC), rColorItem.GetColorValue().GetColor());
+
+ const XLineWidthItem& rWidthItem = dynamic_cast<const XLineWidthItem&>(
+ pObj->GetMergedItem(XATTR_LINEWIDTH));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(35), rWidthItem.GetValue());
+ }
+
+ // Third shape's line style is defined by direct formatting
+ {
+ SdrObject *const pObj = pPage->GetObj(2);
+ CPPUNIT_ASSERT(pObj);
+
+ const XLineStyleItem& rStyleItem = dynamic_cast<const XLineStyleItem&>(
+ pObj->GetMergedItem(XATTR_LINESTYLE));
+ CPPUNIT_ASSERT_EQUAL(XLINE_SOLID, rStyleItem.GetValue());
+
+ const XLineColorItem& rColorItem = dynamic_cast<const XLineColorItem&>(
+ pObj->GetMergedItem(XATTR_LINECOLOR));
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x7030A0), rColorItem.GetColorValue().GetColor());
+
+ const XLineWidthItem& rWidthItem = dynamic_cast<const XLineWidthItem&>(
+ pObj->GetMergedItem(XATTR_LINEWIDTH));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(176), rWidthItem.GetValue());
+ }
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest);
CPPUNIT_PLUGIN_IMPLEMENT();