maplibre-gl 6.1.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/readme.md +0 -2
- package/dist/maplibre-gl-dev.mjs +179 -190
- package/dist/maplibre-gl-dev.mjs.map +1 -1
- package/dist/maplibre-gl-shared-dev.mjs +869 -825
- package/dist/maplibre-gl-shared-dev.mjs.map +1 -1
- package/dist/maplibre-gl-shared.mjs +2 -2
- package/dist/maplibre-gl-shared.mjs.map +1 -1
- package/dist/maplibre-gl-worker-dev.mjs +14 -12
- package/dist/maplibre-gl-worker-dev.mjs.map +1 -1
- package/dist/maplibre-gl-worker.mjs +2 -2
- package/dist/maplibre-gl-worker.mjs.map +1 -1
- package/dist/maplibre-gl.css +1 -1
- package/dist/maplibre-gl.d.ts +24 -6
- package/dist/maplibre-gl.mjs +13 -13
- package/dist/maplibre-gl.mjs.map +1 -1
- package/package.json +10 -13
- package/src/data/bucket/fill_extrusion_bucket.test.ts +22 -0
- package/src/data/bucket/fill_extrusion_bucket.ts +16 -4
- package/src/data/bucket/round_polygon_corners.test.ts +159 -0
- package/src/data/bucket/round_polygon_corners.ts +121 -0
- package/src/data/bucket/symbol_bucket.test.ts +1 -1
- package/src/data/dem_data.test.ts +23 -23
- package/src/data/feature_position_map.test.ts +1 -1
- package/src/data/segment.test.ts +14 -14
- package/src/geo/bounds.test.ts +4 -4
- package/src/geo/lng_lat_bounds.test.ts +1 -1
- package/src/geo/projection/mercator_transform.test.ts +1 -1
- package/src/geo/projection/mercator_utils.test.ts +8 -8
- package/src/index.test.ts +7 -12
- package/src/render/glyph_manager.test.ts +6 -22
- package/src/render/painter.test.ts +2 -0
- package/src/render/painter.ts +7 -5
- package/src/render/subdivision.test.ts +22 -22
- package/src/render/terrain.test.ts +68 -34
- package/src/render/terrain.ts +69 -26
- package/src/source/canvas_source.test.ts +1 -1
- package/src/source/geojson_source.test.ts +5 -4
- package/src/source/geojson_source_diff.test.ts +2 -2
- package/src/source/geojson_worker_source.test.ts +9 -5
- package/src/source/image_source.test.ts +0 -3
- package/src/source/raster_dem_tile_source.test.ts +2 -2
- package/src/source/raster_tile_source.test.ts +15 -9
- package/src/source/rtl_text_plugin_main_thread.test.ts +14 -14
- package/src/source/source.test.ts +8 -8
- package/src/source/vector_tile_source.test.ts +1 -1
- package/src/source/vector_tile_worker_source.test.ts +7 -5
- package/src/source/worker.test.ts +1 -1
- package/src/source/worker_tile.test.ts +4 -2
- package/src/style/load_glyph_range.test.ts +8 -8
- package/src/style/load_sprite.test.ts +1 -1
- package/src/style/style.test.ts +36 -34
- package/src/style/style_layer/color_relief_style_layer.test.ts +1 -1
- package/src/style/style_layer/fill_extrusion_style_layer.ts +6 -3
- package/src/style/style_layer/raster_style_layer.test.ts +2 -2
- package/src/style/style_layer.test.ts +3 -50
- package/src/symbol/collision_index.test.ts +1 -1
- package/src/symbol/grid_index.test.ts +1 -1
- package/src/tile/terrain_tile_manager.test.ts +2 -2
- package/src/tile/tile_id.test.ts +5 -5
- package/src/tile/tile_manager.test.ts +85 -72
- package/src/tile/tile_manager_in_view_tiles.test.ts +2 -2
- package/src/ui/camera.test.ts +137 -134
- package/src/ui/control/geolocate_control.test.ts +6 -29
- package/src/ui/handler/dblclick_zoom.test.ts +2 -2
- package/src/ui/handler/scroll_zoom.test.ts +2 -0
- package/src/ui/handler_manager.test.ts +7 -7
- package/src/ui/hash.test.ts +1 -0
- package/src/ui/map.ts +28 -18
- package/src/ui/map_tests/map_basic.test.ts +11 -23
- package/src/ui/map_tests/map_calculate_camera_options.test.ts +6 -6
- package/src/ui/map_tests/map_events.test.ts +5 -5
- package/src/ui/map_tests/map_global_state.test.ts +3 -3
- package/src/ui/map_tests/map_images.test.ts +3 -3
- package/src/ui/map_tests/map_is_moving.test.ts +1 -1
- package/src/ui/map_tests/map_is_rotating.test.ts +1 -1
- package/src/ui/map_tests/map_layer.test.ts +2 -1
- package/src/ui/map_tests/map_options.test.ts +1 -5
- package/src/ui/map_tests/map_pitch.test.ts +6 -6
- package/src/ui/map_tests/map_refresh_tiles.test.ts +2 -2
- package/src/ui/map_tests/map_render.test.ts +1 -1
- package/src/ui/map_tests/map_set_lod_params.test.ts +1 -1
- package/src/ui/map_tests/map_style.test.ts +9 -1
- package/src/ui/map_tests/map_terrain.test.ts +20 -0
- package/src/ui/map_tests/map_zoom.test.ts +15 -15
- package/src/ui/marker.test.ts +7 -13
- package/src/ui/popup.test.ts +3 -3
- package/src/util/actor.test.ts +6 -6
- package/src/util/ajax.test.ts +27 -39
- package/src/util/browser.test.ts +7 -9
- package/src/util/create_tile_mesh.test.ts +2 -2
- package/src/util/dispatcher.test.ts +1 -1
- package/src/util/evented.test.ts +4 -1
- package/src/util/fast_maths.test.ts +4 -4
- package/src/util/image_request.test.ts +6 -4
- package/src/util/struct_array.test.ts +2 -2
- package/src/util/task_queue.test.ts +1 -1
- package/src/util/test/util.ts +1 -0
- package/src/util/time_control.test.ts +2 -2
- package/src/util/transferable_grid_index.test.ts +1 -1
- package/src/util/util.test.ts +27 -13
- package/src/util/verticalize_punctuation.test.ts +4 -4
- package/src/util/web_worker_transfer.test.ts +5 -5
- package/src/webgl/draw/draw_custom.test.ts +13 -13
- package/src/webgl/draw/draw_debug.test.ts +1 -1
- package/src/webgl/draw/draw_fill.test.ts +12 -12
- package/src/webgl/draw/draw_symbol.test.ts +16 -16
- package/src/webgl/program.ts +2 -0
- package/src/webgl/render_to_texture.test.ts +5 -5
- package/src/webgl/state.test.ts +1 -1
- package/src/webgl/texture.test.ts +3 -3
- package/src/webgl/vertex_buffer.test.ts +1 -1
- package/build/rolldown_plugins.ts +0 -18
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {describe, test, expect, vi
|
|
1
|
+
import {describe, test, expect, vi} from 'vitest';
|
|
2
2
|
import {OverscaledTileID} from '../../tile/tile_id.ts';
|
|
3
3
|
import {TileManager} from '../../tile/tile_manager.ts';
|
|
4
4
|
import {Tile} from '../../tile/tile.ts';
|
|
@@ -11,16 +11,16 @@ import {MercatorProjection} from '../../geo/projection/mercator_projection.ts';
|
|
|
11
11
|
import {type CustomRenderMethodInput} from '../../style/style_layer/custom_style_layer.ts';
|
|
12
12
|
import {expectToBeCloseToArray} from '../../util/test/util.ts';
|
|
13
13
|
|
|
14
|
-
vi.mock('../../render/painter');
|
|
15
|
-
vi.mock('../program');
|
|
16
|
-
vi.mock('../../tile/tile_manager');
|
|
17
|
-
vi.mock('../../tile/tile');
|
|
18
|
-
vi.mock('../../data/bucket/symbol_bucket', () => {
|
|
14
|
+
vi.mock(import('../../render/painter'));
|
|
15
|
+
vi.mock(import('../program'));
|
|
16
|
+
vi.mock(import('../../tile/tile_manager'));
|
|
17
|
+
vi.mock(import('../../tile/tile'));
|
|
18
|
+
vi.mock(import('../../data/bucket/symbol_bucket'), () => {
|
|
19
19
|
return {
|
|
20
20
|
SymbolBucket: vi.fn()
|
|
21
|
-
};
|
|
21
|
+
} as any;
|
|
22
22
|
});
|
|
23
|
-
vi.mock('../../symbol/projection');
|
|
23
|
+
vi.mock(import('../../symbol/projection'));
|
|
24
24
|
|
|
25
25
|
describe('drawCustom', () => {
|
|
26
26
|
test('should return custom render method inputs', () => {
|
|
@@ -53,7 +53,7 @@ describe('drawCustom', () => {
|
|
|
53
53
|
bind: () => { }
|
|
54
54
|
} as any;
|
|
55
55
|
const tileManagerMock = new TileManager(null, null, null);
|
|
56
|
-
(tileManagerMock.getTile
|
|
56
|
+
(vi.mocked(tileManagerMock.getTile)).mockReturnValue(tile);
|
|
57
57
|
tileManagerMock.map = {showCollisionBoxes: false} as any as Map;
|
|
58
58
|
|
|
59
59
|
let result: {
|
|
@@ -82,10 +82,10 @@ describe('drawCustom', () => {
|
|
|
82
82
|
expectToBeCloseToArray(result.args.defaultProjectionData.tileMercatorCoords, [0, 0, 1, 1]);
|
|
83
83
|
expect(result.args.defaultProjectionData.mainMatrix).toBeInstanceOf(Float64Array);
|
|
84
84
|
expect(result.args.defaultProjectionData.fallbackMatrix).toBeInstanceOf(Float64Array);
|
|
85
|
-
expect(result.args.defaultProjectionData.mainMatrix[0]).
|
|
86
|
-
expect(result.args.defaultProjectionData.mainMatrix[5]).
|
|
85
|
+
expect(result.args.defaultProjectionData.mainMatrix[0]).toBe(1536);
|
|
86
|
+
expect(result.args.defaultProjectionData.mainMatrix[5]).toBe(-1512.6647086267515);
|
|
87
87
|
expect(result.args.defaultProjectionData.mainMatrix[15]).toEqual(794.4539334827342);
|
|
88
|
-
expect(result.args.defaultProjectionData.projectionTransition).
|
|
88
|
+
expect(result.args.defaultProjectionData.projectionTransition).toBe(0);
|
|
89
89
|
expect(result.args.defaultProjectionData.mainMatrix).toEqual(result.args.defaultProjectionData.fallbackMatrix);
|
|
90
90
|
const tileProjectionData = result.args.getProjectionData({
|
|
91
91
|
tileID: {
|
|
@@ -103,7 +103,7 @@ describe('drawCustom', () => {
|
|
|
103
103
|
expect(tileProjectionData.mainMatrix[0]).toBeCloseTo(0.09375, 6);
|
|
104
104
|
expect(tileProjectionData.mainMatrix[5]).toBeCloseTo(-0.09232572466135025, 6);
|
|
105
105
|
expect(tileProjectionData.mainMatrix[15]).toBeCloseTo(794.4539184570312, 6);
|
|
106
|
-
expect(tileProjectionData.projectionTransition).
|
|
106
|
+
expect(tileProjectionData.projectionTransition).toBe(0);
|
|
107
107
|
expect(tileProjectionData.mainMatrix).toEqual(tileProjectionData.fallbackMatrix);
|
|
108
108
|
});
|
|
109
109
|
});
|
|
@@ -6,7 +6,7 @@ import {FillStyleLayer} from '../../style/style_layer/fill_style_layer.ts';
|
|
|
6
6
|
import {RasterStyleLayer} from '../../style/style_layer/raster_style_layer.ts';
|
|
7
7
|
import {selectDebugSource} from './draw_debug.ts';
|
|
8
8
|
|
|
9
|
-
vi.mock('../../style/style');
|
|
9
|
+
vi.mock(import('../../style/style'));
|
|
10
10
|
|
|
11
11
|
const zoom = 14;
|
|
12
12
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {describe, test, expect, vi
|
|
1
|
+
import {describe, test, expect, vi} from 'vitest';
|
|
2
2
|
import {mat4} from 'gl-matrix';
|
|
3
3
|
import {OverscaledTileID} from '../../tile/tile_id.ts';
|
|
4
4
|
import {TileManager} from '../../tile/tile_manager.ts';
|
|
@@ -18,17 +18,17 @@ import {type ProgramConfiguration, type ProgramConfigurationSet} from '../../dat
|
|
|
18
18
|
import type {ProjectionData} from '../../geo/projection/projection_data.ts';
|
|
19
19
|
import {createIdentityMat4f32} from '../../util/util.ts';
|
|
20
20
|
|
|
21
|
-
vi.mock('../../render/painter');
|
|
22
|
-
vi.mock('../program');
|
|
23
|
-
vi.mock('../../tile/tile_manager');
|
|
24
|
-
vi.mock('../../tile/tile');
|
|
21
|
+
vi.mock(import('../../render/painter'));
|
|
22
|
+
vi.mock(import('../program'));
|
|
23
|
+
vi.mock(import('../../tile/tile_manager'));
|
|
24
|
+
vi.mock(import('../../tile/tile'));
|
|
25
25
|
|
|
26
|
-
vi.mock('../../data/bucket/symbol_bucket', () => {
|
|
26
|
+
vi.mock(import('../../data/bucket/symbol_bucket'), () => {
|
|
27
27
|
return {
|
|
28
28
|
SymbolBucket: vi.fn()
|
|
29
|
-
};
|
|
29
|
+
} as any;
|
|
30
30
|
});
|
|
31
|
-
vi.mock('../../symbol/projection');
|
|
31
|
+
vi.mock(import('../../symbol/projection'));
|
|
32
32
|
|
|
33
33
|
describe('drawFill', () => {
|
|
34
34
|
test('should call programConfiguration.setConstantPatternPositions for transitioning fill-pattern', () => {
|
|
@@ -37,12 +37,12 @@ describe('drawFill', () => {
|
|
|
37
37
|
const layer: FillStyleLayer = constructMockLayer();
|
|
38
38
|
|
|
39
39
|
const programMock = new Program(null, null, null, null, null, null, null, null);
|
|
40
|
-
(painterMock.useProgram
|
|
40
|
+
(vi.mocked(painterMock.useProgram)).mockReturnValue(programMock);
|
|
41
41
|
|
|
42
42
|
const mockTile = constructMockTile(layer);
|
|
43
43
|
|
|
44
44
|
const tileManagerMock = new TileManager(null, null, null);
|
|
45
|
-
(tileManagerMock.getTile
|
|
45
|
+
(vi.mocked(tileManagerMock.getTile)).mockReturnValue(mockTile);
|
|
46
46
|
tileManagerMock.map = {showCollisionBoxes: false} as any as Map;
|
|
47
47
|
|
|
48
48
|
const renderOptions: RenderOptions = {isRenderingToTexture: false, isRenderingGlobe: false};
|
|
@@ -140,8 +140,8 @@ describe('drawFill', () => {
|
|
|
140
140
|
|
|
141
141
|
const bucketMock = constructMockBucket(layer);
|
|
142
142
|
|
|
143
|
-
(tile.getBucket
|
|
144
|
-
(tile.patternsLoaded
|
|
143
|
+
(vi.mocked(tile.getBucket)).mockReturnValue(bucketMock);
|
|
144
|
+
(vi.mocked(tile.patternsLoaded)).mockReturnValue(true);
|
|
145
145
|
return tile;
|
|
146
146
|
}
|
|
147
147
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {describe, test, expect, vi
|
|
1
|
+
import {describe, test, expect, vi} from 'vitest';
|
|
2
2
|
import {mat4} from 'gl-matrix';
|
|
3
3
|
import {OverscaledTileID} from '../../tile/tile_id.ts';
|
|
4
4
|
import {SymbolBucket} from '../../data/bucket/symbol_bucket.ts';
|
|
@@ -19,18 +19,18 @@ import {MercatorProjection} from '../../geo/projection/mercator_projection.ts';
|
|
|
19
19
|
import type {ProjectionData} from '../../geo/projection/projection_data.ts';
|
|
20
20
|
import {createIdentityMat4f32} from '../../util/util.ts';
|
|
21
21
|
|
|
22
|
-
vi.mock('../../render/painter');
|
|
23
|
-
vi.mock('../program');
|
|
24
|
-
vi.mock('../../tile/tile_manager');
|
|
25
|
-
vi.mock('../../tile/tile');
|
|
26
|
-
vi.mock('../../data/bucket/symbol_bucket', () => {
|
|
22
|
+
vi.mock(import('../../render/painter'));
|
|
23
|
+
vi.mock(import('../program'));
|
|
24
|
+
vi.mock(import('../../tile/tile_manager'));
|
|
25
|
+
vi.mock(import('../../tile/tile'));
|
|
26
|
+
vi.mock(import('../../data/bucket/symbol_bucket'), () => {
|
|
27
27
|
return {
|
|
28
28
|
SymbolBucket: vi.fn()
|
|
29
|
-
};
|
|
29
|
+
} as any;
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
vi.mock('../../symbol/projection');
|
|
33
|
-
(symbolProjection.getPitchedLabelPlaneMatrix
|
|
32
|
+
vi.mock(import('../../symbol/projection'));
|
|
33
|
+
(vi.mocked(symbolProjection.getPitchedLabelPlaneMatrix)).mockReturnValue(mat4.create());
|
|
34
34
|
|
|
35
35
|
function createMockTransform() {
|
|
36
36
|
return {
|
|
@@ -94,7 +94,7 @@ describe('drawSymbol', () => {
|
|
|
94
94
|
const tileId = new OverscaledTileID(1, 0, 1, 0, 0);
|
|
95
95
|
tileId.terrainRttPosMatrix32f = createIdentityMat4f32();
|
|
96
96
|
const programMock = new Program(null, null, null, null, null, null, null, null);
|
|
97
|
-
(painterMock.useProgram
|
|
97
|
+
(vi.mocked(painterMock.useProgram)).mockReturnValue(programMock);
|
|
98
98
|
const bucketMock = new SymbolBucket(null);
|
|
99
99
|
bucketMock.icon = {
|
|
100
100
|
programConfigurations: {
|
|
@@ -157,7 +157,7 @@ describe('drawSymbol', () => {
|
|
|
157
157
|
const tileId = new OverscaledTileID(1, 0, 1, 0, 0);
|
|
158
158
|
tileId.terrainRttPosMatrix32f = createIdentityMat4f32();
|
|
159
159
|
const programMock = new Program(null, null, null, null, null, null, null, null);
|
|
160
|
-
(painterMock.useProgram
|
|
160
|
+
(vi.mocked(painterMock.useProgram)).mockReturnValue(programMock);
|
|
161
161
|
const bucketMock = new SymbolBucket(null);
|
|
162
162
|
bucketMock.icon = {
|
|
163
163
|
programConfigurations: {
|
|
@@ -177,9 +177,9 @@ describe('drawSymbol', () => {
|
|
|
177
177
|
tile.imageAtlasTexture = {
|
|
178
178
|
bind: () => { }
|
|
179
179
|
} as any;
|
|
180
|
-
(tile.getBucket
|
|
180
|
+
(vi.mocked(tile.getBucket)).mockReturnValue(bucketMock);
|
|
181
181
|
const tileManagerMock = new TileManager(null, null, null);
|
|
182
|
-
(tileManagerMock.getTile
|
|
182
|
+
(vi.mocked(tileManagerMock.getTile)).mockReturnValue(tile);
|
|
183
183
|
tileManagerMock.map = {showCollisionBoxes: false} as any as Map;
|
|
184
184
|
painterMock.style = {
|
|
185
185
|
map: {},
|
|
@@ -224,7 +224,7 @@ describe('drawSymbol', () => {
|
|
|
224
224
|
const tileId = new OverscaledTileID(1, 0, 1, 0, 0);
|
|
225
225
|
tileId.terrainRttPosMatrix32f = createIdentityMat4f32();
|
|
226
226
|
const programMock = new Program(null, null, null, null, null, null, null, null);
|
|
227
|
-
(painterMock.useProgram
|
|
227
|
+
(vi.mocked(painterMock.useProgram)).mockReturnValue(programMock);
|
|
228
228
|
const bucketMock = new SymbolBucket(null);
|
|
229
229
|
bucketMock.icon = {
|
|
230
230
|
programConfigurations: {
|
|
@@ -244,9 +244,9 @@ describe('drawSymbol', () => {
|
|
|
244
244
|
tile.imageAtlasTexture = {
|
|
245
245
|
bind: () => { }
|
|
246
246
|
} as any;
|
|
247
|
-
(tile.getBucket
|
|
247
|
+
(vi.mocked(tile.getBucket)).mockReturnValue(bucketMock);
|
|
248
248
|
const tileManagerMock = new TileManager(null, null, null);
|
|
249
|
-
(tileManagerMock.getTile
|
|
249
|
+
(vi.mocked(tileManagerMock.getTile)).mockReturnValue(tile);
|
|
250
250
|
tileManagerMock.map = {showCollisionBoxes: false} as any as Map;
|
|
251
251
|
|
|
252
252
|
const renderOptions: RenderOptions = {isRenderingToTexture: false, isRenderingGlobe: false};
|
package/src/webgl/program.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {beforeEach, describe, test, expect, vi
|
|
1
|
+
import {beforeEach, describe, test, expect, vi} from 'vitest';
|
|
2
2
|
import {RenderToTexture} from './render_to_texture.ts';
|
|
3
3
|
import type {Painter, RTTObject} from '../render/painter.ts';
|
|
4
4
|
import type {LineStyleLayer} from '../style/style_layer/line_style_layer.ts';
|
|
@@ -155,8 +155,8 @@ describe('render to texture', () => {
|
|
|
155
155
|
tile.rttObjects[0] = obj;
|
|
156
156
|
|
|
157
157
|
const otherTileID = new OverscaledTileID(3, 0, 2, 2, 2);
|
|
158
|
-
(terrain.tileManager.getTerrainCoords
|
|
159
|
-
(painter.releaseRTT
|
|
158
|
+
(vi.mocked(terrain.tileManager.getTerrainCoords)).mockReturnValueOnce({[tile.tileID.key]: otherTileID});
|
|
159
|
+
(vi.mocked(painter.releaseRTT)).mockClear();
|
|
160
160
|
|
|
161
161
|
rtt.prepareForRender(style, 0);
|
|
162
162
|
|
|
@@ -218,7 +218,7 @@ describe('render to texture', () => {
|
|
|
218
218
|
|
|
219
219
|
test('should clear tile cache on source state update', () => {
|
|
220
220
|
const state = {revision: 0};
|
|
221
|
-
(style.tileManagers['maine'].getState
|
|
221
|
+
(vi.mocked(style.tileManagers['maine'].getState)).mockReturnValue(state as any);
|
|
222
222
|
|
|
223
223
|
tile.rttObjects[0] = {texture: {}, size: 512} as unknown as RTTObject;
|
|
224
224
|
tile.rttFingerprint = {maine: '923#0'};
|
|
@@ -289,7 +289,7 @@ describe('render to texture', () => {
|
|
|
289
289
|
}
|
|
290
290
|
} as any as Style;
|
|
291
291
|
|
|
292
|
-
(terrain.tileManager.getTerrainCoords
|
|
292
|
+
(vi.mocked(terrain.tileManager.getTerrainCoords)).mockClear();
|
|
293
293
|
rtt.prepareForRender(testStyle, 0);
|
|
294
294
|
|
|
295
295
|
expect(maineTileManager.getVisibleCoordinates).toHaveBeenCalledTimes(1);
|
package/src/webgl/state.test.ts
CHANGED
|
@@ -20,7 +20,7 @@ describe('Value classes', () => {
|
|
|
20
20
|
const v = new Constructor(context);
|
|
21
21
|
expect(v).toBeTruthy();
|
|
22
22
|
const currentV = v.get();
|
|
23
|
-
expect(
|
|
23
|
+
expect(currentV).not.toBeTypeOf('undefined');
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
test('set', () => {
|
|
@@ -15,7 +15,7 @@ describe('Texture', () => {
|
|
|
15
15
|
return new Context(createNullGL());
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
function
|
|
18
|
+
function expectPixelStoreState(context: Context): void {
|
|
19
19
|
expect(context.pixelStoreUnpack.current).toEqual(context.pixelStoreUnpack.default);
|
|
20
20
|
expect(context.pixelStoreUnpackFlipY.current).toEqual(context.pixelStoreUnpackFlipY.default);
|
|
21
21
|
expect(context.pixelStoreUnpackPremultiplyAlpha.current).toEqual(context.pixelStoreUnpackPremultiplyAlpha.default);
|
|
@@ -26,7 +26,7 @@ describe('Texture', () => {
|
|
|
26
26
|
// We test the Texture constructor's side effects
|
|
27
27
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
28
28
|
const _texture = new Texture(context, testImage, context.gl.RGBA, {premultiply: false});
|
|
29
|
-
|
|
29
|
+
expectPixelStoreState(context);
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
test('premultiply=true', () => {
|
|
@@ -34,7 +34,7 @@ describe('Texture', () => {
|
|
|
34
34
|
// We test the Texture constructor's side effects
|
|
35
35
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
36
36
|
const _texture = new Texture(context, testImage, context.gl.RGBA, {premultiply: true});
|
|
37
|
-
|
|
37
|
+
expectPixelStoreState(context);
|
|
38
38
|
});
|
|
39
39
|
});
|
|
40
40
|
|
|
@@ -71,7 +71,7 @@ describe('VertexBuffer', () => {
|
|
|
71
71
|
|
|
72
72
|
expect(array.arrayBuffer.byteLength).toBe(0);
|
|
73
73
|
expect(array.int16.buffer).not.toBe(originalBuffer);
|
|
74
|
-
expect(array.int16
|
|
74
|
+
expect(array.int16).toHaveLength(0);
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
test('dynamic buffer preserves StructArray data after upload', () => {
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {type Plugin} from 'rolldown';
|
|
2
|
-
import {visualizer} from 'rollup-plugin-visualizer';
|
|
3
|
-
|
|
4
|
-
const stats = process.env.BUNDLE === 'stats';
|
|
5
|
-
|
|
6
|
-
export const plugins = (_production: boolean): Plugin[] => stats
|
|
7
|
-
? (['treemap', 'sunburst', 'flamegraph', 'network'] as const).map(template =>
|
|
8
|
-
visualizer({
|
|
9
|
-
template,
|
|
10
|
-
title: `gl-js-${template}`,
|
|
11
|
-
filename: `staging/${template}.html`,
|
|
12
|
-
gzipSize: true,
|
|
13
|
-
brotliSize: true,
|
|
14
|
-
sourcemap: true,
|
|
15
|
-
open: true,
|
|
16
|
-
}) as unknown as Plugin
|
|
17
|
-
)
|
|
18
|
-
: [];
|