mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-08-21 22:13:45 +08:00
clean
This commit is contained in:
@@ -55,4 +55,6 @@ class RadarTracks:
|
||||
continue
|
||||
|
||||
x, y = pt[0] + screen_offset[0], pt[1] + screen_offset[1]
|
||||
rl.draw_circle(int(x), int(y), track_size, radar_track_color(v_rel, v_ego))
|
||||
color = radar_track_color(v_rel, v_ego)
|
||||
neutral = (color.r, color.g, color.b) == NEUTRAL_COLOR
|
||||
rl.draw_circle(int(x), int(y), max(1, track_size - 2) if neutral else track_size, color)
|
||||
|
||||
@@ -91,3 +91,20 @@ def test_draw_radar_tracks_allows_unknown_acceleration(monkeypatch):
|
||||
radar_tracks.RadarTracks().draw_radar_tracks(live_tracks, lambda d_rel, y_rel, z: (20, 30), path_offset_z=1.2)
|
||||
|
||||
assert drawn_colors == [color_tuple(radar_track_color(-5))]
|
||||
|
||||
|
||||
def test_draw_radar_tracks_shrinks_neutral_dots(monkeypatch):
|
||||
live_tracks = car.RadarData.new_message()
|
||||
point = live_tracks.init("points", 1)[0]
|
||||
point.dRel = 10
|
||||
point.yRel = 1
|
||||
point.vRel = -20
|
||||
point.aRel = 0
|
||||
drawn_sizes = []
|
||||
monkeypatch.setattr(radar_tracks.rl, "draw_circle", lambda x, y, size, color: drawn_sizes.append(size))
|
||||
|
||||
radar_tracks.RadarTracks().draw_radar_tracks(
|
||||
live_tracks, lambda d_rel, y_rel, z: (20, 30), path_offset_z=1.2, track_size=5, v_ego=20,
|
||||
)
|
||||
|
||||
assert drawn_sizes == [3]
|
||||
|
||||
Reference in New Issue
Block a user