tdf#160621 Variable field dialog size of value field
[LibreOffice.git] / sw / qa / uitest / writer_tests5 / tdf138531.py
blobf4c4ae2994e78d6cfa770c499c41125273361901
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_state_as_dict
12 from libreoffice.uno.propertyvalue import mkPropertyValues
13 from uitest.uihelper.calc import enter_text_to_cell
15 class Tdf138531(UITestCase):
17 def test_tdf138531(self):
19 with self.ui_test.create_doc_in_start_center("calc"):
20 xCalcDoc = self.xUITest.getTopFocusWindow()
21 gridwin = xCalcDoc.getChild("grid_window")
22 #enter data
23 enter_text_to_cell(gridwin, "A1", "First")
24 enter_text_to_cell(gridwin, "A2", "Second")
26 #select A1:A2
27 gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"}))
29 self.xUITest.executeCommand(".uno:Copy")
31 # Work with both documents at the same time
32 with self.ui_test.load_empty_file("writer") as writer_doc:
34 # Paste as DDE
35 formatProperty = mkPropertyValues({"SelectedFormat": 59})
36 self.xUITest.executeCommandWithParameters(".uno:ClipboardFormatItems", formatProperty)
38 self.assertEqual(1, len(writer_doc.TextTables))
39 table = writer_doc.getTextTables()[0]
40 self.assertEqual("First", table.getCellByName("A1").getString())
41 self.assertEqual("Second", table.getCellByName("A2").getString())
43 frames = self.ui_test.get_frames()
44 # switch view to the calc document
45 frames[0].activate()
46 enter_text_to_cell(gridwin, "A1", "Second")
47 enter_text_to_cell(gridwin, "A2", "First")
49 # switch view back to the writer document
50 frames[1].activate()
52 with self.ui_test.execute_dialog_through_command(".uno:LinkDialog", close_button="close") as xDialog:
53 xLinks = xDialog.getChild("TB_LINKS")
54 self.assertEqual(1, len(xLinks.getChildren()))
56 xFileName = xDialog.getChild("FULL_FILE_NAME")
57 self.assertEqual("Untitled 1", get_state_as_dict(xFileName)["Text"])
59 xUpdate = xDialog.getChild("UPDATE_NOW")
60 xUpdate.executeAction("CLICK", tuple())
62 # Without the fix in place, this test would have failed with
63 # AssertionError: 'Second' != 'First'
64 self.assertEqual("Second", table.getCellByName("A1").getString())
65 self.assertEqual("First", table.getCellByName("A2").getString())
67 # vim: set shiftwidth=4 softtabstop=4 expandtab: