This commit is contained in:
wittmannzl103469 committed 2026-11-05 15:08:42 +01:00
1 parent de41a02749
commit 9af09cebd3
764 files changed
+54218 -78859

No files matched your search

@@ -1,5 +1,35 @@
import unittest
import os
import pygame
import pygame.camera
class CameraModuleTest(unittest.TestCase):
pass
def setUp(self):
pygame.init()
pygame.camera.init()
@unittest.skipIf(
os.environ.get("SDL_VIDEODRIVER") in ["dummy", "android"],
"requires the SDL_VIDEODRIVER to be non dummy",
)
def test_camera(self):
cameras = pygame.camera.list_cameras()
if len(cameras) == 0:
self.skipTest("No cameras found")
cam = pygame.camera.Camera(cameras[0], (640, 480))
cam.start()
image = cam.get_image()
self.assertIsNotNone(image, "Could not capture image")
cam.stop()
def tearDown(self):
pygame.camera.quit()
pygame.quit()
if __name__ == "__main__":
unittest.main()