forked from maplibre/maplibre-gl-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathline_atlas.test.ts
38 lines (36 loc) · 1.19 KB
/
line_atlas.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import {LineAtlas} from './line_atlas';
describe('LineAtlas', () => {
const lineAtlas = new LineAtlas(64, 64);
test('round [0, 0]', () => {
const entry = lineAtlas.addDash([0, 0], true);
expect(entry.width).toBe(0);
});
test('round [1, 0]', () => {
const entry = lineAtlas.addDash([1, 0], true);
expect(entry.width).toBe(1);
});
test('round [0, 1]', () => {
const entry = lineAtlas.addDash([0, 1], true);
expect(entry.width).toBe(1);
});
test('odd round [1, 2, 1]', () => {
const entry = lineAtlas.addDash([1, 2, 1], true);
expect(entry.width).toBe(4);
});
test('regular [0, 0]', () => {
const entry = lineAtlas.addDash([0, 0], false);
expect(entry.width).toBe(0);
});
test('regular [1, 0]', () => {
const entry = lineAtlas.addDash([1, 0], false);
expect(entry.width).toBe(1);
});
test('regular [0, 1]', () => {
const entry = lineAtlas.addDash([0, 1], false);
expect(entry.width).toBe(1);
});
test('odd regular [1, 2, 1]', () => {
const entry = lineAtlas.addDash([1, 2, 1], false);
expect(entry.width).toBe(4);
});
});