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 import org
.libreoffice
.unotest
16 #Bug 123052 - [regression] Shift+Tab not working
17 def get_url_for_data_file(file_name
):
18 return pathlib
.Path(org
.libreoffice
.unotest
.makeCopyFromTDOC(file_name
)).as_uri()
20 class tdf123052(UITestCase
):
21 def test_tdf123052_shit_tab(self
):
22 calc_doc
= self
.ui_test
.load_file(get_url_for_data_file("tdf123052.ods"))
23 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
24 gridwin
= xCalcDoc
.getChild("grid_window")
25 document
= self
.ui_test
.get_component()
26 #Holding the Shift key and repeated pressing the Tab key does not correctly cycle though the unprotected cells
27 #I'm at 7, hold TAB for cycling
28 gridwin
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
29 # Assert that the correct cell has been selected
30 gridWinState
= get_state_as_dict(gridwin
)
31 self
.assertEqual(gridWinState
["CurrentRow"], "2")
32 self
.assertEqual(gridWinState
["CurrentColumn"], "5")
34 gridwin
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
35 # Assert that the correct cell has been selected
36 gridWinState
= get_state_as_dict(gridwin
)
37 self
.assertEqual(gridWinState
["CurrentRow"], "4")
38 self
.assertEqual(gridWinState
["CurrentColumn"], "3")
40 gridwin
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
41 # Assert that the correct cell has been selected
42 gridWinState
= get_state_as_dict(gridwin
)
43 self
.assertEqual(gridWinState
["CurrentRow"], "4")
44 self
.assertEqual(gridWinState
["CurrentColumn"], "4")
46 gridwin
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
47 # Assert that the correct cell has been selected
48 gridWinState
= get_state_as_dict(gridwin
)
49 self
.assertEqual(gridWinState
["CurrentRow"], "5")
50 self
.assertEqual(gridWinState
["CurrentColumn"], "5")
52 gridwin
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
53 # Assert that the correct cell has been selected
54 gridWinState
= get_state_as_dict(gridwin
)
55 self
.assertEqual(gridWinState
["CurrentRow"], "7")
56 self
.assertEqual(gridWinState
["CurrentColumn"], "0")
58 gridwin
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
59 # Assert that the correct cell has been selected
60 gridWinState
= get_state_as_dict(gridwin
)
61 self
.assertEqual(gridWinState
["CurrentRow"], "8")
62 self
.assertEqual(gridWinState
["CurrentColumn"], "4")
64 gridwin
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+TAB"}))
65 # Assert that the correct cell has been selected
66 gridWinState
= get_state_as_dict(gridwin
)
67 self
.assertEqual(gridWinState
["CurrentRow"], "7")
68 self
.assertEqual(gridWinState
["CurrentColumn"], "0")
70 self
.ui_test
.close_doc()
72 # vim: set shiftwidth=4 softtabstop=4 expandtab: