Skip to content

Skip checking actual_brightness if brightness scaling is "non-linear" (Bugfix)#2569

Draft
tomli380576 wants to merge 7 commits into
mainfrom
inaccuate-brightness-test-result
Draft

Skip checking actual_brightness if brightness scaling is "non-linear" (Bugfix)#2569
tomli380576 wants to merge 7 commits into
mainfrom
inaccuate-brightness-test-result

Conversation

@tomli380576

@tomli380576 tomli380576 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Description

In the current brightness test there's a check where after writing to the brightness file, the script checks if actual_brightness reports a value close to max_brightness / 2. This PR changes it to only test when brightness scaling is not non-linear.

Resolved issues

The current brightness test will always return non-zero on devices that doesn't use linear brightness scaling. It can be confusing when the physical brightness changes correctly.

Documentation

Documented in the python comment, but the idea is that the actual_brightness value is often times the raw register value which isn't always scaled linearly. Checking it directly against max_brightness / 2 isn't correct in this case.

Tests

C3:

@tomli380576 tomli380576 changed the title Skip testing actual_brightness if brightness scaling is "non-linear" Skip checking actual_brightness if brightness scaling is "non-linear" (Bugfix) Jun 9, 2026
@tomli380576 tomli380576 marked this pull request as draft June 9, 2026 09:08
@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.28%. Comparing base (2ec4777) to head (550c5d1).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2569      +/-   ##
==========================================
+ Coverage   59.23%   59.28%   +0.05%     
==========================================
  Files         480      480              
  Lines       48448    48452       +4     
  Branches     8668     8669       +1     
==========================================
+ Hits        28698    28726      +28     
+ Misses      18851    18828      -23     
+ Partials      899      898       -1     
Flag Coverage Δ
provider-base 34.73% <100.00%> (+0.15%) ⬆️

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.

@tomli380576 tomli380576 requested a review from Copilot June 10, 2026 01:27

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.

Copilot wasn't able to review any files in this pull request.

@tomli380576 tomli380576 requested a review from Copilot June 10, 2026 01:28

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.

Copilot wasn't able to review any files in this pull request.

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

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

Comment on lines +7 to +21
class TestGetScale(unittest.TestCase):
def test_reads_scale_file_content(self):
b = Brightness.__new__(Brightness)
with patch("brightness_test.Path.read_text", return_value="linear\n"):
result = b.get_scale("/sys/class/backlight/intel_backlight")
self.assertEqual(result, "linear")

def test_reads_non_linear_scale(self):
b = Brightness.__new__(Brightness)
with patch(
"brightness_test.Path.read_text", return_value="non-linear\n"
):
result = b.get_scale("/sys/class/backlight/amdgpu_bl0")
self.assertEqual(result, "non-linear")

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.

2 participants