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
SDL 1 CI build fixes #1832
SDL 1 CI build fixes #1832
Changes from 2 commits
1f721e9
066af4e
649cd24
e0eccc2
3e3efe7
1b4cf23
5d89f3b
e68c14a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
import ctypes | ||
|
||
IS_PYPY = "PyPy" == platform.python_implementation() | ||
SDL1 = pygame.get_sdl_version()[0] < 2 | ||
|
||
|
||
def intify(i): | ||
|
@@ -2402,26 +2403,29 @@ def test_premul_surf(src_col, | |
src_size=(17, 67), | ||
dst_size=(69, 69) | ||
)) | ||
|
||
self.assertEqual(*test_premul_surf(pygame.Color(30, 20, 0, 255), | ||
pygame.Color(40, 20, 0, 51), | ||
src_size=(17, 67), | ||
dst_size=(69, 69), | ||
src_has_alpha=False, | ||
)) | ||
# These tests trigger some of the weird SDL1 alpha blending behaviour | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It makes me a little nervous that these aren't correct on SDL1. Are the tests correct, or is SDL1 incorrect? Has the behaviour changed in these blit routines now? Do the SDL2 ones not match the SDL1 ones? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't need a response necessarily :) I was just thinking out loud. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, you are right to ask I'm definitely going to poke at it and see if I can figure out why this works differently. I mean in theory you don't need to do pre-multiplied alpha blending in any of those cases because both surfaces don't have alpha but I believe I would expect it to just work boringly without going through the fancy intrinsic code.... Anyway, it just didn't seem the moment to go off on a tangent figuring that out in this PR. |
||
if not SDL1: | ||
self.assertEqual(*test_premul_surf(pygame.Color(30, 20, 0, 255), | ||
pygame.Color(40, 20, 0, 51), | ||
src_size=(17, 67), | ||
dst_size=(69, 69), | ||
src_has_alpha=False, | ||
)) | ||
self.assertEqual(*test_premul_surf(pygame.Color(30, 20, 0, 51), | ||
pygame.Color(40, 20, 0, 255), | ||
src_size=(17, 67), | ||
dst_size=(69, 69), | ||
dst_has_alpha=False, | ||
)) | ||
self.assertEqual(*test_premul_surf(pygame.Color(30, 20, 0, 255), | ||
pygame.Color(40, 20, 0, 255), | ||
src_size=(17, 67), | ||
dst_size=(69, 69), | ||
src_has_alpha=False, | ||
dst_has_alpha=False, | ||
)) | ||
# These tests trigger some of the weird SDL1 alpha blending behaviour | ||
if not SDL1: | ||
self.assertEqual(*test_premul_surf(pygame.Color(30, 20, 0, 255), | ||
pygame.Color(40, 20, 0, 255), | ||
src_size=(17, 67), | ||
dst_size=(69, 69), | ||
src_has_alpha=False, | ||
dst_has_alpha=False, | ||
)) | ||
|
||
|
||
def test_blit_blend_big_rect(self): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
import unittest | ||
import pygame | ||
from pygame._sdl2 import video | ||
|
||
SDL2 = pygame.get_sdl_version()[0] >= 2 | ||
|
||
class VideoModuleTest(unittest.TestCase): | ||
default_caption = "pygame window" | ||
if SDL2: | ||
from pygame._sdl2 import video | ||
|
||
def test_renderer_set_viewport(self): | ||
""" works. | ||
""" | ||
window = video.Window(title=self.default_caption, size=(800, 600)) | ||
renderer = video.Renderer(window=window) | ||
renderer.logical_size = (1920, 1080) | ||
rect = pygame.Rect(0, 0, 1920, 1080) | ||
renderer.set_viewport(rect) | ||
self.assertEqual(renderer.get_viewport(), (0, 0, 1920, 1080)) | ||
|
||
class VideoModuleTest(unittest.TestCase): | ||
default_caption = "pygame window" | ||
|
||
if __name__ == "__main__": | ||
unittest.main() | ||
def test_renderer_set_viewport(self): | ||
""" works. | ||
""" | ||
window = video.Window(title=self.default_caption, size=(800, 600)) | ||
renderer = video.Renderer(window=window) | ||
renderer.logical_size = (1920, 1080) | ||
rect = pygame.Rect(0, 0, 1920, 1080) | ||
renderer.set_viewport(rect) | ||
self.assertEqual(renderer.get_viewport(), (0, 0, 1920, 1080)) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍