mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Follow a replacement voice flight whatever its predecessor reports
A motion queued behind a voice fly-to now follows a later fly-to in the same reply whether the earlier one arrived, was cancelled or failed. A geocode that loses navigation reports failed, so the motion used to be dropped; and a flight left flying while the next place is looked up could land and run the motion there, taking navigation and cancelling the newer flight. The deadline, abort and stale-reply checks still end the wait. pitchDeg -90 or -89 from a top-down view is now unchanged rather than a 1° tilt up, and the tilt tests' pitch loops are bounded.
This commit is contained in:
1 parent
eeb20d24e9
commit
44860df90e
4 files changed
+104
-6
No files matched your search
+11
-3
@@ -1302,9 +1302,17 @@ export function createGevActionRunner({
|
||||
runOptions.signal,
|
||||
deadline,
|
||||
);
|
||||
// A later fly-to in the same reply cancels this one: follow it to
|
||||
// where the camera lands, within the same deadline.
|
||||
while (status === 'cancelled' && voiceFlight !== flight && current()) {
|
||||
// A later fly-to in the same reply replaces this one: follow it to
|
||||
// where the camera lands, within the same deadline. Its status does
|
||||
// not matter. A geocode that loses navigation reports failed, and a
|
||||
// flight left flying while the next place is looked up can still
|
||||
// land; running there would take navigation and cancel the newer one.
|
||||
while (
|
||||
voiceFlight !== flight &&
|
||||
status !== 'aborted' &&
|
||||
status !== 'timeout' &&
|
||||
current()
|
||||
) {
|
||||
flight = voiceFlight;
|
||||
status = await waitForVoiceFlight(
|
||||
flight,
|
||||
|
||||
@@ -570,6 +570,71 @@ test('a motion follows a later fly-to in the same reply that cancels its flight'
|
||||
assert.equal(result.motion, 'orbit');
|
||||
});
|
||||
|
||||
test('a motion follows a later fly-to whose start cancels its geocode', async (t) => {
|
||||
t.after(() => interruptCameraMotion('test-cleanup'));
|
||||
const { viewer, styleManager } = tiltAfterFlightHarness();
|
||||
const searches = [];
|
||||
const runner = createGevActionRunner({
|
||||
viewer,
|
||||
styleManager,
|
||||
dataManager: { layers: new Map(), getAll: () => [] },
|
||||
searchNavigation: (_viewer, query, options) => new Promise((resolve) => {
|
||||
searches.push({ query, options, resolve });
|
||||
}),
|
||||
});
|
||||
const flyA = runner('fly_to_location', { query: 'Place A' });
|
||||
const moved = runner('move_camera', { motion: 'orbit' });
|
||||
const movedDone = settledYet(moved);
|
||||
const flyB = runner('fly_to_location', { query: 'Place B' });
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
// B takes navigation authority, so A's lookup comes back cancelled.
|
||||
searches[0].resolve({ cancelled: true });
|
||||
assert.equal((await flyA).cancelled, true);
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
assert.equal(movedDone(), false, 'the orbit must follow B, not drop');
|
||||
searches[1].resolve({ label: 'Place B', navigationMode: 'city-overview' });
|
||||
assert.equal((await flyB).ok, true);
|
||||
searches[1].options.onComplete();
|
||||
const result = await moved;
|
||||
assert.equal(result.ok, true);
|
||||
assert.equal(result.motion, 'orbit');
|
||||
});
|
||||
|
||||
test('a motion does not run at a flight that lands while the next place is looked up', async (t) => {
|
||||
t.after(() => interruptCameraMotion('test-cleanup'));
|
||||
const { viewer, styleManager, order, flights } = tiltAfterFlightHarness();
|
||||
const searches = [];
|
||||
const runner = createGevActionRunner({
|
||||
viewer,
|
||||
styleManager,
|
||||
dataManager: { layers: new Map(), getAll: () => [] },
|
||||
searchNavigation: (_viewer, query, options) => new Promise((resolve) => {
|
||||
searches.push({ query, options, resolve });
|
||||
}),
|
||||
});
|
||||
assert.equal((await runner('fly_to_location', { locationId: 'austin' })).ok, true);
|
||||
const moved = runner('move_camera', { motion: 'tilt', pitchDeg: -45 });
|
||||
const movedDone = settledYet(moved);
|
||||
const flyB = runner('fly_to_location', { query: 'Place B' });
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
// Deferred navigation leaves A flying while B is looked up, and A lands.
|
||||
const before = order.length;
|
||||
flights[0].complete();
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
assert.equal(movedDone(), false, 'the tilt must wait for B');
|
||||
assert.equal(
|
||||
order.slice(before).includes('cancel'),
|
||||
false,
|
||||
'the tilt must not take navigation and cancel B',
|
||||
);
|
||||
searches[0].resolve({ label: 'Place B', navigationMode: 'city-overview' });
|
||||
assert.equal((await flyB).ok, true);
|
||||
searches[0].options.onComplete();
|
||||
const result = await moved;
|
||||
assert.equal(result.ok, true);
|
||||
assert.equal(result.motion, 'tilt');
|
||||
});
|
||||
|
||||
test('a stale motion does not follow a newer reply\'s fly-to', async () => {
|
||||
const { viewer, styleManager, flights } = tiltAfterFlightHarness();
|
||||
const runner = createGevActionRunner({
|
||||
|
||||
Reference in new issue
Block a user