sw/qa/uitest/data/tdf143244.odt         |binary
 sw/qa/uitest/writer_tests7/tdf143244.py |   50 ++++++++++++++++++++++++++++++++
 sw/source/core/doc/tblrwcl.cxx          |    2 -
 3 files changed, 51 insertions(+), 1 deletion(-)

New commits:
commit 53902e2ecf8ab1bb3f1cfa203de105d6d956e7ef
Author:     Balazs Santha <[email protected]>
AuthorDate: Tue Jul 20 15:54:01 2021 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Thu Aug 12 17:54:09 2021 +0200

    tdf#143244 sw: fix redo of adding table rows breaks table style
    
    This fixes a bug, which caused the break of table style when redo of 
inserting table rows, Normally, upon inserting a row, the formatting of the 
table is updated by the UpdateTableStyleFormatting() function.
    In certain situations (e.g in the description of the bug) this update 
wasn't successful. This was beacuse, the update function didn't know which 
tableNode needs to be updated.
    As the proper tableNode we need is already calculated in the 
SwTable::InsertRow function, we simply had to pass this argument too.
    
    Change-Id: I81ebd7bb37eebc9be8974f3f7a1adc5ad4ba1e7d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119249
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119408

diff --git a/sw/qa/uitest/data/tdf143244.odt b/sw/qa/uitest/data/tdf143244.odt
new file mode 100644
index 000000000000..0fd3ff915a8a
Binary files /dev/null and b/sw/qa/uitest/data/tdf143244.odt differ
diff --git a/sw/qa/uitest/writer_tests7/tdf143244.py 
b/sw/qa/uitest/writer_tests7/tdf143244.py
new file mode 100644
index 000000000000..444b29bbf65d
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf143244.py
@@ -0,0 +1,50 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import select_pos
+
+# Bug 143244 - Redo of adding table rows breaks table style after cut/paste 
action
+
+
+class tdf143244(UITestCase):
+    def test_tdf143244(self):
+        self.ui_test.load_file(get_url_for_data_file("tdf143244.odt"))
+        self.xUITest.executeCommand(".uno:SelectAll")
+        self.xUITest.executeCommand(".uno:Cut")
+        self.xUITest.executeCommand(".uno:Paste")
+        self.xUITest.executeCommand(".uno:GoUp")
+        xWriterDoc = self.xUITest.getTopFocusWindow()
+        xWriterEdit = xWriterDoc.getChild("writer_edit")
+        for i in range(0,6):
+            xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"TAB"}))
+        for i in range(0,4):
+            self.xUITest.executeCommand(".uno:Undo")
+        for i in range(0,4):
+            self.xUITest.executeCommand(".uno:Redo")
+        for i in range (0,3):
+            self.xUITest.executeCommand(".uno:GoUp")
+            self.ui_test.execute_dialog_through_command(".uno:TableDialog")
+            xDialog = self.xUITest.getTopFocusWindow()
+            xTabs = xDialog.getChild("tabcontrol")
+            select_pos(xTabs, "4")   #tab Background
+            btncolor = xDialog.getChild("btncolor")
+            btncolor.executeAction("CLICK", tuple())
+            hex_custom = xDialog.getChild("hex_custom")
+            if i == 0:
+                self.assertEqual(get_state_as_dict(hex_custom)["Text"], 
"bee3d3")
+            if i == 1:
+                self.assertEqual(get_state_as_dict(hex_custom)["Text"], 
"ffffff")
+            if i == 2:
+                self.assertEqual(get_state_as_dict(hex_custom)["Text"], 
"dddddd")
+
+            xOKBtn = xDialog.getChild("ok")
+            self.ui_test.close_dialog_through_button(xOKBtn)
+
+        self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 7b5367255fda..cb166d222cad 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -607,7 +607,7 @@ bool SwTable::InsertRow_( SwDoc* pDoc, const SwSelBoxes& 
rBoxes,
         pPCD->AddRowCols( *this, rBoxes, nCnt, bBehind );
     pDoc->UpdateCharts( GetFrameFormat()->GetName() );
 
-    pDoc->GetDocShell()->GetFEShell()->UpdateTableStyleFormatting();
+    pDoc->GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(pTableNd);
 
     return true;
 }

Reply via email to