import { describe, it, expect } from 'vitest';
import { Container } from 'pixi.js';
import { IsoDepthLayer } from '../IsoDepthLayer';
describe('IsoDepthLayer', () => {
it('глубина точки = диагональ тайла', () => {
const layer = new IsoDepthLayer();
const v = new Container();
layer.add(v, 3, 4);
expect(v.zIndex).toBe(7);
layer.setDepth(v, 1, 1);
expect(v.zIndex).toBe(2);
});
it('глубина footprint = диагональ юго-восточного угла', () => {
const layer = new IsoDepthLayer();
const house = new Container();
layer.addRect(house, 2, 2, 3, 3); // юго-восточный угол (4, 4)
expect(house.zIndex).toBe(8);
const north = new Container();
layer.addRect(north, 2, 0, 1, 1); // герой к северу — под домом
const southwest = new Container();
layer.addRect(southwest, 2, 5, 1, 1); // у южной стены — стена перекрывает
const southeast = new Container();
layer.addRect(southeast, 4, 6, 1, 1); // перед южным углом — поверх дома
expect(north.zIndex).toBeLessThan(house.zIndex);
expect(southwest.zIndex).toBeLessThan(house.zIndex);
expect(southeast.zIndex).toBeGreaterThan(house.zIndex);
});
});