From 18fb119058726257e5b63fbed9f5b245e1168f46 Mon Sep 17 00:00:00 2001 From: Eric Blevins Date: Sat, 15 Jun 2024 20:31:58 -0400 Subject: [PATCH] Added test setup for vsi, added VS to fix db fixture --- conftest.py | 15 +++++++++ tests/instruments/vsi/__init__.py | 0 tests/instruments/vsi/test_vsi.py | 55 +++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 tests/instruments/vsi/__init__.py create mode 100644 tests/instruments/vsi/test_vsi.py diff --git a/conftest.py b/conftest.py index ef7fac04..78bef5c7 100644 --- a/conftest.py +++ b/conftest.py @@ -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 diff --git a/tests/instruments/vsi/__init__.py b/tests/instruments/vsi/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/instruments/vsi/test_vsi.py b/tests/instruments/vsi/test_vsi.py new file mode 100644 index 00000000..49387afa --- /dev/null +++ b/tests/instruments/vsi/test_vsi.py @@ -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) +