Profile: 1/5/10 km splits or laps (FIT/TCX) shaded in the charts, in the table and as numbered posts on the map; tooltip follows the pointer over the plots only
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 17s

This commit is contained in:
randy committed 2026-11-17 16:47:22 +01:00
1 parent 3e487539bc
commit 38368fc801
9 files changed
+292 -101

No files matched your search

+14
View File
@@ -101,6 +101,20 @@ class FitTest < Minitest::Test
assert_equal "cycling", geojson["features"][0]["properties"]["activity_type"]
end
def test_laps_are_the_first_record_index_of_each_lap
record_def = [0b01000000, 0, 0, 20, 3].pack("CCCS<C") + [253, 4, 0x86, 0, 4, 0x85, 1, 4, 0x85].pack("C*")
lap_def = [0b01000001, 0, 0, 19, 1].pack("CCCS<C") + [2, 4, 0x86].pack("C*")
body = record_def + lap_def
body << [0b00000001].pack("C") << le32(1000) # lap 1 starts at t=1000
body << [0b00000001].pack("C") << le32(1002) # lap 2 at t=1002
4.times { |i| body << [0].pack("C") << le32(1000 + i) << le32(100_000_000 + i * 1000) << le32(200_000_000) }
path = File.join(Dir.mktmpdir, "laps.fit")
File.binwrite(path, [12, 16, 0, 0].pack("C2S<") + le32(body.bytesize) + ".FIT" + body + "\x00\x00")
assert_equal [0, 2], Maptool::Fit.to_geojson(path)["features"][0]["properties"]["laps"]
assert_nil Maptool::Fit.to_geojson(write_fit([[1, 2], [3, 4]]))["features"][0]["properties"]["laps"]
end
def test_activity_type_is_nil_without_a_session_message
path = write_activity_fit([{ lat: 100_000_000, lon: 200_000_000 }])
geojson = Maptool::Fit.to_geojson(path)