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")
24 drawPage
= component
.getDrawPages().getByIndex(0)
25 master
= drawPage
.MasterPage
26 theme
= mkPropertyValues({
28 "ColorSchemeName": "colorSetA",
29 "ColorScheme": tuple([
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")
52 select_pos(tabControl
, "0")
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: