Skip to content

Re-implement max resolution test to handle fractional scaling (New) - #2635

Draft
tomli380576 wants to merge 17 commits into
mainfrom
max-resolution-with-fractional-scaling
Draft

Re-implement max resolution test to handle fractional scaling (New)#2635
tomli380576 wants to merge 17 commits into
mainfrom
max-resolution-with-fractional-scaling

Conversation

@tomli380576

@tomli380576 tomli380576 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Description

This PR re-implements the graphics_max_resolution test to handle fractional scaling that's now officially supported on 26.04.

Resolved issues

Originally the test case uses the display object returned by Gdk.Display.get_default() to get the current application-level resolution and scaling. The scaling value returned by Gdk is always an integer which makes the test case unable to handle fractional scaling. The new implementation directly queries GNOME about the physical monitor dimensions instead so we can ignore scaling and wayland/x11 differences altogether.

Documentation

This test does not work on 16.04, just like the original version. The new one doesn't work on 16.04 is because the dbus call used by MonitorConfigGnome is not present in unity. The old one doesn't work is because of this line

gi.require_versions({"Gtk": "3.0", "Gdk": "3.0"})

the require_versions method does not exist in 16.04's python3-gi binding.

Tests

C3:

@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 2.98507% with 65 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.80%. Comparing base (2e479a6) to head (9b5dd04).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
providers/base/bin/graphics_max_resolution.py 0.00% 53 Missing ⚠️
...box-support/checkbox_support/dbus/gnome_monitor.py 14.28% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2635      +/-   ##
==========================================
- Coverage   59.83%   59.80%   -0.03%     
==========================================
  Files         485      485              
  Lines       48736    48790      +54     
  Branches     8728     8743      +15     
==========================================
+ Hits        29160    29179      +19     
- Misses      18655    18694      +39     
+ Partials      921      917       -4     
Flag Coverage Δ
checkbox-support 69.64% <14.28%> (-0.19%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the provider-side graphics_max_resolution job to determine “current vs maximum” monitor resolution via GNOME/Mutter’s DisplayConfig DBus API (to better handle fractional scaling), and adds convenience helpers to the Checkbox Support GNOME monitor DBus wrapper.

Changes:

  • Replace the Gtk/Gdk-based resolution query in graphics_max_resolution.py with GNOME/Mutter DisplayConfig DBus state, and keep a sysfs cross-check.
  • Add PhysicalMonitor.get_max_resolution() and PhysicalMonitor.get_current_mode() helpers to checkbox_support.dbus.gnome_monitor.
  • Minor signature formatting tweak in MonitorConfigGnome.cycle() (trailing comma).

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 4 comments.

File Description
providers/base/bin/graphics_max_resolution.py Reworks max-resolution detection to use GNOME/Mutter DBus state + sysfs aggregation check.
checkbox-support/checkbox_support/dbus/gnome_monitor.py Adds helpers for selecting max resolution and current mode from Mutter-reported physical monitor modes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +143 to +156
if len(self.modes) == 0:
raise ValueError(
"Monitor {} doesn't have any supported modes!".format(
self.info.connector
)
)
for mode in self.modes:
if (mode.width, mode.height) >= (max_w, max_h):
max_w, max_h = mode.width, mode.height

if (max_w, max_h) == (0, 0):
raise RuntimeError("Unexpected max resolution of 0x0")

return max_w, max_h
Comment on lines +158 to +164
def get_current_mode(self) -> "MutterDisplayMode | None":
# it' possible to return none
# if somehow all monitors are turned off
for mode in self.modes:
if mode.is_current:
return mode

Comment on lines +135 to +136
def get_max_resolution(self) -> "tuple[int, int]":
"""Get the maximum physcial resolution of this monitor
Comment thread checkbox-support/checkbox_support/dbus/gnome_monitor.py
@tomli380576 tomli380576 changed the title Re-implement max resolution test (New) Re-implement max resolution test to handle fractional scaling (New) Jul 2, 2026
@tomli380576 tomli380576 linked an issue Jul 3, 2026 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

graphics_max_resolution.py does not account for fractional scaling

2 participants