mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-04-28 18:12:23 +12:00
Adds mainWindow and completes function.py coverage
This commit is contained in:
parent
1a5fdc7b1f
commit
159e1c3f75
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -11,4 +11,5 @@ icons/Numix
|
|||
.idea
|
||||
dist
|
||||
build
|
||||
test-projects
|
||||
test-projects
|
||||
.cache
|
||||
|
|
|
@ -9,17 +9,3 @@ import pytest
|
|||
# will throw a seg fault.
|
||||
from PyQt5.QtWidgets import 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)
|
||||
assert a != b != c != d
|
||||
|
||||
# mainWindow
|
||||
# assert F.mainWindow() == None # Because there is no MW
|
||||
|
||||
# iconColor & iconFromColor & iconFromColorString
|
||||
icon = F.iconFromColorString("#ff0000")
|
||||
assert F.iconColor(icon).name().lower() == "#ff0000"
|
||||
|
@ -86,15 +83,13 @@ def test_paths():
|
|||
assert "resources/backgrounds/spacedreams.jpg" in f
|
||||
assert len(F.customIcons()) > 1
|
||||
|
||||
# def test_mainWindow():
|
||||
#
|
||||
# from manuskript.mainWindow import MainWindow
|
||||
# m = MainWindow()
|
||||
#
|
||||
# assert F.mainWindow() is not None
|
||||
# assert F.MW is not None
|
||||
#
|
||||
# F.statusMessage("Test")
|
||||
# F.printObjects()
|
||||
#
|
||||
# m.deleteLater()
|
||||
def test_mainWindow():
|
||||
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
|
||||
assert F.mainWindow() is not None
|
||||
assert F.MW is not None
|
||||
|
||||
F.statusMessage("Test")
|
||||
F.printObjects()
|
||||
assert len(F.findWidgetsOfClass(QWidget)) > 0
|
||||
|
|
Loading…
Reference in a new issue