feat(displays): monitors w/ resolution+refresh in Inventory; flag sub-max refresh in Health — 0.39.0
New core/displays.py reads connected monitors via GNOME Mutter DisplayConfig over D-Bus (busctl --json; works on X11 + Wayland), falling back to xrandr on other X11 desktops. Inventory's Display section now lists each monitor's resolution + current refresh (e.g. 'DP-1 · Samsung LC34G55T: 3440x1440 @ 165 Hz'). System Health (check_displays) flags a monitor running below its max refresh AT THE CURRENT resolution (e.g. 165 Hz panel set to 60 Hz) — never suggests lowering resolution. +tests (Mutter JSON + xrandr parsers, health check). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+17
-1
@@ -4,11 +4,12 @@ import unittest
|
||||
from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
from rigdoctor.core import health
|
||||
from rigdoctor.core import displays, health
|
||||
from rigdoctor.core.health import (
|
||||
CRITICAL,
|
||||
INFO,
|
||||
WARNING,
|
||||
check_displays,
|
||||
check_pcie_links,
|
||||
run_health_checks,
|
||||
scan_journal_text,
|
||||
@@ -81,5 +82,20 @@ class PcieLinkCheckTests(unittest.TestCase):
|
||||
self.assertEqual(check_pcie_links(), [])
|
||||
|
||||
|
||||
class DisplayCheckTests(unittest.TestCase):
|
||||
def test_lower_than_max_refresh_is_flagged(self):
|
||||
mon = displays.Monitor("DP-1", "Samsung LC34G55T", 3440, 1440, 60.0, 165.0)
|
||||
with mock.patch("rigdoctor.core.displays.collect", return_value=[mon]):
|
||||
findings = check_displays()
|
||||
self.assertEqual(len(findings), 1)
|
||||
self.assertEqual(findings[0].severity, INFO)
|
||||
self.assertIn("165", findings[0].title)
|
||||
|
||||
def test_at_max_refresh_no_finding(self):
|
||||
mon = displays.Monitor("DP-1", "Samsung LC34G55T", 3440, 1440, 165.0, 165.0)
|
||||
with mock.patch("rigdoctor.core.displays.collect", return_value=[mon]):
|
||||
self.assertEqual(check_displays(), [])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user