"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeTestRig = makeTestRig;
const core_1 = require("@vived/core");
const core_2 = require("@vived/core");
const MockMouseInput_1 = require("../../MouseInput/Mocks/MockMouseInput");
const BumpSceneRootScaleAboutPixelPoint_1 = require("../UC/BumpSceneRootScaleAboutPixelPoint");
const MouseRoll_1 = require("./MouseRoll");
class MockUC extends BumpSceneRootScaleAboutPixelPoint_1.BumpSceneRootScaleAboutPixelPointUC {
    constructor() {
        super(...arguments);
        this.allow = jest.fn();
        this.bump = jest.fn();
    }
}
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const appAO = appObjects.getOrCreate("AO");
    const mockBump = new MockUC(appAO, BumpSceneRootScaleAboutPixelPoint_1.BumpSceneRootScaleAboutPixelPointUC.type);
    const mockMouseInput = new MockMouseInput_1.MockMouseInput(appAO);
    const rollController = new MouseRoll_1.MouseRoll(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_2.Vector2(2, 3),
            event: new WheelEvent("buttondown", { deltaY: -25 }),
        };
        rollController.onWheel(evt);
        expect(mockBump.bump).toHaveBeenCalledWith("IN", new core_2.Vector2(2, 3));
    });
    it("Bumps out if the roll is positive", () => {
        const { rollController, mockBump } = makeTestRig();
        const evt = {
            position: new core_2.Vector2(2, 3),
            event: new WheelEvent("buttondown", { deltaY: 25 }),
        };
        rollController.onWheel(evt);
        expect(mockBump.bump).toHaveBeenCalledWith("OUT", new core_2.Vector2(2, 3));
    });
    it("Does not bump if allow returns false", () => {
        const { rollController, mockBump } = makeTestRig();
        const evt = {
            position: new core_2.Vector2(2, 3),
            event: new WheelEvent("buttondown", { deltaY: 25 }),
        };
        rollController.allow = () => {
            return false;
        };
        rollController.onWheel(evt);
        expect(mockBump.bump).not.toHaveBeenCalled();
    });
});
//# sourceMappingURL=MouseRoll.test.js.map