Apply open document shortcuts to the tree that has focus (#945)

* Better handling of Enter/Return on GUI trees, resolves #913
* Update test
* Generalise open selected handle functions
* Improve test coverage
* Update docstring
This commit is contained in:
Veronica Berglyd Olsen
2021-12-31 19:51:26 +01:00
committed by GitHub
parent 7024254960
commit b0f939af32
7 changed files with 188 additions and 74 deletions
+23
View File
@@ -77,6 +77,10 @@ def testGuiOutline_Main(qtbot, monkeypatch, nwGUI, nwLipsum):
selItem = chpItem.child(0)
nwGUI.projView.setCurrentItem(selItem)
tHandle, tLine = nwGUI.projView.getSelectedHandle()
assert tHandle == "88243afbe5ed8"
assert tLine == 0
assert nwGUI.projMeta.titleLabel.text() == "<b>Scene</b>"
assert nwGUI.projMeta.titleValue.text() == "Scene One"
assert nwGUI.projMeta.fileValue.text() == "Scene One"
@@ -87,6 +91,25 @@ def testGuiOutline_Main(qtbot, monkeypatch, nwGUI, nwLipsum):
nwGUI.projMeta._tagClicked("#pov=Bod")
assert nwGUI.docViewer.docHandle() == "4c4f28287af27"
# Scene One, Section Two
actItem = nwGUI.projView.topLevelItem(1)
chpItem = actItem.child(0)
scnItem = chpItem.child(0)
selItem = scnItem.child(0)
nwGUI.projView.setCurrentItem(selItem)
tHandle, tLine = nwGUI.projView.getSelectedHandle()
assert tHandle == "88243afbe5ed8"
assert tLine == 12
assert nwGUI.projMeta.titleLabel.text() == "<b>Section</b>"
assert nwGUI.projMeta.titleValue.text() == "Scene One, Section Two"
assert nwGUI.projMeta.fileValue.text() == "Scene One"
assert nwGUI.projMeta.itemValue.text() == "Finished"
nwGUI.projView._treeDoubleClick(selItem, 0)
assert nwGUI.docEditor.docHandle() == "88243afbe5ed8"
# qtbot.stopForInteraction()
# END Test testGuiOutline_Main