Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / qa / uitest / pasteSpecial / tdf114710.py
blobcb6fb3654a3a284541f7905f39ca291419bf93a6
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
13 class tdf114710(UITestCase):
15 def test_tdf114710(self):
16 with self.ui_test.load_file(get_url_for_data_file("tdf114710.ods")):
17 xCalcDoc = self.xUITest.getTopFocusWindow()
18 gridwin = xCalcDoc.getChild("grid_window")
20 gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:O7"}))
21 self.xUITest.executeCommand(".uno:Copy")
23 with self.ui_test.load_empty_file("writer") as writer_document:
25 self.xUITest.getTopFocusWindow()
27 with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog:
29 xList = xDialog.getChild('list')
31 for childName in xList.getChildren():
32 xChild = xList.getChild(childName)
33 if get_state_as_dict(xChild)['Text'] == "Graphics Device Interface metafile (GDI)":
34 break
36 xChild.executeAction("SELECT", tuple())
37 self.assertEqual(
38 get_state_as_dict(xList)['SelectEntryText'], "Graphics Device Interface metafile (GDI)")
41 # Without the fix in place, this test would have crashed here
42 self.assertEqual(1, writer_document.GraphicObjects.getCount())
44 # vim: set shiftwidth=4 softtabstop=4 expandtab: