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

+17
View File
@@ -158,4 +158,21 @@ class FitTest < Minitest::Test
assert_equal 0, Maptool::FitCourse.send(:crc, bytes)
assert_equal 0xBB3D, Maptool::FitCourse.send(:crc, "123456789")
end
def test_a_fit_course_carries_its_points_as_course_points
coordinates = [[17.1, 48.1], [17.11, 48.11], [17.12, 48.1]]
points = [{ coordinate: [17.12, 48.1001], name: "Summit cross with a long name", hint: "summit" }, { coordinate: [17.1101, 48.11], name: "Spring", hint: "Spring water" }]
bytes = Maptool::FitCourse.encode(coordinates, name: "Loop", points: points)
path = File.join(Dir.mktmpdir, "course.fit")
File.binwrite(path, bytes)
assert_equal 3, Maptool::Fit.to_geojson(path)["features"][0]["geometry"]["coordinates"][0].size # still parses
assert_equal 0, Maptool::FitCourse.send(:crc, bytes)
# course_point data: message_index, timestamp, lat, lon, distance, type, name — in order along the line
spring = bytes.index("Spring")
summit = bytes.index("Summit cross wi\0")
assert spring < summit
assert_equal 3, bytes.getbyte(spring - 1) # water
assert_equal 1, bytes.getbyte(summit - 1) # summit
end
end