diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-12-22 17:53:00 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-01-08 15:09:26 +0100 |
commit | a95d8b1692cb60a7115ca225fde212a18c86025e (patch) | |
tree | 7be5e34d7d5b28c858864eb0bb31c1af377a4bc9 /sd | |
parent | edbd022a51813eab6dbafeb500b650bbf0224462 (diff) |
bnc#862510: PPTX import: Wrong text color inside shape
When theme index is 0, it means it's unset so we should not
apply that.
(cherry picked from commit 89206c472ecf18bfde6824cea8004921cd404365)
Conflicts:
sd/qa/unit/import-tests.cxx
Conflicts:
sd/qa/unit/import-tests.cxx
Change-Id: I62a9cd2a9b4c19f5acffc334d5e8263fe24fc8fd
Reviewed-on: https://gerrit.libreoffice.org/13606
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit 4679ba35ad02a720789a8d0c571fafe4122d91a2)
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/pptx/bnc862510_6.pptx | bin | 0 -> 48707 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 40 |
2 files changed, 40 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/bnc862510_6.pptx b/sd/qa/unit/data/pptx/bnc862510_6.pptx Binary files differnew file mode 100644 index 000000000000..fc5f008c5c32 --- /dev/null +++ b/sd/qa/unit/data/pptx/bnc862510_6.pptx diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 68a205ef18a2..e5ab540eb2c3 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -97,6 +97,7 @@ public: void testFdo79731(); void testBnc904423(); void testShapeLineStyle(); + void testBnc862510_6(); #if !defined WNT void testBnc822341(); #endif @@ -135,6 +136,7 @@ public: CPPUNIT_TEST(testFdo79731); CPPUNIT_TEST(testBnc904423); CPPUNIT_TEST(testShapeLineStyle); + CPPUNIT_TEST(testBnc862510_6); #if !defined WNT CPPUNIT_TEST(testBnc822341); #endif @@ -1251,6 +1253,44 @@ void SdFiltersTest::testShapeLineStyle() xDocShRef->DoClose(); } +void SdFiltersTest::testBnc862510_6() +{ + // Black text was imported instead of gray + ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_6.pptx")); + + uno::Reference< drawing::XDrawPagesSupplier > xDoc( + xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW ); + + uno::Reference< drawing::XDrawPage > xPage( + xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW ); + + uno::Reference< beans::XPropertySet > xShape( + xPage->getByIndex(0), uno::UNO_QUERY ); + CPPUNIT_ASSERT_MESSAGE( "no shape", xShape.is() ); + + // Get first paragraph of the text + uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText(); + CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText.is() ); + uno::Reference<container::XEnumerationAccess> paraEnumAccess; + paraEnumAccess.set(xText, uno::UNO_QUERY); + uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration(); + uno::Reference<text::XTextRange> const xParagraph(paraEnum->nextElement(), + uno::UNO_QUERY_THROW); + + // Get first run of the paragraph + uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParagraph, uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration(); + uno::Reference<text::XTextRange> xRun(xRunEnum->nextElement(), uno::UNO_QUERY); + uno::Reference< beans::XPropertySet > xPropSet( xRun, uno::UNO_QUERY_THROW ); + sal_Int32 nCharColor; + xPropSet->getPropertyValue( "CharColor" ) >>= nCharColor; + + // Color should be black + CPPUNIT_ASSERT_EQUAL( sal_Int32(0x8B8B8B), nCharColor ); + + xDocShRef->DoClose(); +} + #if !defined WNT void SdFiltersTest::testBnc822341() |