From 04cae9ec1e1f04833b06fe9f24e23cfaf5265599 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@suse.cz>
Date: Sat, 24 Mar 2012 17:14:12 +0100
Subject: fdo#46955 fix RTF import of all capitals char prop

---
 sw/qa/extras/rtftok/rtftok.cxx | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

(limited to 'sw/qa')

diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 0628268b9267..472e77566e4b 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/style/CaseMap.hpp>
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/table/BorderLine2.hpp>
 #include <com/sun/star/table/BorderLineStyle.hpp>
@@ -71,6 +72,7 @@ public:
     void testN751020();
     void testFdo47326();
     void testFdo47036();
+    void testFdo46955();
 
     CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX) && !defined(WNT)
@@ -87,6 +89,7 @@ public:
     CPPUNIT_TEST(testN751020);
     CPPUNIT_TEST(testFdo47326);
     CPPUNIT_TEST(testFdo47036);
+    CPPUNIT_TEST(testFdo46955);
 #endif
     CPPUNIT_TEST_SUITE_END();
 
@@ -425,6 +428,27 @@ void RtfModelTest::testFdo47036()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
 }
 
+void RtfModelTest::testFdo46955()
+{
+    load(OUString(RTL_CONSTASCII_USTRINGPARAM("fdo46955.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();
+    while (xParaEnum->hasMoreElements())
+    {
+        uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
+        uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
+        while (xRangeEnum->hasMoreElements())
+        {
+            uno::Reference<beans::XPropertySet> xPropertySet(xRangeEnum->nextElement(), uno::UNO_QUERY);
+            sal_Int16 nValue;
+            xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharCaseMap"))) >>= nValue;
+            CPPUNIT_ASSERT_EQUAL(style::CaseMap::UPPERCASE, nValue);
+        }
+    }
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
-- 
cgit