Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / qa / uitest / calc_tests4 / tdf138089.py
blob7ea3afd09edeb350bae37d1a4978128bc5fdf14f
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, get_url_for_data_file
11 from libreoffice.uno.propertyvalue import mkPropertyValues
12 from libreoffice.calc.document import is_row_hidden
14 class tdf138089(UITestCase):
16 def test_tdf138089(self):
18 with self.ui_test.load_file(get_url_for_data_file("tdf138089.xlsx")) as calc_doc:
19 xCalcDoc = self.xUITest.getTopFocusWindow()
20 gridwin = xCalcDoc.getChild("grid_window")
21 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
23 self.assertFalse(is_row_hidden(calc_doc, 0))
24 self.assertTrue(is_row_hidden(calc_doc, 1))
25 self.assertTrue(is_row_hidden(calc_doc, 2))
26 self.assertTrue(is_row_hidden(calc_doc, 3))
27 self.assertFalse(is_row_hidden(calc_doc, 4))
28 self.assertFalse(is_row_hidden(calc_doc, 5))
29 self.assertFalse(is_row_hidden(calc_doc, 6))
31 # Without the fix in place, this test would have crashed here
32 with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog:
33 self.assertEqual("2017-12-01", get_state_as_dict(xDialog.getChild("val1"))['Text'])
34 self.assertEqual("过帐日期", get_state_as_dict(xDialog.getChild("field1"))["DisplayText"])
37 self.assertFalse(is_row_hidden(calc_doc, 0))
38 self.assertTrue(is_row_hidden(calc_doc, 1))
39 self.assertTrue(is_row_hidden(calc_doc, 2))
40 self.assertTrue(is_row_hidden(calc_doc, 3))
41 self.assertFalse(is_row_hidden(calc_doc, 4))
42 self.assertFalse(is_row_hidden(calc_doc, 5))
43 self.assertTrue(is_row_hidden(calc_doc, 6))
45 # vim: set shiftwidth=4 softtabstop=4 expandtab: