From f36f3c654f1ffeb41a351b484979b2a8d8883813 Mon Sep 17 00:00:00 2001 From: ienaga Date: Fri, 6 Dec 2024 22:07:05 +0900 Subject: [PATCH] =?UTF-8?q?#154=20MovieClip=E9=96=A2=E6=95=B0=E3=81=AEUnit?= =?UTF-8?q?Test=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../usecase/MovieClipGoToFrameUseCase.test.ts | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 packages/display/src/MovieClip/usecase/MovieClipGoToFrameUseCase.test.ts diff --git a/packages/display/src/MovieClip/usecase/MovieClipGoToFrameUseCase.test.ts b/packages/display/src/MovieClip/usecase/MovieClipGoToFrameUseCase.test.ts new file mode 100644 index 00000000..86a6c4cb --- /dev/null +++ b/packages/display/src/MovieClip/usecase/MovieClipGoToFrameUseCase.test.ts @@ -0,0 +1,54 @@ +import { execute } from "./MovieClipGoToFrameUseCase"; +import { MovieClip } from "../../MovieClip"; +import { FrameLabel } from "../../FrameLabel"; +import { describe, expect, it } from "vitest"; + +describe("MovieClipGoToFrameUseCase.js test", () => +{ + it("execute test case1", () => + { + const movieClip = new MovieClip(); + movieClip.totalFrames = 3; + + movieClip.$wait = false; + movieClip.$canSound = false; + movieClip.$canAction = false; + movieClip.$hasTimelineHeadMoved = false; + + expect(movieClip.currentFrame).toBe(1); + expect(movieClip.$wait).toBe(false); + expect(movieClip.$canSound).toBe(false); + expect(movieClip.$hasTimelineHeadMoved).toBe(false); + + execute(movieClip, 2); + + expect(movieClip.currentFrame).toBe(2); + expect(movieClip.$wait).toBe(true); + expect(movieClip.$canSound).toBe(true); + expect(movieClip.$hasTimelineHeadMoved).toBe(true); + }); + + it("execute test case1", () => + { + const movieClip = new MovieClip(); + movieClip.addFrameLabel(new FrameLabel("test", 4)); + movieClip.totalFrames = 3; + + movieClip.$wait = false; + movieClip.$canSound = false; + movieClip.$canAction = false; + movieClip.$hasTimelineHeadMoved = false; + + expect(movieClip.currentFrame).toBe(1); + expect(movieClip.$wait).toBe(false); + expect(movieClip.$canSound).toBe(false); + expect(movieClip.$hasTimelineHeadMoved).toBe(false); + + execute(movieClip, "test"); + + expect(movieClip.currentFrame).toBe(3); + expect(movieClip.$wait).toBe(true); + expect(movieClip.$canSound).toBe(true); + expect(movieClip.$hasTimelineHeadMoved).toBe(true); + }); +}); \ No newline at end of file