Skip to content

Commit

Permalink
#154 MovieClip関数のUnitTestを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
ienaga committed Dec 6, 2024
1 parent 15e9104 commit f36f3c6
Showing 1 changed file with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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);
});
});

0 comments on commit f36f3c6

Please sign in to comment.