| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 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 |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
class tdf122509(UITestCase): |
| 18 |
def test_tdf122509_format_cell_negative_numbers(self): |
| 19 |
|
| 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") |
| 23 |
|
| 24 |
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) |
| 25 |
|
| 26 |
with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: |
| 27 |
xTabs = xDialog.getChild("tabcontrol") |
| 28 |
select_pos(xTabs, "0") |
| 29 |
xnegnumred = xDialog.getChild("negnumred") |
| 30 |
xformatted = xDialog.getChild("formatted") |
| 31 |
|
| 32 |
self.assertEqual(get_state_as_dict(xformatted)["Text"], "#,##0.00 [$USD];[RED]-#,##0.00 [$USD]") |
| 33 |
|
| 34 |
xnegnumred.executeAction("CLICK", tuple()) |
| 35 |
|
| 36 |
self.assertEqual(get_state_as_dict(xformatted)["Text"], "#,##0.00 [$USD];-#,##0.00 [$USD]") |
| 37 |
|
| 38 |
xnegnumred.executeAction("CLICK", tuple()) |
| 39 |
|
| 40 |
|
| 41 |
self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getValue(), 2) |
| 42 |
|
| 43 |
|