Update tests

This commit is contained in:
Veronica Berglyd Olsen
2024-05-20 17:14:03 +02:00
parent 0b999bd726
commit dce5bdd31d
7 changed files with 21 additions and 44 deletions
+3 -3
View File
@@ -23,7 +23,7 @@ from __future__ import annotations
import pytest
from PyQt5.QtCore import QEvent, Qt, QThreadPool
from PyQt5.QtGui import QClipboard, QMouseEvent, QTextBlock, QTextCursor, QTextOption
from PyQt5.QtGui import QClipboard, QFont, QMouseEvent, QTextBlock, QTextCursor, QTextOption
from PyQt5.QtWidgets import QAction, QApplication, QMenu
from novelwriter import CONFIG, SHARED
@@ -84,7 +84,7 @@ def testGuiEditor_Init(qtbot, nwGUI, projPath, ipsumText, mockRnd):
assert docEditor.docHeader._docOutline == {0: "### New Scene"}
# Check that editor handles settings
CONFIG.textFont = ""
CONFIG.textFont = QFont()
CONFIG.doJustify = True
CONFIG.showTabsNSpaces = True
CONFIG.showLineEndings = True
@@ -96,7 +96,7 @@ def testGuiEditor_Init(qtbot, nwGUI, projPath, ipsumText, mockRnd):
docEditor.initEditor()
qDoc = docEditor.document()
assert CONFIG.textFont == qDoc.defaultFont().family()
assert CONFIG.textFont == qDoc.defaultFont()
assert qDoc.defaultTextOption().alignment() == QtAlignJustify
assert qDoc.defaultTextOption().flags() & QTextOption.ShowTabsAndSpaces
assert qDoc.defaultTextOption().flags() & QTextOption.ShowLineAndParagraphSeparators
-21
View File
@@ -48,27 +48,6 @@ def testGuiTheme_Main(qtbot, nwGUI, tstPaths):
assert mSize > 0
assert mainTheme.getTextWidth("m", mainTheme.guiFont) == mSize
# Init Fonts
# ==========
# The defaults should be set
defaultFont = CONFIG.guiFont
defaultSize = CONFIG.guiFontSize
# CHange them to nonsense values
CONFIG.guiFont = "notafont"
CONFIG.guiFontSize = 99
# Let the theme class set them back to default
mainTheme._setGuiFont()
assert CONFIG.guiFont == defaultFont
assert CONFIG.guiFontSize == defaultSize
# A second call should just restore the defaults again
mainTheme._setGuiFont()
assert CONFIG.guiFont == defaultFont
assert CONFIG.guiFontSize == defaultSize
# Scan for Themes
# ===============