Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gnome_randr_cycle not working under Wayland (LP:#2036172)(BugFix) #855

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hugh712
Copy link

@hugh712 hugh712 commented Nov 30, 2023

Description

  • Change the position of current_modes to earlier.
  • Compare rate and existing_rate with float instead of string.

Resolved issues

Currently runs 'gnome_randr_cycle.py' it will just directly finish without toggling any resolution, because some code glitch, after my change, it will work as expected.

Tests

I run code as below on my 22.04 laptop :

$ python3 /usr/lib/checkbox-provider-base/bin/gnome_randr_cycle.py --screenshot-dir=~/tmp
Set mode 1368x768@119.83 for output eDP-1
Set mode 1600x1200@89.91 for output eDP-1
Set mode 1920x1080@89.93 for output eDP-1
Set mode 1920x1200@120.00 for output eDP-1
Set mode 1920x1200@60.00 for output eDP-1

It will

  • Pick up a highest refresh rate in each resolution
  • Find the top resolution per aspect
  • Change resolutions and get screenshots,
  • Finally change back to original resolution, everything works as expected.

 * Change the position of current_modes to earlier.
 * Compare rate and existing_rate with float instead of string.
@hugh712
Copy link
Author

hugh712 commented Dec 5, 2023

@pieqq

Would you please help to review my fix? thank you :)

Copy link
Collaborator

@pieqq pieqq left a comment

Choose a reason for hiding this comment

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

@hugh712 thanks for this patch!

It seems your modifications are not passing the flake8 tests. From the tox run:

FAIL: test_flake8_/home/runner/work/checkbox/checkbox/providers/base/bin/gnome_randr_cycle.py (plainbox.provider_manager.Flake8Tests)

I added a few comments inline.

Also, did you check for regression? Have you tested your fix on X11? On 20.04?

providers/base/bin/gnome_randr_cycle.py Outdated Show resolved Hide resolved
providers/base/bin/gnome_randr_cycle.py Outdated Show resolved Hide resolved
providers/base/bin/gnome_randr_cycle.py Outdated Show resolved Hide resolved
@hugh712
Copy link
Author

hugh712 commented Dec 8, 2023

@pieqq

Thanks for the review :)

For the question

Also, did you check for regression? Have you tested your fix on X11?

As I know, this gnome_randr_cycle was designed for wayland, and xrandr_cycle.py for X11,
So I am not sure to verify this gnome_randr_cycle under X11 is a valid test case?

Copy link

codecov bot commented Dec 12, 2023

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (4319b97) 35.69% compared to head (e6ab7b4) 35.69%.
Report is 25 commits behind head on main.

Files Patch % Lines
providers/base/bin/gnome_randr_cycle.py 0.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #855      +/-   ##
==========================================
- Coverage   35.69%   35.69%   -0.01%     
==========================================
  Files         303      303              
  Lines       34250    34251       +1     
  Branches     5917     5917              
==========================================
  Hits        12226    12226              
- Misses      21459    21460       +1     
  Partials      565      565              
Flag Coverage Δ
provider-base 5.29% <0.00%> (-0.01%) ⬇️

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

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

@pieqq
Copy link
Collaborator

pieqq commented Dec 12, 2023

Thanks for the changes!

gnome-randr is compatible with both X11 and Wayland in theory, that's why I asked if you had done some regression testing, but after checking in our providers, we indeed only run this script when using Wayland, so no need to do this.

However, currently gnome_randr_cycle.py is not covered by any unit test. This is now a requirement for new PRs, as explained in the Testing section of the Contributing Guide.

Given that this script is a bit long and written in a very "imperative programming" style (I mean no functions, no classes, just running it line by line), it's gonna be difficult to test. I recommend you split the different parts into functions that should be easier to write unit tests for.

Reach out if you need help!

@pieqq
Copy link
Collaborator

pieqq commented Jan 10, 2024

@hugh712 Hey! Did you have time to look into this to add some unit tests for your script? There are a few sections in the contrib guide that may help you:

@hugh712
Copy link
Author

hugh712 commented Jan 11, 2024

@hugh712 Hey! Did you have time to look into this to add some unit tests for your script? There are a few sections in the contrib guide that may help you:

@pieqq

Hi Pierre,
This is still in my pocket, but unfortunately still can not find time to do that,
will let you know once I have progress, thank you :)

@kissiel
Copy link
Contributor

kissiel commented Jan 12, 2024

This PR awaits the author to have some time to work on it, and there's still some missing bits, so I'm switching the state to "Draft"

@kissiel kissiel marked this pull request as draft January 12, 2024 14:19
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.

None yet

3 participants