diff --git a/nw/gui/outlinedetails.py b/nw/gui/outlinedetails.py
index 9e53653f..6360a321 100644
--- a/nw/gui/outlinedetails.py
+++ b/nw/gui/outlinedetails.py
@@ -249,8 +249,8 @@ class GuiOutlineDetails(QScrollArea):
self.itemValue.setText(nwItem.itemStatus)
self.cCValue.setText("{:n}".format(checkInt(novIdx["cCount"], 0)))
- self.wCValue.setText("{:n}".format(checkInt(novIdx["pCount"], 0)))
- self.pCValue.setText("{:n}".format(checkInt(novIdx["wCount"], 0)))
+ self.wCValue.setText("{:n}".format(checkInt(novIdx["wCount"], 0)))
+ self.pCValue.setText("{:n}".format(checkInt(novIdx["pCount"], 0)))
self.synopValue.setText(novIdx["synopsis"])
diff --git a/tests/lipsum/nwProject.nwx b/tests/lipsum/nwProject.nwx
index ebfbde69..d6a58a7a 100644
--- a/tests/lipsum/nwProject.nwx
+++ b/tests/lipsum/nwProject.nwx
@@ -48,7 +48,7 @@
True
-
- Lorem Ipusm
+ Lorem Ipsum
FILE
NOVEL
Finished
diff --git a/tests/test_gui.py b/tests/test_gui.py
index d6ac126b..e512fbca 100644
--- a/tests/test_gui.py
+++ b/tests/test_gui.py
@@ -8,14 +8,17 @@ import json
from nwtools import cmpFiles
from os import path
-from PyQt5.QtCore import Qt
-from PyQt5.QtWidgets import QAction
+from PyQt5.QtCore import Qt, QPoint
+from PyQt5.QtWidgets import QAction, QDialogButtonBox, QTreeWidgetItem
from nw.gui import (
GuiProjectSettings, GuiItemEditor, GuiAbout, GuiBuildNovel,
- GuiDocMerge, GuiDocSplit, GuiWritingStats, GuiProjectWizard
+ GuiDocMerge, GuiDocSplit, GuiWritingStats, GuiProjectWizard,
+ GuiProjectLoad
+)
+from nw.constants import (
+ nwItemType, nwItemLayout, nwItemClass, nwDocAction, nwUnicode, nwOutline
)
-from nw.constants import nwItemType, nwItemLayout, nwItemClass, nwDocAction, nwUnicode
keyDelay = 2
stepDelay = 20
@@ -1064,3 +1067,109 @@ def testInsertMenu(qtbot, nwTempGUI, nwFuncTemp, nwTemp):
# qtbot.stopForInteraction()
nwGUI.closeMain()
+
+@pytest.mark.gui
+def testLoadProject(qtbot, nwTempGUI, nwTemp):
+ nwGUI = nw.main(["--testmode", "--config=%s" % nwTempGUI, "--data=%s" % nwTemp])
+ qtbot.addWidget(nwGUI)
+ nwGUI.show()
+ qtbot.waitForWindowShown(nwGUI)
+ qtbot.wait(stepDelay)
+
+ nwLoad = GuiProjectLoad(nwGUI)
+ nwLoad.show()
+
+ recentCount = nwLoad.listBox.topLevelItemCount()
+ assert recentCount > 1
+
+ selItem = nwLoad.listBox.topLevelItem(1)
+ selPath = selItem.data(nwLoad.C_NAME, Qt.UserRole)
+
+ nwLoad.selPath.setText("")
+ nwLoad.listBox.setCurrentItem(selItem)
+ assert nwLoad.selPath.text() == selPath
+
+ qtbot.mouseClick(nwLoad.buttonBox.button(QDialogButtonBox.Open), Qt.LeftButton)
+ assert nwLoad.openPath == selPath
+ assert nwLoad.openState == nwLoad.OPEN_STATE
+
+ del nwLoad
+ nwLoad = GuiProjectLoad(nwGUI)
+ nwLoad.show()
+
+ qtbot.mouseClick(nwLoad.buttonBox.button(QDialogButtonBox.Cancel), Qt.LeftButton)
+ assert nwLoad.openPath is None
+ assert nwLoad.openState == nwLoad.NONE_STATE
+
+ nwLoad.show()
+ qtbot.mouseClick(nwLoad.newButton, Qt.LeftButton)
+ assert nwLoad.openPath is None
+ assert nwLoad.openState == nwLoad.NEW_STATE
+
+ nwLoad.show()
+ nwLoad._keyPressDelete()
+ assert nwLoad.listBox.topLevelItemCount() == recentCount - 1
+
+ nwLoad.close()
+ # qtbot.stopForInteraction()
+ nwGUI.closeMain()
+
+@pytest.mark.gui
+def testOutline(qtbot, nwTempBuild, nwLipsum, nwTemp):
+
+ nwGUI = nw.main(["--testmode", "--config=%s" % nwTempBuild, "--data=%s" % nwTemp])
+ qtbot.addWidget(nwGUI)
+ nwGUI.show()
+ qtbot.waitForWindowShown(nwGUI)
+ qtbot.wait(stepDelay)
+
+ assert nwGUI.openProject(nwLipsum)
+ nwGUI.mainConf.lastPath = nwTempBuild
+
+ nwGUI.rebuildIndex()
+ nwGUI.tabWidget.setCurrentIndex(nwGUI.idxTabProj)
+
+ assert nwGUI.projView.topLevelItemCount() > 0
+
+ # Context Menu
+ nwGUI.projView._headerRightClick(QPoint(1, 1))
+ nwGUI.projView.headerMenu.actionMap[nwOutline.CCOUNT].activate(QAction.Trigger)
+ nwGUI.projView.headerMenu.close()
+ qtbot.mouseClick(nwGUI.projView, Qt.LeftButton)
+
+ nwGUI.projView._loadHeaderState()
+ assert not nwGUI.projView.colHidden[nwOutline.CCOUNT]
+
+ # First Item
+ nwGUI.rebuildOutline()
+ selItem = nwGUI.projView.topLevelItem(0)
+ assert isinstance(selItem, QTreeWidgetItem)
+
+ nwGUI.projView.setCurrentItem(selItem)
+ assert nwGUI.projMeta.titleLabel.text() == "Title"
+ assert nwGUI.projMeta.titleValue.text() == "Lorem Ipsum"
+ assert nwGUI.projMeta.fileValue.text() == "Lorem Ipsum"
+ assert nwGUI.projMeta.itemValue.text() == "Finished"
+
+ assert nwGUI.projMeta.cCValue.text() == "122"
+ assert nwGUI.projMeta.wCValue.text() == "18"
+ assert nwGUI.projMeta.pCValue.text() == "2"
+
+ # Scene One
+ actItem = nwGUI.projView.topLevelItem(1)
+ chpItem = actItem.child(0)
+ selItem = chpItem.child(0)
+
+ nwGUI.projView.setCurrentItem(selItem)
+ assert nwGUI.projMeta.titleLabel.text() == "Scene"
+ assert nwGUI.projMeta.titleValue.text() == "Scene One"
+ assert nwGUI.projMeta.fileValue.text() == "Scene One"
+ assert nwGUI.projMeta.itemValue.text() == "Finished"
+
+ # Click POV Link
+ assert nwGUI.projMeta.povKeyValue.text() == "Bod"
+ nwGUI.projMeta._tagClicked("#pov=Bod")
+ assert nwGUI.docViewer.theHandle == "4c4f28287af27"
+
+ # qtbot.stopForInteraction()
+ nwGUI.closeMain()