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

Justin Luth justin_luth at sil.org
Fri Mar 31 06:01:40 UTC 2017


 sw/qa/extras/uiwriter/data/tdf106701_tabOverMarginAutotab.doc |binary
 sw/qa/extras/uiwriter/uiwriter.cxx                            |   15 ++++++++++
 sw/source/core/text/txttab.cxx                                |    2 -
 3 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 5251e7988a3bb1cfccff54eccf7fdd7621c4627c
Author: Justin Luth <justin_luth at sil.org>
Date:   Thu Mar 30 12:48:18 2017 +0300

    tdf#106701 tabOverMargin: only affect specified tabstops, not autotab
    
    Change-Id: I15bf3a8555a152cab90380524b4a968f9f95fc37
    Reviewed-on: https://gerrit.libreoffice.org/35924
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/uiwriter/data/tdf106701_tabOverMarginAutotab.doc b/sw/qa/extras/uiwriter/data/tdf106701_tabOverMarginAutotab.doc
new file mode 100644
index 000000000000..438a8cb791f2
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf106701_tabOverMarginAutotab.doc differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 1bd2b02f1d6e..e5ea84a5d8f0 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -227,6 +227,7 @@ public:
     void testTdf104814();
     void testTdf66405();
     void testTdf35021_tabOverMarginDemo();
+    void testTdf106701_tabOverMarginAutotab();
     void testTdf104492();
     void testTdf105417();
     void testTdf105625();
@@ -349,6 +350,7 @@ public:
     CPPUNIT_TEST(testTdf104814);
     CPPUNIT_TEST(testTdf66405);
     CPPUNIT_TEST(testTdf35021_tabOverMarginDemo);
+    CPPUNIT_TEST(testTdf106701_tabOverMarginAutotab);
     CPPUNIT_TEST(testTdf104492);
     CPPUNIT_TEST(testTdf105417);
     CPPUNIT_TEST(testTdf105625);
@@ -4415,6 +4417,19 @@ void SwUiWriterTest::testTdf35021_tabOverMarginDemo()
     CPPUNIT_ASSERT_MESSAGE("Decimal Tab width is ~4096", nMargin < nWidth);
 }
 
+void SwUiWriterTest::testTdf106701_tabOverMarginAutotab()
+{
+    createDoc("tdf106701_tabOverMarginAutotab.doc");
+    calcLayout();
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+    // The right margin is ~3378
+    sal_Int32 nRightMargin = getXPath(pXmlDoc, "//body/txt[1]/infos/prtBounds", "width").toInt32();
+    // Automatic tabstops should never be affected by tabOverMargin compatibility
+    // The 1st line's width previously was ~9506
+    sal_Int32 nWidth = getXPath(pXmlDoc, "//LineBreak[1]", "nWidth").toInt32();
+    CPPUNIT_ASSERT_MESSAGE("1st line's width is less than the right margin", nWidth < nRightMargin);
+}
+
 void SwUiWriterTest::testTdf104492()
 {
     createDoc("tdf104492.docx");
diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index b2dfd6ff146b..451dcb4d4b4e 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -378,7 +378,7 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf )
             case POR_TABLEFT:
             {
                 // handle this case in PostFormat
-                if( bTabOverMargin && GetTabPos() > rInf.Width() )
+                if( bTabOverMargin && !bAutoTabStop && GetTabPos() > rInf.Width() )
                 {
                     rInf.SetLastTab( this );
                     break;


More information about the Libreoffice-commits mailing list