mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-09-22 00:02:23 +00:00
fix(assets): serve the chevron this repo draws, not the stock one
`assets/icons/chevrons-up-down.svg` is drawn to the weight every other glyph in that directory uses — `stroke-width="2.1"`, all twenty of them — but it was the one path missing from `agent_icon`, so it fell through to `gpui_component_assets` and the tab strip drew the stock 2.0 chevron beside neighbours a hair heavier. Nothing failed, which is why nothing said so. `every_git_icon_resolves` could not catch it: it walks three paths written out by hand, and its own comment names this exact risk — "an SVG on disk that nobody added to the match above silently renders as nothing". A list cannot notice the file it was never told about. So the new test reads `assets/icons` instead and requires every `.svg` in it to come back from `agent_icon`. Confirmed it fails without the arm this commit adds, naming the file. Found by checking shipped data rather than code — the same pass that turned up the newline descriptions in `assets/completions`.
This commit is contained in:
@@ -47,6 +47,9 @@ fn agent_icon(path: &str) -> Option<&'static [u8]> {
|
||||
"icons/machine-local.svg" => include_bytes!("../../assets/icons/machine-local.svg"),
|
||||
"icons/machine-remote.svg" => include_bytes!("../../assets/icons/machine-remote.svg"),
|
||||
"icons/refresh.svg" => include_bytes!("../../assets/icons/refresh.svg"),
|
||||
"icons/chevrons-up-down.svg" => {
|
||||
include_bytes!("../../assets/icons/chevrons-up-down.svg")
|
||||
}
|
||||
"icons/agents/claude.svg" => include_bytes!("../../assets/icons/agents/claude.svg"),
|
||||
"icons/agents/codex.svg" => include_bytes!("../../assets/icons/agents/codex.svg"),
|
||||
"icons/agents/gemini.svg" => include_bytes!("../../assets/icons/agents/gemini.svg"),
|
||||
@@ -98,6 +101,33 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
/// Reads the directory rather than a list, because a list is what let
|
||||
/// `chevrons-up-down.svg` sit here unserved: it was drawn to this repo's
|
||||
/// weight like every other glyph in `assets/icons`, and being absent from
|
||||
/// the match it fell through to the stock one, a hair lighter than its
|
||||
/// neighbours in the same row. Nothing failed, so nothing said so.
|
||||
#[test]
|
||||
fn every_icon_this_repo_ships_is_the_one_that_draws() {
|
||||
let dir = concat!(env!("CARGO_MANIFEST_DIR"), "/assets/icons");
|
||||
let mut checked = 0;
|
||||
for entry in std::fs::read_dir(dir).expect("assets/icons is readable") {
|
||||
let entry = entry.expect("a readable directory entry");
|
||||
let name = entry.file_name();
|
||||
let name = name.to_string_lossy();
|
||||
if !name.ends_with(".svg") {
|
||||
continue;
|
||||
}
|
||||
let path = format!("icons/{name}");
|
||||
assert!(
|
||||
agent_icon(&path).is_some(),
|
||||
"assets/icons/{name} ships but nothing serves it, so the stock \
|
||||
glyph draws in its place"
|
||||
);
|
||||
checked += 1;
|
||||
}
|
||||
assert!(checked > 15, "only {checked} icons were checked");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_git_icon_resolves() {
|
||||
// An SVG on disk that nobody added to the match above silently renders
|
||||
|
||||
Reference in New Issue
Block a user