From be2eee469ead849b5363e7fe3b1f2c9dc56a420b Mon Sep 17 00:00:00 2001 From: Nessar Date: Fri, 27 Nov 2026 12:15:20 +0100 Subject: [PATCH] Address review: ring structural test, doc fixes, kit icon_assets! macro (#141) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hovering the icon leaves the cached ring unrendered (asserted in the grid test). performance.md opens « Statistiques » by the chart icon, and interface.md no longer claims the icon leaves the text untouched in a narrow window. The chart icon comes from gpui_kit::assets::icon_assets!, so the vendored SVG and Lucide license are removed. Co-Authored-By: Claude Opus 5.5 --- crates/app/assets/Lucide-LICENSE.txt | 15 --------------- crates/app/assets/chart-line.svg | 14 -------------- crates/app/src/assets.rs | 19 +++++++++---------- crates/app/src/page/tests/grid.rs | 5 ++++- docs/interface.md | 2 +- docs/performance.md | 2 +- 6 files changed, 15 insertions(+), 42 deletions(-) delete mode 100644 crates/app/assets/Lucide-LICENSE.txt delete mode 100644 crates/app/assets/chart-line.svg diff --git a/crates/app/assets/Lucide-LICENSE.txt b/crates/app/assets/Lucide-LICENSE.txt deleted file mode 100644 index b70071e..0000000 --- a/crates/app/assets/Lucide-LICENSE.txt +++ /dev/null @@ -1,15 +0,0 @@ -ISC License - -Copyright (c) 2026 Lucide Icons and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/crates/app/assets/chart-line.svg b/crates/app/assets/chart-line.svg deleted file mode 100644 index e5fc87c..0000000 --- a/crates/app/assets/chart-line.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - diff --git a/crates/app/src/assets.rs b/crates/app/src/assets.rs index 656d229..f398fe9 100644 --- a/crates/app/src/assets.rs +++ b/crates/app/src/assets.rs @@ -1,30 +1,27 @@ //! The app's asset source: the kit's default bundle, plus the one Lucide icon it does not -//! embed (`chart-line`, ISC, see `assets/Lucide-LICENSE.txt`). `AllAssets` would embed the whole -//! catalog for this one icon. +//! embed (`chart-line`). `AllAssets` would embed the whole catalog for this one icon. use std::borrow::Cow; use gpui_kit::{AssetSource, Result, SharedString}; -const CHART_LINE: &str = "icons/chart-line.svg"; +gpui_kit::assets::icon_assets!(ExtraIcons, [ChartLine]); pub struct Assets; impl AssetSource for Assets { fn load(&self, path: &str) -> Result>> { - if path == CHART_LINE { - return Ok(Some(Cow::Borrowed(include_bytes!( - "../assets/chart-line.svg" - )))); + if let Some(bytes) = ExtraIcons.load(path)? { + return Ok(Some(bytes)); } gpui_kit::assets::Assets.load(path) } fn list(&self, path: &str) -> Result> { let mut paths = gpui_kit::assets::Assets.list(path)?; - if CHART_LINE.starts_with(path) { - paths.push(CHART_LINE.into()); - } + paths.extend(ExtraIcons.list(path)?); + paths.sort(); + paths.dedup(); Ok(paths) } } @@ -33,6 +30,8 @@ impl AssetSource for Assets { mod tests { use super::*; + const CHART_LINE: &str = "icons/chart-line.svg"; + #[test] fn serves_chart_line_and_delegates_the_rest() { assert!(matches!(Assets.load(CHART_LINE), Ok(Some(_)))); diff --git a/crates/app/src/page/tests/grid.rs b/crates/app/src/page/tests/grid.rs index fca54da..132037a 100644 --- a/crates/app/src/page/tests/grid.rs +++ b/crates/app/src/page/tests/grid.rs @@ -1,3 +1,4 @@ +use super::banner_fixtures::ring_renders; use super::page_fixtures::{ center, champions, count_hovers, draw, grid_names, open_page_in_season, settle, show, statistics, switch_tab, @@ -193,8 +194,9 @@ fn hovering_outside_the_grid_does_not_render_the_cards(cx: &mut TestAppContext) let grid = page.read_with(cx, |page, _| page.home_grid.clone()); let renders = grid.read_with(cx, |grid, _| grid.renders); assert!(renders > 0); + let ring = ring_renders(&page, cx); - // A navigation button's hover style redraws the window. + // A navigation button's hover style redraws the window (the icon from where no tick is lit). for _ in 0..2 { let button = center(cx, "statistics-link"); cx.simulate_mouse_move(button, None, Modifiers::none()); @@ -203,6 +205,7 @@ fn hovering_outside_the_grid_does_not_render_the_cards(cx: &mut TestAppContext) draw(cx); } assert_eq!(grid.read_with(cx, |grid, _| grid.renders), renders); + assert_eq!(ring_renders(&page, cx), ring); // The count does move when the grid changes. grid.update(cx, |_, cx| cx.notify()); diff --git a/docs/interface.md b/docs/interface.md index f9e95d9..5405099 100644 --- a/docs/interface.md +++ b/docs/interface.md @@ -56,7 +56,7 @@ Cette section décrit l’identité « L’Anneau ». [La page de référence](p **Police.** Unbounded est embarquée et réservée au nom de l’appli, aux titres et au compteur. Tout le reste reste en Inter. -**Bannière d’accueil.** Un surtitre (la Saison), un titre-compteur, les deux lignes du critère 2 et l’anneau, sur l’illustration du champion de la Partie enregistrée la plus récente de la Saison affichée, tous Formats confondus : celle de la ligne « Dernière Partie » (aucune illustration sans Partie dans la Saison). Dans le coin inférieur droit de la bannière, sur l’illustration, une icône de courbe (« Statistiques » en bulle de survol) ouvre la page « Statistiques » (voir plus bas) ; elle est posée dans les marges de la bannière, sans déplacer le texte ni l’anneau ni changer la hauteur de la bannière, à la même place dans une fenêtre étroite (anneau au-dessus du texte) ; la bannière de sélection et celle de « En partie » n’ont pas cette icône. Sans champion validé, la première ligne devient « Aucun champion validé pour l’instant. ». +**Bannière d’accueil.** Un surtitre (la Saison), un titre-compteur, les deux lignes du critère 2 et l’anneau, sur l’illustration du champion de la Partie enregistrée la plus récente de la Saison affichée, tous Formats confondus : celle de la ligne « Dernière Partie » (aucune illustration sans Partie dans la Saison). Dans le coin inférieur droit de la bannière, sur l’illustration, une icône de courbe (« Statistiques » en bulle de survol) ouvre la page « Statistiques » (voir plus bas) ; elle est posée dans les marges de la bannière et ne déplace jamais le texte ni l’anneau, ni au survol ni au focus ; à la même place dans une fenêtre étroite (anneau au-dessus du texte), le texte y garde ses distances (une marge de 40 px à sa droite, si bien que les longues lignes y passent à la ligne plus tôt) ; la bannière de sélection et celle de « En partie » n’ont pas cette icône. Sans champion validé, la première ligne devient « Aucun champion validé pour l’instant. ». **Bannière de sélection.** Elle ouvre l’onglet « Sélection » pendant une sélection Arena ; « Défi » garde la bannière d’accueil. Son surtitre porte le compteur, son titre est « Sélection des champions », et sa ligne indique « Champions de l’Enclume · k à valider et disponibles ». Seules les graduations des Champions de l’Enclume y restent vives. L’illustration suit la carte survolée ; au repos, c’est celle du premier Champion de l’Enclume à valider et disponible. La barre du haut n’affiche pas d’autre indicateur de sélection que l’onglet « Sélection ». diff --git a/docs/performance.md b/docs/performance.md index bf688eb..1c16fe2 100644 --- a/docs/performance.md +++ b/docs/performance.md @@ -55,7 +55,7 @@ GPUI and gpui-component are not modified to meet a budget: the app's own renderi The release benchmark runs these scenarios, in this order, on the reference machine (#32). Builds come from `scripts/prod build`, then `scripts/prod build --features profile`; each `arena-tracker.exe` is copied out of the target directory before the next build overwrites it, and started from that copy. `scripts/budget-probe.ps1` (from WSL: `powershell.exe -ExecutionPolicy Bypass -File scripts/budget-probe.ps1 `) reads the app's own counters (process CPU time, each thread's CPU time and context switches, process GPU time and memory), never system-wide ones, and drives the window with posted messages. - **Conditions.** Each probe prints the machine and the build first: check the CPU is the Ryzen 5 7640U and the build is the copy meant. The laptop is on mains power, the user is away (`info` prints the time since their last input) and no game runs; stop and wait otherwise. The data folder (`%APPDATA%\arena-tracker`) holds a Riot key, the imported Matches and the portraits: an empty page measures nothing. Each phase lasts under a minute; split a longer scenario into phases. -- **Idle, window visible (budget 2).** Start the release build, wait 30 s, `front`, then `cursor -X 0.5 -Y 0.012` (the real cursor still over the title). Run `sample -Seconds 30` twice on « Défi » and once on « Statistiques » (open it with `click` on the « Statistiques › » link at the end of the banner's Season line, its position read on a screenshot of the reference window; « Défi » is at `-X 0.03`). The budget is the process CPU; the table names each thread waking. The `IDLE cpu` line of the move and hover probes is not this budget: their ping thread wakes the UI thread hundreds of times per second. +- **Idle, window visible (budget 2).** Start the release build, wait 30 s, `front`, then `cursor -X 0.5 -Y 0.012` (the real cursor still over the title). Run `sample -Seconds 30` twice on « Défi » and once on « Statistiques » (open it with `click` on the chart icon in the banner's bottom-right corner, its position read on a screenshot of the reference window; « Défi » is at `-X 0.03`). The budget is the process CPU; the table names each thread waking. The `IDLE cpu` line of the move and hover probes is not this budget: their ping thread wakes the UI thread hundreds of times per second. - **Interactions (budget 1).** On « Défi »: the move probe with `-Seconds 20`, then `wheel -X 0.5 -Y 0.75 -Count 300` (300 steps down at 20 per second) and the same with `-Delta 120` back up. On « Statistiques »: the hover probe and the move probe, `-Seconds 20` each. Then again on the profile build, started with `ARENA_TRACKER_PROFILE`, noting the CSV's line count at each phase's start and end to cut it into phases. - **Minimised and hidden (budget 3).** `minimize`, wait 3 s, `sample -Seconds 30` twice; `restore`, then `close` (the window goes to the notification area, as `close_to_tray` is on), wait 3 s, `sample -Seconds 30`. Starting the app again shows the window again. On the profile build, the CSV shows no frame drawn during these phases. - **Memory, full page loaded (budget 4).** From a fresh start, wait 15 s, `front`; scroll the home grid to its end (`wheel -X 0.5 -Y 0.75 -Count 150`), open « Statistiques » and scroll the table to its end (`wheel -X 0.5 -Y 0.85 -Count 120`), wait 10 s, then `memory`. Run it twice. To split the memory, the profile build runs the same scenario with `ARENA_TRACKER_HIDE` set to `cards`, `banner`, then `table,cards`.