import { makeAppObjectRepo, Vector2 } from "@vived/core";
import { MockMouseInput } from "../../../MouseInput/Mocks/MockMouseInput";
import { MockBumpTransformScaleAboutPixelPoint } from "../../Mocks/MockBumpTransformScaleAboutPixelPoint";
import { RollScaleTransformMC } from "./RollScaleTransformMC";
export function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const appAO = appObjects.getOrCreate("AO");
    const mockBump = new MockBumpTransformScaleAboutPixelPoint(appAO);
    const mockMouseInput = new MockMouseInput(appObjects.getOrCreate("MouseController"));
    const rollController = new RollScaleTransformMC(appAO);
    return { mockMouseInput, rollController, mockBump };
}
describe("Mouse Dolly Controller", () => {
    it("Bumps in if the roll is negative", () => {
        const { rollController, mockBump } = makeTestRig();
        const evt = {
            position: new Vector2(2, 3),
            event: new WheelEvent("buttondown", { deltaY: -25 }),
        };
        rollController.onWheel(evt);
        expect(mockBump.bump).toHaveBeenCalledWith("IN", new Vector2(2, 3));
    });
    it("Bumps out if the roll is positive", () => {
        const { rollController, mockBump } = makeTestRig();
        const evt = {
            position: new Vector2(2, 3),
            event: new WheelEvent("buttondown", { deltaY: 25 }),
        };
        rollController.onWheel(evt);
        expect(mockBump.bump).toHaveBeenCalledWith("OUT", new Vector2(2, 3));
    });
    it("Does not bump if allow returns false", () => {
        const { rollController, mockBump } = makeTestRig();
        const evt = {
            position: new Vector2(2, 3),
            event: new WheelEvent("buttondown", { deltaY: 25 }),
        };
        rollController.allow = () => {
            return false;
        };
        rollController.onWheel(evt);
        expect(mockBump.bump).not.toHaveBeenCalled();
    });
});
//# sourceMappingURL=RollScaleTransformMC.test.js.map