Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / qa / uitest / calc_tests4 / tdf141547.py
blob2cccba3321673a0ae825310412bcdc53c33b1420
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 tdf141547(UITestCase):
16 def test_tdf141547(self):
18 with self.ui_test.load_file(get_url_for_data_file("tdf141547.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 for i in range(1, 7):
25 self.assertTrue(is_row_hidden(calc_doc, i))
27 # Without the fix in place, this test would have crashed here
28 with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog:
29 self.assertEqual("0", get_state_as_dict(xDialog.getChild("val1"))['Text'])
30 self.assertEqual("过帐日期", get_state_as_dict(xDialog.getChild("field1"))["DisplayText"])
31 self.assertEqual("Empty", get_state_as_dict(xDialog.getChild("val2"))['Text'])
32 self.assertEqual("过帐日期", get_state_as_dict(xDialog.getChild("field2"))["DisplayText"])
35 self.assertFalse(is_row_hidden(calc_doc, 0))
36 for i in range(1, 7):
37 self.assertTrue(is_row_hidden(calc_doc, i))
39 # vim: set shiftwidth=4 softtabstop=4 expandtab: