diff options
author | Balazs Santha <santha.balazs@simonyi.bme.hu> | 2021-07-20 15:54:01 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2021-07-22 16:34:47 +0200 |
commit | 689b5a4862ead541e54e83cb14067cfaa691e2ab (patch) | |
tree | ff6db8c6a0ada2e3f45a546ba8716370cc5d790f | |
parent | cf717f6d41dd3a2a582ee1478e83c281b18b9c3f (diff) |
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 <michael.stahl@allotropia.de>
-rw-r--r-- | sw/qa/uitest/data/tdf143244.odt | bin | 0 -> 9831 bytes | |||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf143244.py | 44 | ||||
-rw-r--r-- | sw/source/core/doc/tblrwcl.cxx | 2 |
3 files changed, 45 insertions, 1 deletions
diff --git a/sw/qa/uitest/data/tdf143244.odt b/sw/qa/uitest/data/tdf143244.odt Binary files differnew file mode 100644 index 000000000000..0fd3ff915a8a --- /dev/null +++ b/sw/qa/uitest/data/tdf143244.odt diff --git a/sw/qa/uitest/writer_tests7/tdf143244.py b/sw/qa/uitest/writer_tests7/tdf143244.py new file mode 100644 index 000000000000..a47074396334 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf143244.py @@ -0,0 +1,44 @@ +# -*- 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): + with self.ui_test.load_file(get_url_for_data_file("tdf143244.odt")) as writer_doc: + 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") + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + 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") +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 6d8d86ce8f12..48ac3ea7fbc5 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; } |