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
11 from uitest
.uihelper
.common
import select_pos
12 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
14 #Bug 123122 - Invoking the number format dialog the format code field is blank for a user-defined date+time format.
16 class tdf123122(UITestCase
):
17 def test_tdf123122_format_cell_datetime(self
):
18 #numberingformatpage.ui
19 with self
.ui_test
.create_doc_in_start_center("calc"):
20 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
21 gridwin
= xCalcDoc
.getChild("grid_window")
23 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
25 with self
.ui_test
.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog
:
26 xTabs
= xDialog
.getChild("tabcontrol")
27 select_pos(xTabs
, "0") #tab Numbers
28 xformatted
= xDialog
.getChild("formatted")
30 #Format cells and enter NN MMM DD YYYY HH:MM as format code
31 xformatted
.executeAction("CLEAR", tuple()) #clear textbox
32 xformatted
.executeAction("TYPE", mkPropertyValues({"TEXT":"NN MMM DD YYYY HH:MM"}))
36 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
38 with self
.ui_test
.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog
:
39 xTabs
= xDialog
.getChild("tabcontrol")
40 select_pos(xTabs
, "0") #tab Numbers
41 xliststore1
= xDialog
.getChild("categorylb") #1st list / Category
42 xformatted
= xDialog
.getChild("formatted")
45 self
.assertEqual(get_state_as_dict(xliststore1
)["SelectEntryText"], "Date")
46 self
.assertEqual(get_state_as_dict(xformatted
)["Text"], "NN MMM DD YYYY HH:MM")
48 # vim: set shiftwidth=4 softtabstop=4 expandtab: