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_cell_by_position
12 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
13 from uitest
.debug
import sleep
14 #Bug 79983 - Calc sort lists aren't case sensitive
16 class tdf79983(UITestCase
):
17 def test_tdf79983_sort_list_case_sensitive(self
):
18 calc_doc
= self
.ui_test
.create_doc_in_start_center("calc")
19 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
20 gridwin
= xCalcDoc
.getChild("grid_window")
21 document
= self
.ui_test
.get_component()
23 enter_text_to_cell(gridwin
, "A1", "AAA")
24 enter_text_to_cell(gridwin
, "A2", "BBB")
25 enter_text_to_cell(gridwin
, "A3", "CCC")
26 enter_text_to_cell(gridwin
, "A4", "DDD")
27 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
29 #Tools / Options / LibreOffice Calc / Sort Lists
30 self
.ui_test
.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
31 xDialogOpt
= self
.xUITest
.getTopFocusWindow()
33 xPages
= xDialogOpt
.getChild("pages")
34 xCalcEntry
= xPages
.getChild('3') # Calc
35 xCalcEntry
.executeAction("EXPAND", tuple())
36 xCalcSortEntry
= xCalcEntry
.getChild('5')
37 xCalcSortEntry
.executeAction("SELECT", tuple()) #Sort List
38 #copy new list from selected cells
39 xcopy
= xDialogOpt
.getChild("copy")
40 xcopy
.executeAction("CLICK", tuple())
41 xOKBtn
= xDialogOpt
.getChild("ok")
42 self
.ui_test
.close_dialog_through_button(xOKBtn
)
44 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
45 gridwin
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"}))
47 enter_text_to_cell(gridwin
, "A1", "AAA")
48 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
50 self
.ui_test
.execute_dialog_through_command(".uno:FillSeries")
51 xDialog
= self
.xUITest
.getTopFocusWindow()
52 xautofill
= xDialog
.getChild("autofill")
53 xautofill
.executeAction("CLICK", tuple())
54 xOK
= xDialog
.getChild("ok")
55 self
.ui_test
.close_dialog_through_button(xOK
)
57 self
.assertEqual(get_cell_by_position(document
, 0, 0, 0).getString(), "AAA")
58 self
.assertEqual(get_cell_by_position(document
, 0, 0, 1).getString(), "BBB")
59 self
.assertEqual(get_cell_by_position(document
, 0, 0, 2).getString(), "CCC")
60 self
.assertEqual(get_cell_by_position(document
, 0, 0, 3).getString(), "DDD")
62 self
.xUITest
.executeCommand(".uno:Undo")
64 self
.assertEqual(get_cell_by_position(document
, 0, 0, 0).getString(), "AAA")
65 self
.assertEqual(get_cell_by_position(document
, 0, 0, 1).getString(), "")
66 self
.assertEqual(get_cell_by_position(document
, 0, 0, 2).getString(), "")
67 self
.assertEqual(get_cell_by_position(document
, 0, 0, 3).getString(), "")
69 self
.ui_test
.close_doc()
71 # vim: set shiftwidth=4 softtabstop=4 expandtab: