Update tests
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
# ===============
|
||||
|
||||
|
||||
Reference in New Issue
Block a user