mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
Release God's Eye View as open source
This commit is contained in:
1 parent
a5aaea7e16
commit
880a672b5e
433 files changed
+219893
-23
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import * as Cesium from 'cesium';
|
||||
import { createTrail } from './trailRenderer.js';
|
||||
|
||||
test('trail visibility can change without discarding its accumulated geometry', () => {
|
||||
const added = [];
|
||||
const removed = [];
|
||||
const viewer = {
|
||||
isDestroyed: () => false,
|
||||
entities: {
|
||||
add(definition) {
|
||||
added.push(definition);
|
||||
return definition;
|
||||
},
|
||||
remove(entity) {
|
||||
removed.push(entity);
|
||||
},
|
||||
},
|
||||
};
|
||||
const trail = createTrail(viewer, { color: '#ffffff' });
|
||||
const positions = [
|
||||
new Cesium.Cartesian3(1, 2, 3),
|
||||
new Cesium.Cartesian3(4, 5, 6),
|
||||
];
|
||||
|
||||
trail.setVisible(false);
|
||||
trail.setPositions(positions);
|
||||
assert.equal(added.length, 1);
|
||||
assert.equal(added[0].show, false);
|
||||
assert.deepEqual(added[0].polyline.positions.getValue(), positions);
|
||||
|
||||
trail.setVisible(true);
|
||||
assert.equal(added[0].show, true);
|
||||
assert.deepEqual(added[0].polyline.positions.getValue(), positions);
|
||||
|
||||
trail.destroy();
|
||||
assert.deepEqual(removed, [added[0]]);
|
||||
});
|
||||
Reference in new issue
Block a user