Planning (the Design canvas' Plan and GridToday, ideas from azedler/roadplanner): a stop's type as its NPS pictogram (marker and list), notes on the trip, its days and stops, + on a leg inserts the next point there; a parking spot per stop (P marker, the route goes there, the walk shown); a link pasted into the search becomes a place (/api/link: the URL's coordinates, else the page's geo meta / JSON-LD / a map link; public addresses only, logged in), added on the leg it lengthens least; avoids for the trip (+ ferries, unpaved) or a day (routed in pieces, joined); Check and Costs folds in the Route panel (no leave time, long days, arriving after sunset, long walks, missing vignettes; fuel from km × consumption × price, stop costs / paid, the budget); Today in drive mode's Menu (stops left, tonight, sunset, Open-Meteo weather, the day's notes, Skip next, Tomorrow). Plugins along the trip's route (Maptool::Corridor, a corridor width; Overpass around:) and plugin settings saved server-side; p4n via a host Firefox's cookies (docs/deployment.adoc). The recording's days (cut where the car stood ≥ 4 h, or by hand) and their export (days, a piece A–B, the whole trip; GPX with times). Track replay in the GNSS simulator. Step advance 5 m past a maneuver. The level gauge (drive mode, from Terrain): lift per wheel to the ramps' steps from roll, pitch, wheelbase and track
This commit is contained in:
1 parent
5e31dfaba9
commit
87d7bd2463
36 files changed
+2047
-123
No files matched your search
+43
-1
@@ -499,7 +499,7 @@ class AppTest < Minitest::Test
|
||||
def test_plugins_lists_whatever_is_on_disk
|
||||
response = request.get("/api/plugins")
|
||||
assert_equal 200, response.status
|
||||
assert_equal [{ "name" => "test-plugin", "label" => "Test plugin" }], json_body(response)
|
||||
assert_equal [{ "name" => "test-plugin", "label" => "Test plugin", "route" => false, "settings" => [], "set" => [] }], json_body(response)
|
||||
end
|
||||
|
||||
def test_plugins_run_imports_the_output_into_a_folder_of_its_own
|
||||
@@ -516,6 +516,22 @@ class AppTest < Minitest::Test
|
||||
assert_equal "Test POI", saved["features"][0]["properties"]["name"]
|
||||
end
|
||||
|
||||
# Along the trip's route: what lies further off than the corridor dropped.
|
||||
def test_plugins_run_along_the_route_keeps_the_corridor
|
||||
store = Maptool::App::TRIP_STORE
|
||||
saved = store.instance_variable_get(:@trip)
|
||||
run = lambda do |line|
|
||||
store.instance_variable_set(:@trip, saved.merge(route: { geometry: { coordinates: line } }))
|
||||
json_body(request.post("/api/plugins/test-plugin/run", params: { route: "1", corridor_km: "2" }, **logged_in_env))["count"]
|
||||
end
|
||||
assert_equal 1, run.([[17.0, 47.99], [17.1, 47.99]]) # the POI ~1.1 km off
|
||||
assert_equal 0, run.([[17.0, 47.95], [17.1, 47.95]]) # ~5.6 km off
|
||||
store.instance_variable_set(:@trip, saved.merge(route: nil))
|
||||
assert_equal 422, request.post("/api/plugins/test-plugin/run", params: { route: "1", corridor_km: "2" }, **logged_in_env).status
|
||||
ensure
|
||||
store.instance_variable_set(:@trip, saved)
|
||||
end
|
||||
|
||||
def test_plugins_run_requires_a_bbox
|
||||
response = request.post("/api/plugins/test-plugin/run", **logged_in_env)
|
||||
assert_equal 400, response.status
|
||||
@@ -696,6 +712,32 @@ class AppTest < Minitest::Test
|
||||
latest.clear
|
||||
end
|
||||
|
||||
# The recording's days and its export: a GPX with a track per day, or a .zip.
|
||||
def test_trip_log_days_and_export
|
||||
log = Maptool::App::TRIP_LOG
|
||||
log.stop
|
||||
assert_equal 200, request.post("/api/trip/log", input: JSON.generate(name: "Export test"), "CONTENT_TYPE" => "application/json", **logged_in_env).status
|
||||
t0 = Time.new(2026, 12, 1, 10).to_f
|
||||
10.times { |i| log.record(17.0, 48.0 + i * 0.001, 100.0, t0 + i * 60) }
|
||||
10.times { |i| log.record(17.0, 48.1 + i * 0.001, 100.0, t0 + 10 * 3600 + i * 60) } # stood 10 h
|
||||
log.record(17.0, 48.2, 100.0, t0 + 11 * 3600)
|
||||
|
||||
days = json_body(request.get("/api/trip/log/days?track=1", **logged_in_env))
|
||||
assert_equal [true, 2, "auto"], [days["active"], days["days"].size, days["days"][0]["cut"]["kind"]]
|
||||
assert_equal 21, days["track"].size
|
||||
gpx = request.get("/api/trip/log/export?pauses=1", **logged_in_env)
|
||||
assert_equal 2, gpx.body.scan("<trk>").size
|
||||
assert_includes gpx.body, "Stood "
|
||||
one = request.get("/api/trip/log/export?days=2", **logged_in_env).body
|
||||
assert_equal 1, one.scan("<trk>").size
|
||||
zip = request.get("/api/trip/log/export?per_day=1", **logged_in_env)
|
||||
assert_equal "application/zip", zip.content_type
|
||||
assert_equal 200, request.post("/api/trip/log/days", input: JSON.generate(join: days["track"][10][2]), "CONTENT_TYPE" => "application/json", **logged_in_env).status
|
||||
assert_equal 1, json_body(request.get("/api/trip/log/days", **logged_in_env))["days"].size
|
||||
ensure
|
||||
log.stop
|
||||
end
|
||||
|
||||
# A tunnel: no fix for a while, the position carried along the trip's
|
||||
# route — at the average speed it was entered at, by the CAN speed when there is one.
|
||||
def test_no_fix_on_the_route_is_dead_reckoned_along_it
|
||||
|
||||
Reference in new issue
Block a user