Fix bug from project tree test
This commit is contained in:
@@ -1455,7 +1455,6 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
wCount = self._getItemWordCount(sHandle)
|
wCount = self._getItemWordCount(sHandle)
|
||||||
self.propagateCount(sHandle, 0)
|
self.propagateCount(sHandle, 0)
|
||||||
|
|
||||||
event.accept()
|
|
||||||
super().dropEvent(event)
|
super().dropEvent(event)
|
||||||
self._postItemMove(sHandle, wCount)
|
self._postItemMove(sHandle, wCount)
|
||||||
self._recordLastMove(sItem, pItem, pIndex)
|
self._recordLastMove(sItem, pItem, pIndex)
|
||||||
|
|||||||
@@ -988,9 +988,17 @@ def testGuiProjTree_DragAndDrop(qtbot, monkeypatch, caplog, nwGUI: GuiMain, proj
|
|||||||
mouse = Qt.MouseButton.LeftButton
|
mouse = Qt.MouseButton.LeftButton
|
||||||
modifier = Qt.KeyboardModifier.NoModifier
|
modifier = Qt.KeyboardModifier.NoModifier
|
||||||
|
|
||||||
|
# Move an item
|
||||||
|
# The actual move is blocked, but the undo history should record
|
||||||
|
# the event, although without an actual move implied
|
||||||
|
assert projTree._lastMove == {}
|
||||||
event = QDropEvent(nPos, action, mime, mouse, modifier)
|
event = QDropEvent(nPos, action, mime, mouse, modifier)
|
||||||
projTree.dropEvent(event)
|
projTree.dropEvent(event)
|
||||||
assert event.isAccepted() is True
|
assert projTree._lastMove == {
|
||||||
|
"item": projTree._getTreeItem(C.hSceneDoc),
|
||||||
|
"parent": projTree._getTreeItem(C.hChapterDir),
|
||||||
|
"index": 1,
|
||||||
|
}
|
||||||
|
|
||||||
# Invalid location
|
# Invalid location
|
||||||
caplog.clear()
|
caplog.clear()
|
||||||
|
|||||||
Reference in New Issue
Block a user