Skip to content

Disable mouse rect test on null backend - #3680

Merged
ankith26 merged 1 commit into
pygame-community:mainfrom
marcin-serwin:push-nrskrktplorl
Jan 25, 2026
Merged

ankith26 merged 1 commit into
pygame-community:mainfrom
marcin-serwin:push-nrskrktplorl

Conversation

@marcin-serwin

Copy link
Copy Markdown
Contributor

The SDL_SetWindowMouseRect function returns false on unsupported backends since libsdl-org/SDL@2a873be.

The SDL_SetWindowMouseRect function returns false on unsupported
backends since <libsdl-org/SDL@2a873be>.

Signed-off-by: Marcin Serwin <marcin@serwin.dev>
@marcin-serwin
marcin-serwin requested a review from a team as a code owner January 16, 2026 16:13
@coderabbitai

coderabbitai Bot commented Jan 16, 2026 •

Copy link
Copy Markdown
Contributor
πŸ“ Walkthrough

Walkthrough

Updates skip conditions for test_always_on_top_set in the window test file to additionally require a non-null SDL_VIDEODRIVER environment variable alongside existing SDL version 2.0.18+ requirement.

Changes

Cohort / File(s) Change Summary
Test Skip Condition Update
test/window_test.py
Modified skip decorator for test_always_on_top_set to check for both SDL version >= 2.0.18 and non-null SDL_VIDEODRIVER; updated corresponding skip message.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

πŸš₯ Pre-merge checks | βœ… 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
βœ… Passed checks (2 passed)
Check name Status Explanation
Title check βœ… Passed The title 'Disable mouse rect test on null backend' accurately describes the main change in the pull request - disabling a test on the null backend.
Description check βœ… Passed The description is related to the changeset, explaining the reason for the change by referencing SDL behavior with unsupported backends.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • πŸ“ Generate docstrings


πŸ“œ Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 7e8b238 and f4d4b88.

πŸ“’ Files selected for processing (1)
  • test/window_test.py
🧰 Additional context used
🧠 Learnings (2)
πŸ““ Common learnings
Learnt from: Starbuck5
Repo: pygame-community/pygame-ce PR: 3573
File: src_c/_pygame.h:108-133
Timestamp: 2025-09-01T20:18:57.500Z
Learning: In pygame-ce PR `#3573`, PG_SURF_BitsPerPixel was changed from a simple macro to a static inline function to handle SDL2/SDL3 differences. SDL2's BitsPerPixel includes padding bits (e.g., RGBX => 32) while SDL3's SDL_BITSPERPIXEL excludes padding (e.g., RGBX => 24). The new implementation bridges this gap rather than removing the helper entirely.
πŸ“š Learning: 2025-08-30T21:11:00.240Z
Learnt from: Starbuck5
Repo: pygame-community/pygame-ce PR: 3573
File: src_c/_camera.c:129-131
Timestamp: 2025-08-30T21:11:00.240Z
Learning: When doing SDL2 to SDL3 compatibility changes, Starbuck5 prefers to maintain exact existing behaviors even when other improvements could be made, focusing solely on the compatibility aspect rather than mixing in behavioral fixes.

Applied to files:

  • test/window_test.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: aarch64
  • GitHub Check: i686
  • GitHub Check: x86_64
  • GitHub Check: msys2 (clang64, clang-x86_64)
  • GitHub Check: AMD64
  • GitHub Check: x86
  • GitHub Check: msys2 (mingw64, x86_64)
  • GitHub Check: build (ubuntu-24.04)
  • GitHub Check: debug_coverage (ubuntu-24.04, 3.14.0)
  • GitHub Check: msys2 (ucrt64, ucrt-x86_64)
  • GitHub Check: build (windows-latest)
  • GitHub Check: debug_coverage (ubuntu-24.04, 3.10.17)
  • GitHub Check: build (macos-14)
  • GitHub Check: Pyodide build
  • GitHub Check: dev-check
  • GitHub Check: build (ubuntu-22.04)
  • GitHub Check: Debian (Bookworm - 12) [armv6]
  • GitHub Check: Debian (Bookworm - 12) [armv7]
  • GitHub Check: Debian (Bookworm - 12) [s390x]
  • GitHub Check: Debian (Bookworm - 12) [ppc64le]
πŸ”‡ Additional comments (1)
test/window_test.py (1)

116-120: LGTM β€” skip guard aligns with null backend behavior.
The updated condition and message correctly prevent test_mouse_rect from running under the null video driver while preserving the SDL version requirement.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ankith26 ankith26 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks for the PR! πŸŽ‰

This is something I had already noticed in my SDL3 porting PRs (and already implemented a similar fix sometime back at #3562). I'm curious how you found this, I'm presuming this fail come up with sdl2-compat?

Anyways, I'm in favour of merging your PR first. My PR is slow moving at the movement and it would be good to get this fix in fast.

@marcin-serwin

marcin-serwin commented Jan 18, 2026 •

Copy link
Copy Markdown
Contributor Author

This is something I had already noticed in my SDL3 porting PRs (and already implemented a similar fix sometime back at #3562). I'm curious how you found this, I'm presuming this fail come up with sdl2-compat?

Yes, I help with maintaining SDL libraries in nixpkgs and this came up after the latest sdl3/sdl2-compat bump.

Since you're also working with SDL3, there are two more tests that started failing after the bump:

======================================================================
FAIL: test_aafunctions_depth_segfault (pygame.tests.draw_test.DrawModuleTest.test_aafunctions_depth_segfault)
Ensure future commits don't break the segfault fixed by pull request
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/nix/store/1iv40fycqb9d1v8lcw4dm8v48mn9bds1-python3.14-pygame-ce-2.5.6/lib/python3.14/site-packages/pygame/tests/draw_test.py", line 7540, in test_aafunctions_depth_segfault
    self.assertEqual(surf.get_at(pixel), pixel_colors_16[i])
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Color(0, 0, 214, 255) != Color(0, 0, 213, 255)
======================================================================
FAIL: test_fill_rle (pygame.tests.surface_test.SurfaceTypeTest.test_fill_rle)
Test RLEACCEL flag with fill()
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/nix/store/1iv40fycqb9d1v8lcw4dm8v48mn9bds1-python3.14-pygame-ce-2.5.6/lib/python3.14/site-packages/pygame/tests/surface_test.py", line 303, in test_fill_rle
    self.assertTrue(blit_surf.get_flags() & pygame.RLEACCEL)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0 is not true

I haven't had time to look into it yet, but perhaps you've also run across them and know the cause.

@ankith26

Copy link
Copy Markdown
Member

I noticed these fails too when I was testing out something in an arch box. I didn't investigate it yet but I plan to do it when I get the time. All I can tell is that its something that broke very recently, as I do not get these issues on my ubuntu 25.10 machine which is on an older SDL3 and sdl2-compat.

@ankith26
ankith26 merged commit 1fe027b into pygame-community:main Jan 25, 2026
28 checks passed
@ankith26

Copy link
Copy Markdown
Member

For the test_aafunctions_depth_segfault fail, I believe it is a trivial fail so modifying the test to allow for small delta variations in the pixel should probably be an acceptable fix.

I looked in into the test_fill_rle fail and came up with a C level SDL MRE and reported the issue over at libsdl-org/sdl2-compat#575

Merging this PR for now. Once there is a resolution on the SDL side I will update both tests accordingly in a new PR.

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