sw/qa/uitest/writer_tests7/tdf109083.py | 67 ++++++++++++++++++++++++++++++++ sw/source/uibase/app/docst.cxx | 5 +- 2 files changed, 71 insertions(+), 1 deletion(-)
New commits: commit 67512141b2cce3d74985544ca58a1d8016676d75 Author: Balazs Santha <santha.bal...@simonyi.bme.hu> AuthorDate: Fri Jun 18 14:14:04 2021 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Jun 21 13:12:37 2021 +0200 tdf#109083 sw table styles: fix missing format update of tables at table (cell) selection. Table styles (implemented as table templates yet) allows to format all tables (with the same table style) at once. Unfortunately, this worked only without table selection, putting the text cursor in a table cell. But if a table cell/row/column or the whole table was selected (e.g. after changing its format), Manage Styles(F11)->Table Styles-> Style actions menu (see top-right corner of the pane)-> Update Selected Style updated only the style, but it doesn't propagate the changes to the other tables with the same table style. This patch removes the selection to fix the problem in the same way, as the proposed workaround. Note: this fixes the usage of the user-defined table styles, too (created by Style actions->New Style from Selection). Change-Id: I58d01036d5a11e522407405e9ebc16c2c3c83e9b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117079 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit 840095f417af6619977f688f421e449273c26cae) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117552 Tested-by: Jenkins diff --git a/sw/qa/uitest/writer_tests7/tdf109083.py b/sw/qa/uitest/writer_tests7/tdf109083.py new file mode 100644 index 000000000000..bf61a0e4ee3f --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf109083.py @@ -0,0 +1,67 @@ +# -*- 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 +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos + +#Bug 109083 - Updating table style: changes didn't propagate to other tables when selection was over two columns at the moment of updating +class tdf109083(UITestCase): + def test_tdf109083(self): + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #generate two 2x2 tables with the same autoformat table style (Default Table Style) + #Note that this style is different than applying nothing! + for i in range(0, 2): + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + formatlbinstable = xDialog.getChild("formatlbinstable") + entry = formatlbinstable.getChild("1") + entry.executeAction("SELECT", tuple()) + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + #select the last row of the first table + for i in range (0,2): + self.xUITest.executeCommand(".uno:GoDown") + for i in range (0,2): + self.xUITest.executeCommand(".uno:CharRightSel") + #set a specific color on the selected cells (last row) + self.xUITest.executeCommandWithParameters(".uno:TableCellBackgroundColor", mkPropertyValues({"TableCellBackgroundColor" : 16776960 })) + + #Sidebar -> Table Styles -> Style Actions -> "Update Selected Style" (note: the row is still selected) + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "StyleListPanel"})) + xLeft = xWriterEdit.getChild('left') + xLeft.executeAction("CLICK", mkPropertyValues({"POS": "5"})) + xRight = xWriterEdit.getChild('right') + xRight.executeAction("CLICK", mkPropertyValues({"POS": "3"})) + #select the second table + for i in range (0,2): + self.xUITest.executeCommand(".uno:GoDown") + + #first row's cells must be yellow, second/last row's cells must be updated to yellow by now + for i in range (0,4): + 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 >= 2: + self.assertEqual(get_state_as_dict(hex_custom)["Text"], "ffff00") + else: + self.assertEqual(get_state_as_dict(hex_custom)["Text"], "ffffff") + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + self.xUITest.executeCommand(".uno:GoRight") + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: + diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index b9ab297aef78..0f196fcdf0a7 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -1338,7 +1338,10 @@ void SwDocShell::UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWr break; case SfxStyleFamily::Table: { - + if(GetFEShell()->IsTableMode()) + { + GetFEShell()->TableCursorToCursor(); + } SwTableAutoFormat aFormat(rName); if (pCurrWrtShell->GetTableAutoFormat(aFormat)) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits