1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 from uitest
.framework
import UITestCase
8 from uitest
.uihelper
.common
import get_state_as_dict
9 from uitest
.uihelper
.common
import select_pos
10 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
11 #Bug 152722 - NatNum12 number format (spell out): add/delete decimal places is losing format
13 class tdf152722(UITestCase
):
14 def test_tdf152722_NatNum_modifier_decimal_value(self
):
15 #numberingformatpage.ui
16 with self
.ui_test
.create_doc_in_start_center("calc"):
18 with self
.ui_test
.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog
:
19 xTabs
= xDialog
.getChild("tabcontrol")
20 select_pos(xTabs
, "0") #tab Numbers
21 xdecimalsed
= xDialog
.getChild( "decimalsed" )
22 xleadzerosed
= xDialog
.getChild( "leadzerosed" )
23 xnegnumred
= xDialog
.getChild( "negnumred" )
24 xthousands
= xDialog
.getChild( "thousands" )
25 xformatted
= xDialog
.getChild( "formatted" )
27 xformatted
.executeAction( "CLEAR", tuple() ) #clear textbox
28 xformatted
.executeAction( "TYPE", mkPropertyValues({"TEXT":"[NatNum12 cardinal]0"}) )
29 xdecimalsed
.executeAction( "UP", tuple() )
30 self
.assertEqual( get_state_as_dict(xformatted
)["Text"], "[NatNum12 cardinal]0.0" )
31 xnegnumred
.executeAction( "CLICK", tuple() )
32 self
.assertEqual( get_state_as_dict(xformatted
)["Text"], "[NatNum12 cardinal]0.0;[RED][NatNum12 cardinal]-0.0" )
33 #Bug 153023: disable Thousand separator for NatNum12 modifier
34 self
.assertEqual(get_state_as_dict(xthousands
)["Enabled"], "false")
35 #Leading zeroes can be 0 or 1
36 self
.assertEqual(get_state_as_dict(xleadzerosed
)["Enabled"], "true")
38 # vim: set shiftwidth=4 softtabstop=4 expandtab: