"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const XREntity_1 = require("./XREntity");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const appObj = appObjects.getOrCreate("xrEntity");
    const xrEntity = (0, XREntity_1.makeXREntity)(appObj);
    const observer = jest.fn();
    xrEntity.addChangeObserver(observer);
    return { xrEntity, observer, appObjects };
}
describe("XR Entity", () => {
    it("Starts out with the last frame being undefined", () => {
        const { xrEntity } = makeTestRig();
        expect(xrEntity.lastXRFrame).toBeUndefined();
    });
    it("Sets the last XR frame", () => {
        const { xrEntity } = makeTestRig();
        const frame = new MockXRFrame();
        xrEntity.submitXRFrame(frame);
        expect(xrEntity.lastXRFrame).toEqual(frame);
    });
    it("Notifies when an XR Frame is submitted", () => {
        const { xrEntity, observer } = makeTestRig();
        const frame = new MockXRFrame();
        xrEntity.submitXRFrame(frame);
        expect(observer).toHaveBeenCalled();
    });
});
class MockXRSession {
    constructor() {
        this.inputSources = [];
        this.renderState = { depthFar: 0, depthNear: 0 };
        this.environmentBlendMode = "additive";
        this.visibilityState = "hidden";
        this.isSystemKeyboardSupported = false;
        this.onend = jest.fn();
        this.oninputsourceschange = jest.fn();
        this.onselect = jest.fn();
        this.onselectstart = jest.fn();
        this.onselectend = jest.fn();
        this.onsqueeze = jest.fn();
        this.onsqueezestart = jest.fn();
        this.onsqueezeend = jest.fn();
        this.onvisibilitychange = jest.fn();
        this.onframeratechange = jest.fn();
        this.addEventListener = jest.fn();
        this.removeEventListener = jest.fn();
    }
    cancelAnimationFrame(id) {
        throw new Error("Method not implemented.");
    }
    end() {
        throw new Error("Method not implemented.");
    }
    requestAnimationFrame(callback) {
        throw new Error("Method not implemented.");
    }
    requestReferenceSpace(type) {
        throw new Error("Method not implemented.");
    }
    updateRenderState(renderStateInit) {
        throw new Error("Method not implemented.");
    }
    updateTargetFrameRate(rate) {
        throw new Error("Method not implemented.");
    }
    dispatchEvent(event) {
        throw new Error("Method not implemented.");
    }
}
class MockXRFrame {
    constructor() {
        this.session = new MockXRSession();
        this.predictedDisplayTime = 0;
        this.getPose = jest.fn();
        this.getViewerPose = jest.fn();
        this.createAnchor = jest.fn();
        this.getHitTestResults = jest.fn();
        this.getHitTestResultsForTransientInput = jest.fn();
        this.getJointPose = jest.fn();
    }
    getDepthInformation(view) {
        throw new Error("Method not implemented.");
    }
}
//# sourceMappingURL=XREntity.test.js.map