[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - sw/qa writerfilter/source

Miklos Vajna vmiklos at suse.cz
Fri Aug 23 02:05:55 PDT 2013


 sw/qa/extras/rtfimport/data/fdo68076.rtf       |   18 ++++++++++++++++++
 sw/qa/extras/rtfimport/rtfimport.cxx           |    9 +++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    5 +++--
 3 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit 531f3f93146615dd7c77da1d9e5917982bd1f2fe
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu Aug 22 11:21:25 2013 +0200

    fdo#68076 RTF import: default font had priority over the specified one
    
    Regression from 60c17b2873506ed8b068b34840aecda0c1d9bd65.
    
    (cherry picked from commit f1e5e271f9aadc2c5e5af3ffae410b6c598e5398)
    
    Conflicts:
    	sw/qa/extras/rtfimport/rtfimport.cxx
    
    Change-Id: Ie16d611622e6a814d5cbea00c3f992cd9ecba027
    Reviewed-on: https://gerrit.libreoffice.org/5581
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

diff --git a/sw/qa/extras/rtfimport/data/fdo68076.rtf b/sw/qa/extras/rtfimport/data/fdo68076.rtf
new file mode 100644
index 0000000..84c605a
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo68076.rtf
@@ -0,0 +1,18 @@
+{\rtf1\ansi\ansicpg1251\uc1 \deff0\deflang1033\deflangfe1049
+{\fonttbl
+{\f0\froman\fcharset0\fprq2
+{\*\panose 02020603050405020304}
+Times New Roman;}
+{\f31\froman\fcharset238\fprq2 Times New Roman CE;}
+{\f32\froman\fcharset204\fprq2 Times New Roman Cyr;}
+{\f34\froman\fcharset161\fprq2 Times New Roman Greek;}
+{\f35\froman\fcharset162\fprq2 Times New Roman Tur;}
+{\f36\froman\fcharset186\fprq2 Times New Roman Baltic;}
+}
+\paperw11906\paperh16838\margl1701\margr1134\margt1276\margb992 \widowctrl\ftnbj\aenddoc\hyphhotz142\hyphcaps0\hyphauto1\formshade\viewkind1\viewscale90\viewzk2\pgbrdrhead\pgbrdrfoot \fet0\sectd 
+\psz9\linex0\headery709\footery709\colsx709\endnhere\titlepg\sectdefaultcl 
+\pard\plain \li5812\nowidctlpar\widctlpar\adjustright \fs28\lang1049\cgrid 
+{\f32 \'ce\'e1\'fa\'e5\'ea\'f2 \endash  \'f3}
+{
+\par }
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 2e33f8e..2190243 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -150,6 +150,7 @@ public:
     void testFdo62977();
     void testFdo64671();
     void testFdo62044();
+    void testFdo68076();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -270,6 +271,7 @@ void Test::run()
         {"fdo62977.rtf", &Test::testFdo62977},
         {"fdo64671.rtf", &Test::testFdo64671},
         {"fdo62044.rtf", &Test::testFdo62044},
+        {"fdo68076.rtf", &Test::testFdo68076},
     };
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
@@ -1244,6 +1246,13 @@ void Test::testFdo62044()
     CPPUNIT_ASSERT_EQUAL(10.f, getProperty<float>(xPropertySet, "CharHeight")); // Was 18, i.e. reset back to original value.
 }
 
+void Test::testFdo68076()
+{
+    // Encoding of the last char was wrong (more 'o' than 'y').
+    OUString aExpected("\xD0\x9E\xD0\xB1\xD1\x8A\xD0\xB5\xD0\xBA\xD1\x82 \xE2\x80\x93 \xD1\x83", 19, RTL_TEXTENCODING_UTF8);
+    getParagraph(1, aExpected);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index e4cea73..27d3933 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -393,9 +393,10 @@ void RTFDocumentImpl::checkFirstRun()
             Mapper().startSectionGroup();
         Mapper().startParagraphGroup();
 
-        // set the requested default font
+        // set the requested default font, if there are none
         RTFValue::Pointer_t pFont = m_aDefaultState.aCharacterSprms.find(NS_sprm::LN_CRgFtc0);
-        if (pFont.get())
+        RTFValue::Pointer_t pCurrentFont = m_aStates.top().aCharacterSprms.find(NS_sprm::LN_CRgFtc0);
+        if (pFont && !pCurrentFont)
             dispatchValue(RTF_F, pFont->getInt());
         m_bFirstRun = false;
     }


More information about the Libreoffice-commits mailing list