Tracks and routes as containers of points: listed (collapsed) under them in the tree, added via a point's popup, a new note or the route planner's navigation pins, and written as course points into the FIT course
CI / check (push) Successful in 18s
CI / deploy (push) Successful in 18s

This commit is contained in:
randy committed 2026-11-18 12:39:04 +01:00
1 parent 6aa7b34f92
commit 4265421457
10 files changed
+354 -20

No files matched your search

+16
View File
@@ -177,6 +177,22 @@ class LibraryTest < Minitest::Test
assert_raises(Maptool::Library::NotFound) { library.export_gpx("nope") }
end
def test_points_added_to_a_track_live_in_it
library = open_library
key = library.import(folder: "trips", filename: "ride.gpx", io: File.open(fixture_path("sample.gpx"))).find { |k| k.start_with?("item:") }
before = library.tree["children"][0]["children"].find { |n| n["path"] == key }["points"].to_a.size
id = library.add_point(key, { "type" => "Feature", "geometry" => { "type" => "Point", "coordinates" => [17.1, 48.1] }, "properties" => { "name" => "Spring", "id" => "x" } })
node = library.tree["children"][0]["children"].find { |n| n["path"] == key }
assert_equal before + 1, node["points"].size
assert_includes node["points"], { "id" => id, "name" => "Spring", "coordinates" => [17.1, 48.1] }
assert_includes JSON.parse(library.geojson(key))["features"].map { |f| f["properties"]["name"] }, "Spring"
assert_raises(Maptool::Library::InvalidValue) { library.add_point(key, { "geometry" => { "type" => "LineString", "coordinates" => [] } }) }
library.delete_feature(key, id)
assert_equal before, library.tree["children"][0]["children"].find { |n| n["path"] == key }["points"].to_a.size
end
def test_reparse_rereads_old_profiles_once_and_keeps_the_name
library = open_library
key = library.import(folder: "", filename: "ride.gpx", io: File.open(fixture_path("sample.gpx"))).find { |k| k.start_with?("item:") }