| 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 |
|
| 14 |
class tdf135938(UITestCase): |
| 15 |
|
| 16 |
def test_tdf135938_cross_reference_update(self): |
| 17 |
with self.ui_test.create_doc_in_start_center("writer"): |
| 18 |
with self.ui_test.execute_modeless_dialog_through_command(".uno:InsertReferenceField", close_button="cancel") as xDialog: |
| 19 |
|
| 20 |
xTreelistType = xDialog.getChild("type-ref") |
| 21 |
xTreeEntry = xTreelistType.getChild('0') |
| 22 |
self.assertEqual(get_state_as_dict(xTreeEntry)["Text"], "Set Reference") |
| 23 |
xTreeEntry.executeAction("SELECT", tuple()) |
| 24 |
|
| 25 |
|
| 26 |
xName = xDialog.getChild("name-ref") |
| 27 |
xName.executeAction("TYPE", mkPropertyValues({"TEXT": "ABC"})) |
| 28 |
xInsert = xDialog.getChild("ok") |
| 29 |
xInsert.executeAction("CLICK", tuple()) |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') |
| 36 |
xToolkit.waitUntilAllIdlesDispatched() |
| 37 |
|
| 38 |
xSelect = xDialog.getChild("select-ref") |
| 39 |
self.assertEqual("1", get_state_as_dict(xSelect)["Children"]) |
| 40 |
self.assertEqual("ABC", get_state_as_dict(xSelect.getChild(0))["Text"]) |
| 41 |
|
| 42 |
xName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) |
| 43 |
xName.executeAction("TYPE", mkPropertyValues({"TEXT": "DEF"})) |
| 44 |
xInsert.executeAction("CLICK", tuple()) |
| 45 |
|
| 46 |
self.assertEqual("2", get_state_as_dict(xSelect)["Children"]) |
| 47 |
self.assertEqual("ABC", get_state_as_dict(xSelect.getChild(0))["Text"]) |
| 48 |
self.assertEqual("DEF", get_state_as_dict(xSelect.getChild(1))["Text"]) |
| 49 |
|
| 50 |
|
| 51 |
xFilter = None |
| 52 |
for childIx in range(len(xTreelistType.getChildren())): |
| 53 |
xTreeEntry = xTreelistType.getChild(childIx) |
| 54 |
if get_state_as_dict(xTreeEntry)["Text"] == "Insert Reference": |
| 55 |
xTreeEntry.executeAction("SELECT", tuple()) |
| 56 |
|
| 57 |
xFilter = xDialog.getChild("filter") |
| 58 |
xFilter.executeAction("TYPE", mkPropertyValues({"TEXT": "A"})) |
| 59 |
|
| 60 |
|
| 61 |
self.assertEqual(get_state_as_dict(xName)["Text"], "ABC") |
| 62 |
|
| 63 |
self.assertEqual("1", get_state_as_dict(xSelect)["Children"]) |
| 64 |
break |
| 65 |
|
| 66 |
|
| 67 |
self.assertFalse(xFilter is None) |
| 68 |
|
| 69 |
|