mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-08 13:33:42 +08:00
a82935f326
Integrate onroad views, configurable widgets, local settings, steering-profile contracts, Bluetooth and Android Auto with their device and runtime services. Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> Co-authored-by: Daniel Koepping <elkoled@gmail.com> Co-authored-by: Danny <dannyirwin31@yahoo.com> Co-authored-by: DimitriChrysafis <Dimitri.chrysafis@gmail.com> Co-authored-by: Dom <168790843+firestar5683@users.noreply.github.com> Co-authored-by: Harald Schäfer <harald.the.engineer@gmail.com> Co-authored-by: Prabhaav Pillai <prabhaav@msu.edu> Co-authored-by: Shane Smiskol <shane@smiskol.com> Co-authored-by: dirwin31 <83434411+dirwin31@users.noreply.github.com> Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com> Co-authored-by: stef <19478336+stefpi@users.noreply.github.com> Co-authored-by: whoisdomi <dcantu83@gmail.com> Co-authored-by: Intelli <contact@intelli.software> Co-authored-by: pharmacomaniac <blittle65@gmail.com> Co-authored-by: prabhaavp <prabhaav@msu.edu>
33 lines
1.5 KiB
Python
33 lines
1.5 KiB
Python
"""A missing desktop display must fail before monitor or render resource queries."""
|
|
|
|
import unittest
|
|
from unittest.mock import patch
|
|
|
|
from openpilot.system.ui.lib import application
|
|
|
|
|
|
class TestHostWindowFailure(unittest.TestCase):
|
|
def test_auto_scale_does_not_query_uninitialized_monitor(self):
|
|
app = object.__new__(application.GuiApplication)
|
|
app._width, app._height = 536, 240
|
|
with patch.object(application.rl, "init_window"), \
|
|
patch.object(application.rl, "is_window_ready", return_value=False), \
|
|
patch.object(application.rl, "get_monitor_width") as get_width:
|
|
with self.assertRaisesRegex(RuntimeError, "active monitor"):
|
|
app._calculate_auto_scale()
|
|
get_width.assert_not_called()
|
|
|
|
def test_normal_pc_window_does_not_load_render_resources(self):
|
|
app = object.__new__(application.GuiApplication)
|
|
app._scaled_width, app._scaled_height, app._scale = 536, 240, 1.0
|
|
with patch.object(application, "PC", True), \
|
|
patch.object(application.signal, "signal"), \
|
|
patch.object(application.atexit, "register"), \
|
|
patch.object(application.rl, "set_config_flags"), \
|
|
patch.object(application.rl, "init_window"), \
|
|
patch.object(application.rl, "is_window_ready", return_value=False), \
|
|
patch.object(application.rl, "load_render_texture") as load_texture:
|
|
with self.assertRaisesRegex(RuntimeError, "active monitor"):
|
|
app.init_window("fixture")
|
|
load_texture.assert_not_called()
|