Skip to content

Commit 8e39d22

Browse files
committed
fix mouse motion and add test for event handling
1 parent 244a239 commit 8e39d22

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

tests/conftest.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
def create_window(width=1280, height=720, caption="Testing", **kwargs):
3030
global WINDOW
3131
if not WINDOW:
32-
WINDOW = REAL_WINDOW_CLASS(width=width, height=height, title=caption, vsync=False, antialiasing=False)
32+
WINDOW = REAL_WINDOW_CLASS(
33+
width=width, height=height, title=caption, vsync=False, antialiasing=False
34+
)
3335
WINDOW.set_vsync(False)
3436
# This value is being monkey-patched into the Window class so that tests can identify if we are using
3537
# arcade-accelerate easily in case they need to disable something when it is enabled.
@@ -164,7 +166,7 @@ def projection(self, projection):
164166

165167
@property
166168
def viewport(self):
167-
return self.window.viewport
169+
return self.window.viewport
168170

169171
@viewport.setter
170172
def viewport(self, viewport):
@@ -282,11 +284,11 @@ def default_camera(self):
282284
def use(self):
283285
self.window.use()
284286

285-
def push_handlers(self, *handlers):
286-
self.window.push_handlers(*handlers)
287+
def push_handlers(self, *args, **kwargs):
288+
self.window.push_handlers(*args, **kwargs)
287289

288-
def remove_handlers(self, *handlers):
289-
self.window.remove_handlers(*handlers)
290+
def remove_handlers(self, *args, **kwargs):
291+
self.window.remove_handlers(*args, **kwargs)
290292

291293
def run(self):
292294
self.window.run()
@@ -309,7 +311,6 @@ def fixed_delta_time(self) -> float:
309311
return self.window._fixed_rate
310312

311313

312-
313314
@pytest.fixture(scope="function")
314315
def window_proxy():
315316
"""Monkey patch the open_window function and return a WindowTools instance."""
@@ -364,7 +365,9 @@ def read_pixel(self, x, y, components=3) -> tuple[int, int, int, int] | tuple[in
364365

365366
def read_region(self, rect: Rect) -> list[tuple[int, int, int, int]]:
366367
"""Read a region of RGBA pixels from the offscreen buffer"""
367-
data = self.fbo.read(components=4, viewport=(rect.left, rect.bottom, rect.width, rect.height))
368+
data = self.fbo.read(
369+
components=4, viewport=(rect.left, rect.bottom, rect.width, rect.height)
370+
)
368371
return [
369372
(
370373
int.from_bytes(data[i : i + 4], "little"),

0 commit comments

Comments
 (0)