summaryrefslogtreecommitdiff
path: root/sd/qa/unit
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-06-06 10:16:39 +0200
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-06-06 10:36:25 +0200
commitb54d8d2410617eec56507ba9419abbf2f356c7ff (patch)
tree5bc24bd5fd0566f2a5c58cbf3c7fde23a734f26b /sd/qa/unit
parentc4b909bf03642b6eaa5e8c6c1157a15458c28b26 (diff)
2nd part of bnc#870233: import font color from color fragment for SmartArts
SmartArt import ignores some fragments during import if drawing fragment exists, which seems to be not complete. In this case font style is blank (white) in data (and drawing) fragment and the real value is defined in the ignored color fragment. So first make color fragment parsing work, then apply font color of "node0" style on nodes of the SmartArt. Actually, it's a workaround, because "node0" style label is hardcoded, for a proper solution layout fragment should be parsed too to get the right style label, but it interferes with the drawing fragment by now. Change-Id: I7db89176a07eee928563d42d3896fbd02190dfa8 (cherry picked from commit 639571d52b1b7e4cf912803642ca245c5dd86839)
Diffstat (limited to 'sd/qa/unit')
-rw-r--r--sd/qa/unit/data/pptx/bnc870233_2.pptxbin0 -> 55758 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx68
2 files changed, 68 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/bnc870233_2.pptx b/sd/qa/unit/data/pptx/bnc870233_2.pptx
new file mode 100644
index 000000000000..7f4fc715aab4
--- /dev/null
+++ b/sd/qa/unit/data/pptx/bnc870233_2.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index b9418b4d99ca..ce0d9d17c220 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -76,6 +76,7 @@ public:
void testMediaEmbedding();
void testBnc870237();
void testBnc870233_1();
+ void testBnc870233_2();
CPPUNIT_TEST_SUITE(SdFiltersTest);
CPPUNIT_TEST(testDocumentLayout);
@@ -102,6 +103,7 @@ public:
CPPUNIT_TEST(testMediaEmbedding);
CPPUNIT_TEST(testBnc870237);
CPPUNIT_TEST(testBnc870233_1);
+ CPPUNIT_TEST(testBnc870233_2);
CPPUNIT_TEST_SUITE_END();
};
@@ -832,6 +834,72 @@ void SdFiltersTest::testBnc870233_1()
xDocShRef->DoClose();
}
+void SdFiltersTest::testBnc870233_2()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_2.pptx"));
+ xDocShRef = saveAndReload( xDocShRef, 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 );
+
+ // 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 ) );
+ CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL);
+ 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 SvxColorItem *pCharColor = dynamic_cast<const SvxColorItem *>((*it).pAttr);
+ if( pCharColor )
+ {
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32(0x0000ff), pCharColor->GetValue().GetColor());
+ }
+ }
+ }
+
+ // Second smart art has "dk2" font color (style)
+ {
+ const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 1 ) );
+ CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL);
+ 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 SvxColorItem *pCharColor = dynamic_cast<const SvxColorItem *>((*it).pAttr);
+ if( pCharColor )
+ {
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32(0x1F497D), pCharColor->GetValue().GetColor());
+ }
+ }
+ }
+
+ // Third smart art has white font color (style)
+ {
+ const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 2 ) );
+ CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL);
+ 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 SvxColorItem *pCharColor = dynamic_cast<const SvxColorItem *>((*it).pAttr);
+ if( pCharColor )
+ {
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32(0xffffff), pCharColor->GetValue().GetColor());
+ }
+ }
+ }
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest);