diff --git a/src_c/window.c b/src_c/window.c index f2976df502..f9ff6f4cf1 100644 --- a/src_c/window.c +++ b/src_c/window.c @@ -911,6 +911,11 @@ window_get_opengl(pgWindowObject *self, void *v) hasGL = self->context != NULL; } else { + /* This is not a reliable way to test that OPENGL was requested by the + * user. SDL can implicitly create and use an opengl context in some + * platforms and in that case hasGL=1 even when the user didn't + * request for it. As borrowed windows are deprecated functionality we + * can ignore this issue. */ hasGL = (SDL_GetWindowFlags(self->_win) & SDL_WINDOW_OPENGL) > 0; } return PyBool_FromLong(hasGL); diff --git a/test/window_test.py b/test/window_test.py index 5212b97b9c..693da90ac9 100644 --- a/test/window_test.py +++ b/test/window_test.py @@ -150,8 +150,9 @@ def test_size(self): self.win.size = (640, 480) def test_position(self): - self.win.position = (12, 34) - self.assertTupleEqual(self.win.position, (12, 34)) + new_pos = (self.win.position[0] + 20, self.win.position[1] + 10) + self.win.position = new_pos + self.assertTupleEqual(self.win.position, new_pos) self.win.position = pygame.WINDOWPOS_CENTERED @@ -323,13 +324,13 @@ def test_window_object_repr(self): pygame.init() def test_from_display_module(self): - pygame.display.set_mode((640, 480)) + surf = pygame.display.set_mode((640, 480)) win1 = Window.from_display_module() win2 = Window.from_display_module() self.assertIs(win1, win2) - self.assertFalse(win1.opengl) + self.assertIs(win1.get_surface(), surf) pygame.display.quit() pygame.init()