Make synthetic browser checks independent of private files and timing (#45)
Checks / web (push) Successful in 2m0s

This commit is contained in:
kawa committed 2026-10-03 18:20:30 +02:00
1 parent ad68ca87ce
commit a33ffa3a15
2 files changed
+29 -15

No files matched your search

+3 -7
View File
@@ -90,11 +90,9 @@ test("actual WASM executes an original cartridge, reads input and round-trips st
const emulator = new BinjgbEmulator((error) => {
throw error;
});
const wait = () => new Promise((resolve) => setTimeout(resolve, 180));
await emulator.load(new Uint8Array(bytes), canvas);
emulator.play();
await wait();
emulator.pause();
// Advance emulated frames independently of the CI browser's animation rate.
emulator.advanceFrames(12);
const before = emulator.exportBattery();
const state = emulator.captureState();
const pixels = canvas.getContext("2d")!.getImageData(0, 0, 160, 144).data;
@@ -102,9 +100,7 @@ test("actual WASM executes an original cartridge, reads input and round-trips st
for (let i = 0; i < pixels.length; i += 4)
colors.add(`${pixels[i]},${pixels[i + 1]},${pixels[i + 2]}`);
emulator.setButton("a", true);
emulator.play();
await wait();
emulator.pause();
emulator.advanceFrames(12);
const pressed = emulator.exportBattery()[0];
emulator.restoreState(state);
const restored = emulator.exportBattery()[0];