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
13 # Bug 122977 - CRASH: "Tools"->"Options" "LibreOfficeDev"->"Charts"->"Default Colors"
14 class chartDefaultColors(UITestCase
):
15 def test_tdf122977_crash_chart_default_colors_options(self
):
16 with self
.ui_test
.create_doc_in_start_center("calc"):
17 #Go to Tools -> Options -> Charts -> Default Colors
18 with self
.ui_test
.execute_dialog_through_command(".uno:OptionsTreeDialog", close_button
="cancel") as xDialogOpt
:
20 xPages
= xDialogOpt
.getChild("pages")
21 xChartEntry
= xPages
.getChild('5') # Charts
22 xChartEntry
.executeAction("EXPAND", tuple())
23 xChartGeneralEntry
= xChartEntry
.getChild('0')
24 xChartGeneralEntry
.executeAction("SELECT", tuple()) #Default Colors
25 xColors
= xDialogOpt
.getChild("colors")
26 xAdd
= xDialogOpt
.getChild("add")
27 xDelete
= xDialogOpt
.getChild("delete")
28 xDefault
= xDialogOpt
.getChild("default")
30 #click Default - reset
31 xDefault
.executeAction("CLICK", tuple())
32 nrDefaultColors
= get_state_as_dict(xColors
)["Children"]
33 nrDefaultColors1
= int(nrDefaultColors
) + 1
34 xAdd
.executeAction("CLICK", tuple()) #add new color
35 self
.assertEqual(get_state_as_dict(xColors
)["Children"], str(nrDefaultColors1
))
38 with self
.ui_test
.execute_blocking_action(xDelete
.executeAction
, args
=('CLICK', ()), close_button
="yes"):
41 self
.assertEqual(get_state_as_dict(xColors
)["Children"], nrDefaultColors
)
43 xAdd
.executeAction("CLICK", tuple()) #add new color
44 self
.assertEqual(get_state_as_dict(xColors
)["Children"], str(nrDefaultColors1
))
46 xDefault
.executeAction("CLICK", tuple())
47 self
.assertEqual(get_state_as_dict(xColors
)["Children"], nrDefaultColors
)
51 # vim: set shiftwidth=4 softtabstop=4 expandtab: