"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const core_2 = require("@vived/core");
const Stickable_1 = require("../../Stick/Entities/Stickable");
const Transform3D_1 = require("../../Transform3D/Entities/Transform3D");
const Entities_1 = require("../Entities");
const ModelObjectsAreStickablePM_1 = require("./ModelObjectsAreStickablePM");
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, ModelObjectsAreStickablePM_1.makeModelObjectsAreStickablePM)(ao);
    const modelObject1 = channelModel.addModelObject("modelId1");
    const modelObject2 = channelModel.addModelObject("modelId2");
    const sm1Transform = Transform3D_1.Transform3D.addIfMissing(modelObject1.appObject);
    const sm2Transform = Transform3D_1.Transform3D.addIfMissing(modelObject2.appObject);
    (0, Stickable_1.makeStickableEntity)(modelObject1.appObject);
    (0, Stickable_1.makeStickableEntity)(modelObject2.appObject);
    sm1Transform.addChangeObserver(modelObject1.notifyOnChange);
    sm2Transform.addChangeObserver(modelObject2.notifyOnChange);
    return { appObj, appObjects, pm, sm1Transform, sm2Transform };
}
describe("Model Objects are are stickable 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 position", () => {
        const { pm, sm1Transform } = makeTestRig();
        expect(pm.lastVM).toEqual(false);
        sm1Transform.localPosition = new core_2.Vector3(1, 2, 3);
        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=ModelObjectsAreStickablePM.test.js.map