Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / cui / qa / uitest / tabpages / tpcolor.py
blob820ffa634eb15e9a0302887e58c6c2fb4fe20518
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 from libreoffice.uno.propertyvalue import mkPropertyValues
8 from uitest.framework import UITestCase
9 from uitest.uihelper.common import select_pos
10 from uitest.uihelper.common import select_by_text
13 # Test for cui/source/tabpages/tpcolor.cxx.
14 class Test(UITestCase):
16 def testSvxColorTabPageTheme(self):
17 # Given an Impress document with a theme:
18 with self.ui_test.create_doc_in_start_center("impress") as component:
19 template = self.xUITest.getTopFocusWindow()
20 self.ui_test.close_dialog_through_button(template.getChild("close"))
21 doc = self.xUITest.getTopFocusWindow()
22 editWin = doc.getChild("impress_win")
23 # Set theme colors.
24 drawPage = component.getDrawPages().getByIndex(0)
25 master = drawPage.MasterPage
26 theme = mkPropertyValues({
27 "Name": "nameA",
28 "ColorSchemeName": "colorSetA",
29 "ColorScheme": tuple([
30 0x000000, # dk1
31 0x000000, # lt1
32 0x000000, # dk2
33 0x000000, # lt2
34 0x0000ff, # accent1
35 0x000000, # accent2
36 0x000000, # accent3
37 0x000000, # accent4
38 0x000000, # accent5
39 0x000000, # accent6
40 0x000000, # hlink
41 0x000000, # folHlink
44 master.ThemeUnoRepresentation = theme
45 # Select the title shape.
46 editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
48 # When using right click -> Area to refer to a theme for shape fill:
49 with self.ui_test.execute_dialog_through_command(".uno:FormatArea") as xDialog:
50 tabControl = xDialog.getChild("tabcontrol")
51 # Area
52 select_pos(tabControl, "0")
53 # Color
54 btnColor = xDialog.getChild("btncolor")
55 btnColor.executeAction("CLICK", tuple())
56 paletteSelector = xDialog.getChild("paletteselector")
57 select_by_text(paletteSelector, "Theme colors")
58 colorSelector = xDialog.getChild("colorset")
59 colorSelector.executeAction("CHOOSE", mkPropertyValues({"POS": "4"}))
61 # Then make sure the doc model is updated accordingly:
62 shape = drawPage.getByIndex(0)
63 # Without the accompanying fix in place, this test would have failed with:
64 # AssertionError: -1 != 3
65 # i.e. the theme metadata of the selected fill color was lost.
66 self.assertEqual(shape.FillColorTheme, 3)
69 # vim: set shiftwidth=4 softtabstop=4 expandtab: