mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 08:42:21 +00:00
test(globe): pick round-trip and setTerrain checks in the contract suite
Two engine-neutral checks: pickPosition then worldToWindow lands within 1.5 px of the screen point (over New York, straight down and tilted; points with no surface are skipped, at least one must hit), and maps.setTerrain resolves for keyless terrain and rejects an unknown kind. The fake engine now rejects unknown terrain kinds, as both engines do. The Navara contract page shows OSM on keyless terrain before the suite, since depth picks need a drawn surface.
This commit is contained in:
1 parent
b65dbab709
commit
312ed416e9
2 files changed
+81
No files matched your search
@@ -24,6 +24,8 @@ const { cartesian2, cartesian3, cartographic, ellipsoid, math, matrix4 } = geo;
|
||||
const WGS84 = ellipsoid.WGS84;
|
||||
const RADII = WGS84.radii;
|
||||
const MAXIMUM_RADIUS = Math.max(RADII.x, RADII.y, RADII.z);
|
||||
// The terrain kinds the engines build themselves (src/maps/registry.js).
|
||||
const TERRAIN_KINDS = Object.freeze(['ellipsoid', 'keyless', 'world']);
|
||||
const DEFAULT_FLIGHT_SECONDS = 3;
|
||||
const DEFAULT_ZOOM_AMOUNT = 100000; // Cesium's camera.defaultZoomAmount
|
||||
const ZERO_RADIUS_SPHERE_RANGE = 100; // Cesium's MINIMUM_ZOOM
|
||||
@@ -845,6 +847,13 @@ export function createFakeEngine(options = {}) {
|
||||
},
|
||||
async setTerrain(source) {
|
||||
record('maps.setTerrain', [source]);
|
||||
// As the real engines: a prebuilt source or a known kind.
|
||||
const kind = source?.kind ?? source?.id;
|
||||
if (
|
||||
typeof source?.create !== 'function' &&
|
||||
!TERRAIN_KINDS.includes(kind)
|
||||
)
|
||||
throw new TypeError(`Unknown terrain source: ${kind}`);
|
||||
fake.maps.terrain = source;
|
||||
},
|
||||
async setPhotorealTiles(source) {
|
||||
|
||||
Reference in new issue
Block a user