-
-
Notifications
You must be signed in to change notification settings - Fork 717
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [#4340] Fixes possible access to undefined object * CHANGELOG update * Adds the test
- Loading branch information
1 parent
c01e231
commit 52e7962
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import {TerrainSpecification} from '@maplibre/maplibre-gl-style-spec'; | ||
|
||
import {Painter} from './painter'; | ||
import {Transform} from '../geo/transform'; | ||
import {Style} from '../style/style'; | ||
import {Evented} from '../util/evented'; | ||
import {RequestManager} from '../util/request_manager'; | ||
|
||
class StubMap extends Evented { | ||
style: Style; | ||
transform: Transform; | ||
private _requestManager: RequestManager; | ||
_terrain: TerrainSpecification; | ||
|
||
constructor() { | ||
super(); | ||
this.transform = new Transform(); | ||
this._requestManager = new RequestManager(); | ||
} | ||
|
||
_getMapId() { | ||
return 1; | ||
} | ||
|
||
getPixelRatio() { | ||
return 1; | ||
} | ||
|
||
setTerrain(terrain) { this._terrain = terrain; } | ||
getTerrain() { return this._terrain; } | ||
} | ||
|
||
const getStubMap = () => new StubMap() as any; | ||
|
||
test('Render must not fail with incompletely loaded style', () => { | ||
const gl = document.createElement('canvas').getContext('webgl'); | ||
const transform = new Transform(0, 22, 0, 60, true); | ||
const painter = new Painter(gl, transform); | ||
const map = getStubMap(); | ||
const style = new Style(map); | ||
style._updatePlacement(transform, false, 0, false); | ||
painter.render(style, { | ||
fadeDuration: 0, | ||
moving: false, | ||
rotating: false, | ||
showOverdrawInspector: false, | ||
showPadding: false, | ||
showTileBoundaries: false, | ||
zooming: false, | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters