Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / qa / uitest / table / tdf109083.py
blobd369ee8a53d3bd45ae6c4d26e5ef498b2091a268
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 from uitest.framework import UITestCase
10 from uitest.uihelper.common import get_state_as_dict
11 from libreoffice.uno.propertyvalue import mkPropertyValues
12 from uitest.uihelper.common import select_pos
14 #Bug 109083 - Updating table style: changes didn't propagate to other tables when selection was over two columns at the moment of updating
15 class tdf109083(UITestCase):
16 def test_tdf109083(self):
17 with self.ui_test.create_doc_in_start_center("writer"):
18 xWriterDoc = self.xUITest.getTopFocusWindow()
19 xWriterEdit = xWriterDoc.getChild("writer_edit")
20 #generate two 2x2 tables with the same autoformat table style (Default Table Style)
21 #Note that this style is different than applying nothing!
22 for i in range(0, 2):
23 with self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog:
24 formatlbinstable = xDialog.getChild("formatlbinstable")
25 entry = formatlbinstable.getChild("1")
26 entry.executeAction("SELECT", tuple())
27 xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
29 #select the last row of the first table
30 for i in range (0,2):
31 self.xUITest.executeCommand(".uno:GoDown")
32 for i in range (0,2):
33 self.xUITest.executeCommand(".uno:CharRightSel")
34 #set a specific color on the selected cells (last row)
35 self.xUITest.executeCommandWithParameters(".uno:TableCellBackgroundColor", mkPropertyValues({"TableCellBackgroundColor" : 16776960 }))
37 #Sidebar -> Table Styles -> Style Actions -> "Update Selected Style" (note: the row is still selected)
38 self.xUITest.executeCommand(".uno:Sidebar")
39 xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "StyleListPanel"}))
40 xLeft = xWriterEdit.getChild('left')
41 xLeft.executeAction("CLICK", mkPropertyValues({"POS": "5"}))
42 xRight = xWriterEdit.getChild('right')
43 xRight.executeAction("CLICK", mkPropertyValues({"POS": "3"}))
44 #select the second table
45 for i in range (0,2):
46 self.xUITest.executeCommand(".uno:GoDown")
48 #first row's cells must be yellow, second/last row's cells must be updated to yellow by now
49 for i in range (0,4):
50 with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog:
51 xTabs = xDialog.getChild("tabcontrol")
52 select_pos(xTabs, "4") #tab Background
53 btncolor = xDialog.getChild("btncolor")
54 btncolor.executeAction("CLICK", tuple())
55 hex_custom = xDialog.getChild("hex_custom")
56 if i >= 2:
57 self.assertEqual(get_state_as_dict(hex_custom)["Text"], "ffff00")
58 else:
59 self.assertEqual(get_state_as_dict(hex_custom)["Text"], "ffffff")
60 self.xUITest.executeCommand(".uno:GoRight")
62 # vim: set shiftwidth=4 softtabstop=4 expandtab: