mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-23 22:29:42 +12:00
Adds mainWindow and completes function.py coverage
This commit is contained in:
parent
1a5fdc7b1f
commit
159e1c3f75
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -12,3 +12,4 @@ icons/Numix
|
||||||
dist
|
dist
|
||||||
build
|
build
|
||||||
test-projects
|
test-projects
|
||||||
|
.cache
|
||||||
|
|
|
@ -9,17 +9,3 @@ import pytest
|
||||||
# will throw a seg fault.
|
# will throw a seg fault.
|
||||||
from PyQt5.QtWidgets import QApplication
|
from PyQt5.QtWidgets import QApplication
|
||||||
app = QApplication([])
|
app = QApplication([])
|
||||||
|
|
||||||
@pytest.yield_fixture(scope='session', autouse=True)
|
|
||||||
def MW():
|
|
||||||
|
|
||||||
# Creates a mainWindow that can be used for the tests
|
|
||||||
# Either with functions.mainWindow or by passing argument
|
|
||||||
# MW to the test
|
|
||||||
from manuskript.mainWindow import MainWindow
|
|
||||||
mw = MainWindow()
|
|
||||||
|
|
||||||
yield
|
|
||||||
|
|
||||||
# Properly destructed after. Otherwise: seg fault.
|
|
||||||
mw.deleteLater()
|
|
||||||
|
|
21
manuskript/tests/conftest.py
Normal file
21
manuskript/tests/conftest.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# --!-- coding: utf8 --!--
|
||||||
|
|
||||||
|
"""Fixtures."""
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
@pytest.fixture(scope='session', autouse=True)
|
||||||
|
def MW():
|
||||||
|
"""
|
||||||
|
Creates a mainWindow that can be used for the tests
|
||||||
|
Either with functions.mainWindow or by passing argument
|
||||||
|
MW to the test
|
||||||
|
"""
|
||||||
|
from manuskript.mainWindow import MainWindow
|
||||||
|
mw = MainWindow()
|
||||||
|
|
||||||
|
yield
|
||||||
|
|
||||||
|
# Properly destructed after. Otherwise: seg fault.
|
||||||
|
mw.deleteLater()
|
|
@ -41,9 +41,6 @@ def test_several():
|
||||||
d = F.colorFromProgress(1.5)
|
d = F.colorFromProgress(1.5)
|
||||||
assert a != b != c != d
|
assert a != b != c != d
|
||||||
|
|
||||||
# mainWindow
|
|
||||||
# assert F.mainWindow() == None # Because there is no MW
|
|
||||||
|
|
||||||
# iconColor & iconFromColor & iconFromColorString
|
# iconColor & iconFromColor & iconFromColorString
|
||||||
icon = F.iconFromColorString("#ff0000")
|
icon = F.iconFromColorString("#ff0000")
|
||||||
assert F.iconColor(icon).name().lower() == "#ff0000"
|
assert F.iconColor(icon).name().lower() == "#ff0000"
|
||||||
|
@ -86,15 +83,13 @@ def test_paths():
|
||||||
assert "resources/backgrounds/spacedreams.jpg" in f
|
assert "resources/backgrounds/spacedreams.jpg" in f
|
||||||
assert len(F.customIcons()) > 1
|
assert len(F.customIcons()) > 1
|
||||||
|
|
||||||
# def test_mainWindow():
|
def test_mainWindow():
|
||||||
#
|
|
||||||
# from manuskript.mainWindow import MainWindow
|
from PyQt5.QtWidgets import QWidget
|
||||||
# m = MainWindow()
|
|
||||||
#
|
assert F.mainWindow() is not None
|
||||||
# assert F.mainWindow() is not None
|
assert F.MW is not None
|
||||||
# assert F.MW is not None
|
|
||||||
#
|
F.statusMessage("Test")
|
||||||
# F.statusMessage("Test")
|
F.printObjects()
|
||||||
# F.printObjects()
|
assert len(F.findWidgetsOfClass(QWidget)) > 0
|
||||||
#
|
|
||||||
# m.deleteLater()
|
|
||||||
|
|
Loading…
Reference in a new issue