Skip to content

Commit

Permalink
Added test setup for vsi, added VS to fix db fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
e100 committed Jun 16, 2024
1 parent eaa6e14 commit 18fb119
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
15 changes: 15 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,19 @@ def create_numbers(key, value, old=False, bad=False, fail=False, annunciate=Fals
fix.db.get_item("ROT").bad = False
fix.db.get_item("ROT").fail = False

fix.db.define_item(
"VS",
"Vertical Speed",
"float",
-30000,
30000,
"ft/min",
50000,
"Min,Max"
)
fix.db.set_value("ROT", 0)
fix.db.get_item("ROT").bad = False
fix.db.get_item("ROT").fail = False


return fix
Empty file.
55 changes: 55 additions & 0 deletions tests/instruments/vsi/test_vsi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import pytest
from unittest import mock
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QColor, QBrush, QPen, QPaintEvent, QFontMetrics
from pyefis.instruments import vsi
import pyefis.hmi as hmi
from tests.utils import track_calls

@pytest.fixture
def app(qtbot):
test_app = QApplication.instance()
if test_app is None:
test_app = QApplication([])
return test_app

def test_vsi(fix,qtbot):
widget = vsi.VSI_Dial()
qtbot.addWidget(widget)
widget.resize(300, 200)
widget.show()
qtbot.waitExposed(widget)
qtbot.wait(1000)


def test_vsi_pfd(fix,qtbot):
widget = vsi.VSI_PFD()
qtbot.addWidget(widget)
widget.resize(300, 200)
widget.show()
qtbot.waitExposed(widget)
qtbot.wait(1000)

def test_vsi_as_trend_tape(fix,qtbot):
widget = vsi.AS_Trend_Tape()
qtbot.addWidget(widget)
widget.resize(300, 200)
widget.show()
qtbot.waitExposed(widget)
qtbot.wait(1000)

def test_vsi_alt_trend_tape(fix,qtbot):
def data_values(arg):
if arg == 'update_period': return None
elif arg == 'update_period2': return None
return None
widget = vsi.Alt_Trend_Tape()
widget.myparent = mock.MagicMock()
widget.myparent.get_config_item = data_values
qtbot.addWidget(widget)
widget.resize(300, 200)
widget.show()
qtbot.waitExposed(widget)
qtbot.wait(1000)

0 comments on commit 18fb119

Please sign in to comment.