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 uitest
.uihelper
.calc
import enter_text_to_cell
11 from libreoffice
.calc
.document
import get_sheet_from_doc
12 from libreoffice
.calc
.conditional_format
import get_conditional_format_from_sheet
13 from uitest
.debug
import sleep
14 from libreoffice
.calc
.document
import get_cell_by_position
15 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
17 #Bug 123122 - Invoking the number format dialog the format code field is blank for a user-defined date+time format.
19 class tdf123122(UITestCase
):
20 def test_tdf123122_format_cell_datetime(self
):
21 #numberingformatpage.ui
22 calc_doc
= self
.ui_test
.create_doc_in_start_center("calc")
23 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
24 gridwin
= xCalcDoc
.getChild("grid_window")
25 document
= self
.ui_test
.get_component()
27 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
29 self
.ui_test
.execute_dialog_through_command(".uno:FormatCellDialog")
30 xDialog
= self
.xUITest
.getTopFocusWindow()
31 xTabs
= xDialog
.getChild("tabcontrol")
32 select_pos(xTabs
, "0") #tab Numbers
33 xliststore1
= xDialog
.getChild("categorylb") #1st list / Category
34 xliststore2
= xDialog
.getChild("formatlb") #2nd list / Format
35 xdecimalsed
= xDialog
.getChild("decimalsed")
36 xleadzerosed
= xDialog
.getChild("leadzerosed")
37 xnegnumred
= xDialog
.getChild("negnumred")
38 xthousands
= xDialog
.getChild("thousands")
39 xlanguagelb
= xDialog
.getChild("languagelb")
40 xformatted
= xDialog
.getChild("formatted")
42 #Format cells and enter NN MMM DD YYYY HH:MM as format code
43 xformatted
.executeAction("CLEAR", tuple()) #clear textbox
44 xformatted
.executeAction("TYPE", mkPropertyValues({"TEXT":"NN MMM DD YYYY HH:MM"}))
46 xOk
= xDialog
.getChild("ok")
47 self
.ui_test
.close_dialog_through_button(xOk
)
50 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
52 self
.ui_test
.execute_dialog_through_command(".uno:FormatCellDialog")
53 xDialog
= self
.xUITest
.getTopFocusWindow()
54 xTabs
= xDialog
.getChild("tabcontrol")
55 select_pos(xTabs
, "0") #tab Numbers
56 xliststore1
= xDialog
.getChild("categorylb") #1st list / Category
57 xliststore2
= xDialog
.getChild("formatlb") #2nd list / Format
58 xdecimalsed
= xDialog
.getChild("decimalsed")
59 xleadzerosed
= xDialog
.getChild("leadzerosed")
60 xnegnumred
= xDialog
.getChild("negnumred")
61 xthousands
= xDialog
.getChild("thousands")
62 xlanguagelb
= xDialog
.getChild("languagelb")
63 xformatted
= xDialog
.getChild("formatted")
66 self
.assertEqual(get_state_as_dict(xliststore1
)["SelectEntryText"], "Date")
67 self
.assertEqual(get_state_as_dict(xformatted
)["Text"], "NN MMM DD YYYY HH:MM")
68 xOk
= xDialog
.getChild("ok")
69 self
.ui_test
.close_dialog_through_button(xOk
)
71 self
.ui_test
.close_doc()
72 # vim: set shiftwidth=4 softtabstop=4 expandtab: