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
, get_url_for_data_file
11 from uitest
.uihelper
.common
import select_pos
12 from libreoffice
.calc
.document
import get_cell_by_position
13 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
15 #Bug 122509 - EDITING Calc crashes when manipulating Negative numbers in red on Currency ( not gtk3 )
17 class tdf122509(UITestCase
):
18 def test_tdf122509_format_cell_negative_numbers(self
):
19 #numberingformatpage.ui
20 with self
.ui_test
.load_file(get_url_for_data_file("tdf122509.ods")) as calc_doc
:
21 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
22 gridwin
= xCalcDoc
.getChild("grid_window")
24 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
26 with self
.ui_test
.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog
:
27 xTabs
= xDialog
.getChild("tabcontrol")
28 select_pos(xTabs
, "0") #tab Numbers
29 xnegnumred
= xDialog
.getChild("negnumred")
30 xformatted
= xDialog
.getChild("formatted")
32 self
.assertEqual(get_state_as_dict(xformatted
)["Text"], "#,##0.00 [$USD];[RED]-#,##0.00 [$USD]")
34 xnegnumred
.executeAction("CLICK", tuple())
35 #format check; https://bugs.documentfoundation.org/show_bug.cgi?id=122509#c7
36 self
.assertEqual(get_state_as_dict(xformatted
)["Text"], "#,##0.00 [$USD];-#,##0.00 [$USD]")
38 xnegnumred
.executeAction("CLICK", tuple())
41 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 0).getValue(), 2)
43 # vim: set shiftwidth=4 softtabstop=4 expandtab: