mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-02 17:26:24 +00:00
fix(ci): decouple realtime presence and test Atlas fill indices
Bind the realtime activity port to the existing SessionsService at app startup to remove the domain import cycle. Check the Atlas mesh through its triangle indices because degenerate rings can leave vertices that never contribute to the fill.
This commit is contained in:
@@ -167,20 +167,15 @@ describe('densify', () => {
|
||||
describe('buildLayer', () => {
|
||||
const layer = buildLayer(SHAPES, 'countries', 100, (n) => 10 + n);
|
||||
|
||||
it('FE-ATLAS2-PAINT-507: fills a polygon with its hole, both parts of a multipolygon, and skips slivers and empty features', () => {
|
||||
const fid = Array.from(layer.fill.fid);
|
||||
// The square with its hole first, then the two parts; the sliver and the empty feature add nothing.
|
||||
// (How many vertices the cut adds along the edges is the builder's business, not this test's.)
|
||||
const firstOther = fid.indexOf(11);
|
||||
expect(firstOther).toBeGreaterThanOrEqual(8);
|
||||
expect(fid.slice(0, firstOther).every((v) => v === 10)).toBe(true);
|
||||
expect(fid.slice(firstOther).every((v) => v === 11)).toBe(true);
|
||||
expect(fid.length - firstOther).toBeGreaterThanOrEqual(8);
|
||||
expect(layer.fill.ll).toHaveLength(fid.length * 2);
|
||||
expect(layer.fill.ref).toHaveLength(fid.length * 2);
|
||||
expect(layer.fill.index.length % 3).toBe(0);
|
||||
expect(Math.min(...layer.fill.index)).toBe(0);
|
||||
expect(Math.max(...layer.fill.index)).toBe(fid.length - 1);
|
||||
it('FE-ATLAS2-PAINT-507: draws fill for every nondegenerate polygon part', () => {
|
||||
const { fid, index, ll, ref } = layer.fill;
|
||||
// A degenerate ring can contribute vertices, but no fill triangle may reference them.
|
||||
const drawnVertices = Array.from(new Set(index));
|
||||
expect(new Set(drawnVertices.map((vertex) => fid[vertex]))).toEqual(new Set([10, 11]));
|
||||
expect(new Set(drawnVertices.map((vertex) => Math.round(ref[vertex * 2] / RAD)))).toEqual(new Set([5, 21, 31]));
|
||||
expect(ll).toHaveLength(fid.length * 2);
|
||||
expect(ref).toHaveLength(fid.length * 2);
|
||||
expect(index.length % 3).toBe(0);
|
||||
});
|
||||
|
||||
it('FE-ATLAS2-PAINT-508: the hole stays empty and every vertex refers to the centre of its own outline', () => {
|
||||
|
||||
Reference in New Issue
Block a user