[Libreoffice-commits] core.git: sw/qa sw/source

Serge Krot Serge.Krot at cib.de
Thu Mar 15 15:53:45 UTC 2018


 sw/qa/extras/uiwriter/data/tdf112448.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx       |   15 +++++++++++++++
 sw/source/core/text/itrform2.cxx         |    6 +++---
 3 files changed, 18 insertions(+), 3 deletions(-)

New commits:
commit 3c3f10da500967fc6ffecc2f3e076d8ff43e7503
Author: Serge Krot <Serge.Krot at cib.de>
Date:   Thu Mar 15 11:17:42 2018 +0100

    tdf#112448: Fix: take correct line height
    
    When line metrics is not calculated we need to call CalcRealHeight()
    before usage of the Height() and GetRealHeight().
    
    Change-Id: I104bbb81ea9d7130dfd728f7114d02e3672afbc3
    Reviewed-on: https://gerrit.libreoffice.org/51319
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/qa/extras/uiwriter/data/tdf112448.odt b/sw/qa/extras/uiwriter/data/tdf112448.odt
new file mode 100755
index 000000000000..ffb1ef6b6860
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf112448.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 703232b9cb8c..63f02288c8f4 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -295,6 +295,7 @@ public:
     void testTdf99689TableOfContents();
     void testTdf99689TableOfFigures();
     void testTdf99689TableOfTables();
+    void testTdf112448();
     void testTdf113790();
     void testTdf108048();
     void testTdf114306();
@@ -477,6 +478,7 @@ public:
     CPPUNIT_TEST(testTdf99689TableOfContents);
     CPPUNIT_TEST(testTdf99689TableOfFigures);
     CPPUNIT_TEST(testTdf99689TableOfTables);
+    CPPUNIT_TEST(testTdf112448);
     CPPUNIT_TEST(testTdf113790);
     CPPUNIT_TEST(testTdf108048);
     CPPUNIT_TEST(testTdf114306);
@@ -5777,6 +5779,19 @@ void SwUiWriterTest::testParagraphOfTextRange()
     CPPUNIT_ASSERT_EQUAL(OUString("In section"), xParagraph->getString());
 }
 
+// tdf#112448: Fix: take correct line height
+//
+// When line metrics is not calculated we need to call CalcRealHeight()
+// before usage of the Height() and GetRealHeight().
+void SwUiWriterTest::testTdf112448()
+{
+    createDoc("tdf112448.odt");
+
+    // check actual number of line breaks in the paragraph
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+    assertXPath(pXmlDoc, "/root/page/body/txt/LineBreak", 2);
+}
+
 void SwUiWriterTest::testTdf113790()
 {
     SwDoc* pDoc = createDoc("tdf113790.docx");
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 382fe7c24258..fd91902a920c 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -2256,13 +2256,13 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
     }
     else
     {
-        nAscent = pLast->GetAscent();
-        nHeight = pLast->Height();
-
         // We make a first guess for the lines real height
         if ( ! m_pCurr->GetRealHeight() )
             CalcRealHeight();
 
+        nAscent = pLast->GetAscent();
+        nHeight = pLast->Height();
+
         if ( m_pCurr->GetRealHeight() > nHeight )
             nTop += m_pCurr->GetRealHeight() - nHeight;
         else


More information about the Libreoffice-commits mailing list