Driving mode ("Drive": big buttons — follow, zoom, 2D/3D, night, route overview — the sidebar hidden); palettes instead of the inversion (the UI's greys onto --ui-*, MapLibre's controls too, night → Night, new ◑ Dusk); the navigated route magenta, the driven part dimmed; route progress only forward (locate near the last position first); rerouting on the server off its own GNSS (TripStore#follow), the browser's only without the shared trip; the overview map hidden while following in 3D; the topbar's items apart
This commit is contained in:
1 parent
12b4ac6725
commit
07a4d363ec
13 files changed
+520
-219
No files matched your search
@@ -1,5 +1,6 @@
|
||||
require_relative "test_helper"
|
||||
require "tmpdir"
|
||||
require "timeout"
|
||||
require_relative "../lib/maptool/trip"
|
||||
|
||||
class TripTest < Minitest::Test
|
||||
@@ -25,6 +26,29 @@ class TripTest < Minitest::Test
|
||||
end
|
||||
end
|
||||
|
||||
# Off the route while driving for 3 fixes: routed again from the position
|
||||
# to the points not reached yet (the first via passed: dropped).
|
||||
def test_following_reroutes_from_the_position_off_the_route
|
||||
Dir.mktmpdir do |dir|
|
||||
store = Maptool::TripStore.new(File.join(dir, "trip.json"))
|
||||
line = { geometry: { coordinates: [[17.0, 48.0], [17.1, 48.0], [17.2, 48.0]] }, properties: { legs_km: [7.44, 7.44] } }
|
||||
points = [{ lngLat: [17.0, 48.0] }, { lngLat: [17.1, 48.0] }, { lngLat: [17.2, 48.0] }]
|
||||
calls = []
|
||||
router = ->(locations, _vehicle, _avoid) { calls << locations; line }
|
||||
store.update(points: points, vehicle: nil, avoid: {}, editing: nil, &router)
|
||||
calls.clear
|
||||
|
||||
store.follow([17.15, 48.0], speed: 20, now: 0, &router) # on it, past the via
|
||||
3.times { |i| store.follow([17.15, 48.01], speed: 20, now: i + 1, &router) } # ~1.1 km off
|
||||
Timeout.timeout(5) { sleep 0.05 until store.get[:version] == 2 }
|
||||
assert_equal [[[17.15, 48.01], [17.2, 48.0]]], calls
|
||||
assert_equal "My position", store.get[:points][0][:name]
|
||||
|
||||
store.follow([17.15, 48.02], speed: 20, now: 5, &router) # within REROUTE_EVERY_S: nothing
|
||||
assert_equal 1, calls.size
|
||||
end
|
||||
end
|
||||
|
||||
def test_a_routing_error_is_kept_with_the_points_and_tried_again_next_time
|
||||
Dir.mktmpdir do |dir|
|
||||
store = Maptool::TripStore.new(File.join(dir, "trip.json"))
|
||||
|
||||
Reference in new issue
Block a user