"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeTestRig = makeTestRig;
const core_1 = require("@vived/core");
const MockMouseInput_1 = require("../../../MouseInput/Mocks/MockMouseInput");
const MockBumpTransformScaleAboutPixelPoint_1 = require("../../Mocks/MockBumpTransformScaleAboutPixelPoint");
const RollScaleTransformMC_1 = require("./RollScaleTransformMC");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const appAO = appObjects.getOrCreate("AO");
    const mockBump = new MockBumpTransformScaleAboutPixelPoint_1.MockBumpTransformScaleAboutPixelPoint(appAO);
    const mockMouseInput = new MockMouseInput_1.MockMouseInput(appObjects.getOrCreate("MouseController"));
    const rollController = new RollScaleTransformMC_1.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 core_1.Vector2(2, 3),
            event: new WheelEvent("buttondown", { deltaY: -25 }),
        };
        rollController.onWheel(evt);
        expect(mockBump.bump).toHaveBeenCalledWith("IN", new core_1.Vector2(2, 3));
    });
    it("Bumps out if the roll is positive", () => {
        const { rollController, mockBump } = makeTestRig();
        const evt = {
            position: new core_1.Vector2(2, 3),
            event: new WheelEvent("buttondown", { deltaY: 25 }),
        };
        rollController.onWheel(evt);
        expect(mockBump.bump).toHaveBeenCalledWith("OUT", new core_1.Vector2(2, 3));
    });
    it("Does not bump if allow returns false", () => {
        const { rollController, mockBump } = makeTestRig();
        const evt = {
            position: new core_1.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