[Libreoffice-commits] .: sw/qa writerfilter/source
Miklos Vajna
vmiklos at kemper.freedesktop.org
Wed May 2 09:11:17 PDT 2012
sw/qa/extras/rtftok/data/fdo47764.rtf | 4 ++++
sw/qa/extras/rtftok/rtftok.cxx | 16 ++++++++++++++++
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 1 +
3 files changed, 21 insertions(+)
New commits:
commit e8706d7a110547c04e6db9ed75b2e7f74bd6d0bd
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed May 2 17:50:55 2012 +0200
fdo#47764 fix RTF import of automatic paragraph background color
Change-Id: I4b3a4bd6ce45cffc5b2c23052c49ff98579c5564
diff --git a/sw/qa/extras/rtftok/data/fdo47764.rtf b/sw/qa/extras/rtftok/data/fdo47764.rtf
new file mode 100644
index 0000000..2a9d367
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo47764.rtf
@@ -0,0 +1,4 @@
+{\rtf1
+\cbpat0\cf0
+bug
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index eba7bea..137062a 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -91,6 +91,7 @@ public:
void testFdo48193();
void testFdo44211();
void testFdo48037();
+ void testFdo47764();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -120,6 +121,7 @@ public:
CPPUNIT_TEST(testFdo48193);
CPPUNIT_TEST(testFdo44211);
CPPUNIT_TEST(testFdo48037);
+ CPPUNIT_TEST(testFdo47764);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -660,6 +662,20 @@ void Test::testFdo48037()
CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
}
+void Test::testFdo47764()
+{
+ load("fdo47764.rtf");
+
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
+ uno::Reference<beans::XPropertySet> xPropertySet(xParaEnum->nextElement(), uno::UNO_QUERY);
+ sal_Int32 nValue = 0;
+ // \cbpat with zero argument should mean the auto (-1) color, not a default color (black)
+ xPropertySet->getPropertyValue("ParaBackColor") >>= nValue;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), nValue);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 0e1a53f..9bbbcb0 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2331,6 +2331,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
}
break;
case RTF_CBPAT:
+ if (nParam)
{
RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam)));
lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, NS_sprm::LN_PShd, NS_ooxml::LN_CT_Shd_fill, pValue);
More information about the Libreoffice-commits
mailing list