Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / qa / uitest / calc_tests9 / tdf113571.py
blob0dc337ca64c672dcf9114752b3f3c0030465b297
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/.
10 from uitest.framework import UITestCase
11 from uitest.uihelper.common import get_url_for_data_file
12 from libreoffice.uno.propertyvalue import mkPropertyValues
14 class Tdf113571(UITestCase):
16 def test_tdf113571(self):
17 with self.ui_test.load_file(get_url_for_data_file("tdf113571.ods")):
19 xCalcDoc = self.xUITest.getTopFocusWindow()
20 gridwin = xCalcDoc.getChild("grid_window")
22 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
24 self.xUITest.executeCommand(".uno:Copy")
26 with self.ui_test.load_empty_file("writer") as writer_document:
28 self.xUITest.getTopFocusWindow()
30 self.xUITest.executeCommand(".uno:PasteUnformatted")
32 # Without the fix in place, this test would have failed with
33 # AssertionError: '<?xml version="1.0" encoding="UTF-8"?>\n<[34 chars]est>' !=
34 # '"<?xml version=""1.0"" encoding=""UTF-8""[40 chars]st>"'
35 self.assertEqual('<?xml version="1.0" encoding="UTF-8"?>\n<test>\n <hello>world</hello>\n</test>',
36 writer_document.Text.String)
38 # vim: set shiftwidth=4 softtabstop=4 expandtab: