Files
arena-tracker/crates/app/src/page/tests/banner_link.rs
T
nessarandClaude Opus 5.5 1eebb86902 Call Riot through the relay, without a key (#149)
Every Riot call goes to {relay}/{routing value}{Riot path} and sends no
key. The relay's address is built in (arena-tracker.nessar.fr);
relay_url in config.toml replaces it for development. A riot_api_key
left by an older version is never read, and is written back on save.

The personal keys' local pacing is gone. An import waits out each
Retry-After as often as it comes (at least a second each time), and so
do Mastery requests. A 5xx is the service unavailable, with its own
banner; a 401/403 is a refusal, which for a timeline the Match itself
confirms before it is stored, so a key failing on the relay's side
stores no refused Death Recap.

The first-launch key prompt, the key field in « Paramètres » and the
Friend refusal's « Paramètres » button are removed; the follower starts
with the app. KeyForm, KeyStore and KeyEvent become SettingsForm,
SettingsStore and SettingsEvent. README, user guide and interface spec
no longer ask for a key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 13:44:58 +01:00

80 lines
3.0 KiB
Rust

use super::page_fixtures::{
champions, draw, open_page, open_page_with_tracker, season, show, statistics,
};
use arena_tracker_core::{RiotApi, Tracker};
use gpui_kit::{Bounds, Pixels, TestAppContext, VisualTestContext, px, size};
use std::path::Path;
fn bounds(cx: &mut VisualTestContext, id: &'static str) -> Bounds<Pixels> {
cx.debug_bounds(id).unwrap()
}
/// The icon sits in the banner's bottom-right corner, inside its padding (16 to 36 px a side,
/// 24 px under it), and covers none of the text.
fn assert_in_the_corner(cx: &mut VisualTestContext) {
let (link, banner) = (bounds(cx, "statistics-link"), bounds(cx, "banner"));
let right = banner.right() - link.right();
assert!(right >= px(15.) && right <= px(37.), "{link:?} {banner:?}");
assert!(
(banner.bottom() - link.bottom() - px(24.)).abs() < px(1.),
"{link:?} {banner:?}"
);
// A button of the icon's size, not a line of text.
assert!(
link.size.width < px(40.) && link.size.height < px(40.),
"{link:?}"
);
for id in ["banner-season", "no-season", "banner-title"] {
if let Some(text) = cx.debug_bounds(id) {
assert!(!link.intersects(&text), "{id} {text:?} {link:?}");
}
}
}
#[gpui::test]
fn the_icon_is_in_the_banners_bottom_right_corner_not_on_the_seasons_line(cx: &mut TestAppContext) {
let (page, cx) = super::page_fixtures::open_page_in_season(cx);
let cx = &mut { cx };
show(&page, cx, statistics(0, 170, champions(170)));
draw(cx);
assert_in_the_corner(cx);
// The Season's line keeps the height of its text, the link no longer sits on it.
let (link, season) = (bounds(cx, "statistics-link"), bounds(cx, "banner-season"));
assert!(season.size.height < px(20.), "{season:?}");
assert!(link.top() > season.bottom(), "{link:?} {season:?}");
}
#[gpui::test]
fn without_a_season_the_icon_is_in_the_corner_too(cx: &mut TestAppContext) {
let (_page, cx) = open_page(cx);
let cx = &mut { cx };
draw(cx);
assert!(cx.debug_bounds("no-season").is_some());
assert_in_the_corner(cx);
}
#[gpui::test]
fn in_a_narrow_window_the_icon_stays_in_the_corner_with_a_long_season(cx: &mut TestAppContext) {
let name =
"Saison très longue qui prend toute la largeur de la bannière étroite et plus encore";
let tracker = Tracker::open(Path::new(":memory:"), Box::new(RiotApi::new("", "europe")))
.unwrap()
.with_seasons(vec![season(name, 2020)]);
let (page, cx) = open_page_with_tracker(cx, tracker);
let cx = &mut { cx };
show(&page, cx, statistics(0, 170, champions(170)));
cx.simulate_resize(size(px(480.), px(800.)));
draw(cx);
assert_in_the_corner(cx);
}
#[gpui::test]
fn in_a_narrow_window_the_icon_is_in_the_corner_with_a_short_season(cx: &mut TestAppContext) {
let (page, cx) = super::page_fixtures::open_page_in_season(cx);
let cx = &mut { cx };
show(&page, cx, statistics(0, 170, champions(170)));
cx.simulate_resize(size(px(480.), px(800.)));
draw(cx);
assert_in_the_corner(cx);
}