Skip to content

Commit 992c858

Browse files
committed
Click-detect tests: Use singleton MockMouse
1 parent 7122c60 commit 992c858

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

test/pytch/test_click_detection.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ describe("click detection", () => {
5252
it("can run balloon-popping game", async () => {
5353
let project = await import_project();
5454

55-
let mouse = new mock_mouse();
5655
let balloon_sprite = project.actor_by_class_name("Balloon");
5756
let the_Balloon = balloon_sprite.instances[0];
5857

@@ -70,33 +69,33 @@ describe("click detection", () => {
7069
project.on_green_flag_clicked();
7170
assert_state_after_next_frame(true, 0);
7271

73-
mouse.click_at(-50, -90);
74-
mouse.release_click();
72+
mock_mouse.click_at(-50, -90);
73+
mock_mouse.release_click();
7574
assert_state_after_next_frame(true, 0);
7675

77-
mouse.click_at(-50, -120);
78-
mouse.release_click();
76+
mock_mouse.click_at(-50, -120);
77+
mock_mouse.release_click();
7978
assert_state_after_next_frame(false, 1);
8079
assert_state_after_next_frame(false, 1);
8180

8281
project.do_synthetic_broadcast("reappear");
8382
assert_state_after_next_frame(true, 1);
8483

85-
mouse.click_at(-50, -90);
86-
mouse.release_click();
84+
mock_mouse.click_at(-50, -90);
85+
mock_mouse.release_click();
8786
assert_state_after_next_frame(true, 1);
88-
mouse.click_at(-50, -120);
89-
mouse.release_click();
87+
mock_mouse.click_at(-50, -120);
88+
mock_mouse.release_click();
9089
assert_state_after_next_frame(false, 2);
9190

9291
project.do_synthetic_broadcast("move");
9392
assert_state_after_next_frame(true, 2);
9493

95-
mouse.click_at(180, -20);
96-
mouse.release_click();
94+
mock_mouse.click_at(180, -20);
95+
mock_mouse.release_click();
9796
assert_state_after_next_frame(true, 2);
98-
mouse.click_at(170, 120);
99-
mouse.release_click();
97+
mock_mouse.click_at(170, 120);
98+
mock_mouse.release_click();
10099
assert_state_after_next_frame(false, 3);
101100
})});
102101
});

0 commit comments

Comments
 (0)