| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 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 |
| 14 |
|
| 15 |
class Tdf138531(UITestCase): |
| 16 |
|
| 17 |
def test_tdf138531(self): |
| 18 |
|
| 19 |
with self.ui_test.create_doc_in_start_center("calc"): |
| 20 |
xCalcDoc = self.xUITest.getTopFocusWindow() |
| 21 |
gridwin = xCalcDoc.getChild("grid_window") |
| 22 |
|
| 23 |
enter_text_to_cell(gridwin, "A1", "First") |
| 24 |
enter_text_to_cell(gridwin, "A2", "Second") |
| 25 |
|
| 26 |
|
| 27 |
gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) |
| 28 |
|
| 29 |
self.xUITest.executeCommand(".uno:Copy") |
| 30 |
|
| 31 |
|
| 32 |
with self.ui_test.load_empty_file("writer") as writer_doc: |
| 33 |
|
| 34 |
|
| 35 |
formatProperty = mkPropertyValues({"SelectedFormat": 59}) |
| 36 |
self.xUITest.executeCommandWithParameters(".uno:ClipboardFormatItems", formatProperty) |
| 37 |
|
| 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()) |
| 42 |
|
| 43 |
frames = self.ui_test.get_frames() |
| 44 |
|
| 45 |
frames[0].activate() |
| 46 |
enter_text_to_cell(gridwin, "A1", "Second") |
| 47 |
enter_text_to_cell(gridwin, "A2", "First") |
| 48 |
|
| 49 |
|
| 50 |
frames[1].activate() |
| 51 |
|
| 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())) |
| 55 |
|
| 56 |
xFileName = xDialog.getChild("FULL_FILE_NAME") |
| 57 |
self.assertEqual("Untitled 1", get_state_as_dict(xFileName)["Text"]) |
| 58 |
|
| 59 |
xUpdate = xDialog.getChild("UPDATE_NOW") |
| 60 |
xUpdate.executeAction("CLICK", tuple()) |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
self.assertEqual("Second", table.getCellByName("A1").getString()) |
| 65 |
self.assertEqual("First", table.getCellByName("A2").getString()) |
| 66 |
|
| 67 |
|