"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const OverlayColor_1 = require("../../OverlayColor");
const Entities_1 = require("../Entities");
const ModelObjectsHaveOverlayPM_1 = require("./ModelObjectsHaveOverlayPM");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const appObj = appObjects.getOrCreate("appObj");
    const ao = appObjects.getOrCreate("ChannelModel");
    const channelModel = (0, Entities_1.makeChannelModelEntity)(ao);
    const pm = (0, ModelObjectsHaveOverlayPM_1.makeModelObjectsHaveOverlayPM)(ao);
    const dm1 = channelModel.addModelObject("modelId");
    const dm2 = channelModel.addModelObject("modelId");
    const overlay1 = new OverlayColor_1.OverlayColor(dm1.appObject);
    const overlay2 = new OverlayColor_1.OverlayColor(dm2.appObject);
    overlay1.addChangeObserver(dm1.notifyOnChange);
    overlay2.addChangeObserver(dm2.notifyOnChange);
    return { appObj, appObjects, overlay2, pm, overlay1 };
}
describe("Model Objects have overlay PM", () => {
    it("Sets the last vm on construction", () => {
        const { pm } = makeTestRig();
        expect(pm.lastVM).not.toBeUndefined();
    });
    it("Updates the view when a dissectable mesh changes it's visibility", () => {
        const { pm, overlay2 } = makeTestRig();
        expect(pm.lastVM).toEqual(false);
        overlay2.overlayColor = OverlayColor_1.OverlayColorEnums.BLACK;
        expect(pm.lastVM).toEqual(true);
    });
    it("Compares the VMs", () => {
        const { pm } = makeTestRig();
        expect(pm.vmsAreEqual(true, true)).toEqual(true);
        expect(pm.vmsAreEqual(false, false)).toEqual(true);
        expect(pm.vmsAreEqual(false, true)).toEqual(false);
        expect(pm.vmsAreEqual(true, false)).toEqual(false);
    });
});
//# sourceMappingURL=ModelObjectsHaveOverlayPM.test.js.map