Skip checking actual_brightness if brightness scaling is "non-linear" (Bugfix)#2569
Draft
tomli380576 wants to merge 7 commits into
Draft
Skip checking actual_brightness if brightness scaling is "non-linear" (Bugfix)#2569tomli380576 wants to merge 7 commits into
tomli380576 wants to merge 7 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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") | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In the current brightness test there's a check where after writing to the
brightnessfile, the script checks ifactual_brightnessreports a value close tomax_brightness / 2. This PR changes it to only test when brightness scaling is notnon-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_brightnessvalue is often times the raw register value which isn't always scaled linearly. Checking it directly againstmax_brightness / 2isn't correct in this case.Tests
C3: