summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-11-28 19:57:58 +0100
committerAndras Timar <andras.timar@collabora.com>2014-12-13 16:00:50 +0100
commitf593d99b7e53193e5f5073e3c16c1d1f1ce96644 (patch)
treea1fe90b81e4b7ccb887ebfd3d2725e7222e2682b /sd
parentd022bc5d27c6cd393358ab9d0ff78886e3d130aa (diff)
bnc#904423: Text(box) is rendered white on white when it is not
The problem was that the background color defined by theme was not imported correctly, because the different fill style comes from different sources (master slide, theme, direct formatting) were applied on the shape in wrong order. To solve this we need to store master slide defined fill style in a different variable so theme style can be applied after master slide defined style but before direct formatting. (cherry picked from commit 81cd386facedfbb15be6dffc10351262abf733f3) Signed-off-by: Andras Timar <andras.timar@collabora.com> Conflicts: sd/qa/unit/import-tests.cxx Change-Id: I99ea981858b9fa391915570187c8ddfdf2be1f7a
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/pptx/bnc904423.pptxbin0 -> 25119 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx54
2 files changed, 54 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/bnc904423.pptx b/sd/qa/unit/data/pptx/bnc904423.pptx
new file mode 100644
index 000000000000..618ad1b473e1
--- /dev/null
+++ b/sd/qa/unit/data/pptx/bnc904423.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index ede33d6fda7c..b92b475d2088 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -92,6 +92,7 @@ public:
void testCreationDate();
void testBnc584721_4();
void testFdo79731();
+ void testBnc904423();
CPPUNIT_TEST_SUITE(SdFiltersTest);
CPPUNIT_TEST(testDocumentLayout);
@@ -125,6 +126,7 @@ public:
CPPUNIT_TEST(testCreationDate);
CPPUNIT_TEST(testBnc584721_4);
CPPUNIT_TEST(testFdo79731);
+ CPPUNIT_TEST(testBnc904423);
CPPUNIT_TEST_SUITE_END();
};
@@ -1116,6 +1118,58 @@ void SdFiltersTest::testFdo79731()
xDocShRef->DoClose();
}
+void SdFiltersTest::testBnc904423()
+{
+ // Here the problem was that different fill properties were applied in wrong order on the shape
+ // Right order: 1) master slide fill style, 2) theme, 3) direct formatting
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/bnc904423.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 background color is defined on master slide
+ {
+ SdrObject *const pObj = pPage->GetObj(0);
+ CPPUNIT_ASSERT(pObj);
+
+ const XFillStyleItem& rStyleItem = dynamic_cast<const XFillStyleItem&>(
+ pObj->GetMergedItem(XATTR_FILLSTYLE));
+ CPPUNIT_ASSERT_EQUAL(XFILL_SOLID, rStyleItem.GetValue());
+ const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>(
+ pObj->GetMergedItem(XATTR_FILLCOLOR));
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x00CC99), rColorItem.GetColorValue().GetColor());
+ }
+
+ // Second shape's background color is defined by theme
+ {
+ SdrObject *const pObj = pPage->GetObj(1);
+ CPPUNIT_ASSERT(pObj);
+
+ const XFillStyleItem& rStyleItem = dynamic_cast<const XFillStyleItem&>(
+ pObj->GetMergedItem(XATTR_FILLSTYLE));
+ CPPUNIT_ASSERT_EQUAL(XFILL_SOLID, rStyleItem.GetValue());
+ const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>(
+ pObj->GetMergedItem(XATTR_FILLCOLOR));
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x3333CC), rColorItem.GetColorValue().GetColor());
+ }
+
+ // Third shape's background color is defined by direct formatting
+ {
+ SdrObject *const pObj = pPage->GetObj(2);
+ CPPUNIT_ASSERT(pObj);
+
+ const XFillStyleItem& rStyleItem = dynamic_cast<const XFillStyleItem&>(
+ pObj->GetMergedItem(XATTR_FILLSTYLE));
+ CPPUNIT_ASSERT_EQUAL(XFILL_SOLID, rStyleItem.GetValue());
+ const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>(
+ pObj->GetMergedItem(XATTR_FILLCOLOR));
+ CPPUNIT_ASSERT_EQUAL(ColorData(0xFF0000), rColorItem.GetColorValue().GetColor());
+ }
+
+ xDocShRef->DoClose();
+}
CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest);