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
, select_by_text
11 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 from libreoffice
.calc
.document
import get_cell_by_position
13 from libreoffice
.calc
.csv_dialog
import load_csv_file
15 class Tdf92503(UITestCase
):
17 def test_tdf92503(self
):
18 with
load_csv_file(self
, "tdf92503.csv", True) as xDialog
:
19 xFixedWidth
= xDialog
.getChild("tofixedwidth")
20 xGrid
= xDialog
.getChild("csvgrid")
21 xColumnType
= xDialog
.getChild("columntype")
23 xFixedWidth
.executeAction("CLICK", tuple())
24 self
.assertEqual('true', get_state_as_dict(xFixedWidth
)['Checked'])
26 # Use the right arrow to put the focus in the grid
27 xGrid
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RIGHT"}))
29 self
.assertEqual('true', get_state_as_dict(xColumnType
)['Enabled'])
31 select_by_text(xColumnType
, "Date (DMY)")
33 self
.assertEqual('Date (DMY)', get_state_as_dict(xColumnType
)['SelectEntryText'])
35 document
= self
.ui_test
.get_component()
37 self
.assertEqual("03/31/13 01:00 AM", get_cell_by_position(document
, 0, 0, 0).getString())
39 # Without the fix in place, this test would have failed with
40 # AssertionError: '03/31/13 02:00 AM' != '31 Mar 2013, 02:00'
41 self
.assertEqual("03/31/13 02:00 AM", get_cell_by_position(document
, 0, 0, 1).getString())
42 self
.assertEqual("03/31/13 03:00 AM", get_cell_by_position(document
, 0, 0, 2).getString())
43 self
.assertEqual("03/30/14 01:00 AM", get_cell_by_position(document
, 0, 0, 3).getString())
44 self
.assertEqual("03/30/14 02:00 AM", get_cell_by_position(document
, 0, 0, 4).getString())
45 self
.assertEqual("03/30/14 03:00 AM", get_cell_by_position(document
, 0, 0, 5).getString())
46 self
.assertEqual("03/29/15 01:00 AM", get_cell_by_position(document
, 0, 0, 6).getString())
47 self
.assertEqual("03/29/15 02:00 AM", get_cell_by_position(document
, 0, 0, 7).getString())
48 self
.assertEqual("03/29/15 03:00 AM", get_cell_by_position(document
, 0, 0, 8).getString())
50 self
.ui_test
.close_doc()
52 # vim: set shiftwidth=4 softtabstop=4 expandtab: