mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-06-14 08:54:34 +12:00
Adds unit test for #225: Manuskript fails to run in Ubuntu 14.04
This commit is contained in:
parent
ba4fe6b57a
commit
f945387066
|
@ -17,6 +17,15 @@ def MW():
|
||||||
|
|
||||||
return MW
|
return MW
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def MWNoProject(MW):
|
||||||
|
"""
|
||||||
|
Take the MainWindow and close andy possibly open project.
|
||||||
|
"""
|
||||||
|
MW.closeProject()
|
||||||
|
assert MW.currentProject is None
|
||||||
|
return MW
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def MWEmptyProject(MW):
|
def MWEmptyProject(MW):
|
||||||
"""
|
"""
|
||||||
|
|
4
manuskript/tests/ui/__init__.py
Normal file
4
manuskript/tests/ui/__init__.py
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# --!-- coding: utf8 --!--
|
||||||
|
|
||||||
|
"""Tests for stuff in ui."""
|
22
manuskript/tests/ui/test_welcome.py
Normal file
22
manuskript/tests/ui/test_welcome.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# --!-- coding: utf8 --!--
|
||||||
|
|
||||||
|
"""Tests for the welcome widget."""
|
||||||
|
|
||||||
|
def test_autoLoad(MWNoProject):
|
||||||
|
"""
|
||||||
|
Tests for the welcome widget using MainWindow with no open project.
|
||||||
|
"""
|
||||||
|
MW = MWNoProject
|
||||||
|
from PyQt5.QtCore import QSettings
|
||||||
|
|
||||||
|
# Testing when no autoLoad
|
||||||
|
QSettings().remove("autoLoad")
|
||||||
|
autoLoad, path = MW.welcome.getAutoLoadValues()
|
||||||
|
assert type(autoLoad) == bool
|
||||||
|
assert autoLoad == False
|
||||||
|
|
||||||
|
for v in [True, False, 42, "42", None, True]:
|
||||||
|
MW.welcome.setAutoLoad(v)
|
||||||
|
autoLoad, path = MW.welcome.getAutoLoadValues()
|
||||||
|
assert type(autoLoad) == bool
|
|
@ -77,7 +77,8 @@ class welcome(QWidget, Ui_welcome):
|
||||||
return autoLoad, last
|
return autoLoad, last
|
||||||
|
|
||||||
def setAutoLoad(self, v):
|
def setAutoLoad(self, v):
|
||||||
QSettings().setValue("autoLoad", v)
|
if type(v) == bool:
|
||||||
|
QSettings().setValue("autoLoad", v)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# RECENTS
|
# RECENTS
|
||||||
|
|
Loading…
Reference in a new issue