summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-09-30 19:55:25 +0200
committerAndras Timar <andras.timar@collabora.com>2014-10-14 15:28:01 +0200
commitd514c6b8855a0a473986d3039874bef133d68949 (patch)
tree2f8a1d37486a2087bcdd3dddc76b04c062a2d780 /sd
parent7d81a3c2690ee7e6e9ac1df47e7afeb9f98bd8e4 (diff)
bnc#584721: invisible text because of wrong color (white)
Color::getColor() method uses some caching mechanism which works wrong when the result depend on one of the input parameters. So avoid caching in these cases. (cherry picked from commit cfe658c289de030dc3a8fecd3bac0a0004a18061) Conflicts: sd/qa/unit/import-tests.cxx Change-Id: Ifa9221e21e685715454de86d5cec09ff6c266307 Reviewed-on: https://gerrit.libreoffice.org/11724 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/pptx/bnc584721_4.pptxbin0 -> 34738 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx41
2 files changed, 41 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/bnc584721_4.pptx b/sd/qa/unit/data/pptx/bnc584721_4.pptx
new file mode 100644
index 000000000000..102ee0b14785
--- /dev/null
+++ b/sd/qa/unit/data/pptx/bnc584721_4.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index f9fc0dde5b7a..640063ac180a 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -90,6 +90,7 @@ public:
void testBnc862510_5();
void testBnc480256();
void testCreationDate();
+ void testBnc584721_4();
CPPUNIT_TEST_SUITE(SdFiltersTest);
CPPUNIT_TEST(testDocumentLayout);
@@ -121,6 +122,7 @@ public:
CPPUNIT_TEST(testBnc862510_5);
CPPUNIT_TEST(testBnc480256);
CPPUNIT_TEST(testCreationDate);
+ CPPUNIT_TEST(testBnc584721_4);
CPPUNIT_TEST_SUITE_END();
};
@@ -1064,6 +1066,45 @@ void SdFiltersTest::testBnc480256()
xDocShRef->DoClose();
}
+void SdFiltersTest::testBnc584721_4()
+{
+ // Black text was imported as white because of wrong caching mechanism
+
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc584721_4.pptx"));
+
+ uno::Reference< drawing::XDrawPagesSupplier > xDoc(
+ xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
+
+ uno::Reference< drawing::XDrawPage > xPage(
+ xDoc->getDrawPages()->getByIndex(1), uno::UNO_QUERY_THROW );
+
+ uno::Reference< beans::XPropertySet > xShape(
+ xPage->getByIndex(1), uno::UNO_QUERY );
+ CPPUNIT_ASSERT_MESSAGE( "no text 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( "no 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(COL_BLACK), nCharColor );
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest);
CPPUNIT_PLUGIN_IMPLEMENT();