feat: 1:1 For You, My Collection, Concerts, Books & Podcasts, WordsCardFullscreen and release v0.1.2

This commit is contained in:
marwy 2026-11-27 14:29:09 +03:00
parent 8e7ec9142f
commit e9aa253f72
12 changed files with 4393 additions and 593 deletions

View file

@ -1863,3 +1863,384 @@ fn test_ext_16_yandex_id_popup_and_words_card_visual_parity() {
);
}
}
#[test]
fn test_ext_17_for_you_collection_concerts_words_fullscreen() {
use yandex_music_rs::api::models::{
AlbumSummary, ConcertItem, NewReleaseItem, VibePickItem, VibePickTab, WordsBigCard,
WordsCard, WordsCardSource,
};
use yandex_music_rs::engine::WidgetId;
let rt = tokio::runtime::Runtime::new().unwrap();
let mut vk = HeadlessVulkanRenderer::new(NATIVE_W, NATIVE_H).expect("Vulkan init failed");
let out_dir = output_dir();
let _ = std::fs::create_dir_all(&out_dir);
// 1. Official `For You` scrolled down: sticky frosted header + circular NewReleases + More Picks (`for_you_new_releases_picks.png`)
{
let mut shell = make_base_shell(
rt.handle().clone(),
vk.gpu_name.clone(),
Route::ForYou,
ThemeMode::Dark,
Language::En,
0.0,
);
let mk_album = |id: &str, title: &str, artist: &str| AlbumSummary {
id: id.into(),
title: title.into(),
year: Some(2026),
cover_uri: None,
artists: vec![ArtistSummary {
id: format!("art_{id}"),
name: artist.into(),
cover_uri: None,
genres: vec![],
}],
track_count: 12,
genre: Some("electronic".into()),
is_explicit: false,
content_type: Some("album".into()),
};
shell.app.landing.rich_new_releases = vec![
NewReleaseItem {
album: mk_album("nr1", "Neon Horizon", "SALUKI"),
artist_cover_uri: None,
cover_color: Some("#3B4CA8".into()),
release_date: Some("2026-11-20".into()),
},
NewReleaseItem {
album: mk_album("nr2", "Velvet Pulse", "Mirele"),
artist_cover_uri: None,
cover_color: Some("#7B2D5F".into()),
release_date: Some("2026-11-18".into()),
},
NewReleaseItem {
album: mk_album("nr3", "Night Drive", "SLAVA MARLOW"),
artist_cover_uri: None,
cover_color: Some("#1E6B52".into()),
release_date: Some("2026-11-15".into()),
},
NewReleaseItem {
album: mk_album("nr4", "Solar Flare", "OG BLESS"),
artist_cover_uri: None,
cover_color: Some("#8F4A1E".into()),
release_date: Some("2026-11-12".into()),
},
];
shell.app.landing.vibe_pick_tabs = vec![
VibePickTab {
title: "Mood".into(),
items: vec![
VibePickItem {
title: "Energetic".into(),
header: "Vibe".into(),
seeds: vec!["mood:energetic".into()],
color_hex: Some("#D94E2A".into()),
background_image_url: None,
image_url: None,
},
VibePickItem {
title: "Night Focus".into(),
header: "Vibe".into(),
seeds: vec!["mood:calm".into()],
color_hex: Some("#2F55A4".into()),
background_image_url: None,
image_url: None,
},
VibePickItem {
title: "Dreamy Synth".into(),
header: "Vibe".into(),
seeds: vec!["genre:electronic".into()],
color_hex: Some("#7C3AED".into()),
background_image_url: None,
image_url: None,
},
],
},
VibePickTab {
title: "Activity".into(),
items: vec![VibePickItem {
title: "Workout".into(),
header: "Vibe".into(),
seeds: vec!["activity:workout".into()],
color_hex: Some("#0F766E".into()),
background_image_url: None,
image_url: None,
}],
},
VibePickTab {
title: "Genres".into(),
items: vec![],
},
];
// Warm up layout so scroll content height is computed, then scroll to show New Releases + More Picks + sticky switcher
let _ = render_single_frame(&mut vk, &mut shell, 0.0);
let _ = render_single_frame(&mut vk, &mut shell, 0.016);
shell
.ui
.scrolls
.jump_to_y(WidgetId::new("foryou_page_scroll"), 860.0);
let _ = render_single_frame(&mut vk, &mut shell, 0.032);
let img = render_single_frame(&mut vk, &mut shell, 0.048);
let _ = img.save(out_dir.join("for_you_new_releases_picks.png"));
// Verify colored NewRelease cards / More Picks cards rendered non-flat rich pixels in content card
let mut colored_px = 0usize;
for y in 110..680 {
for x in 250..1240 {
let [r, g, b] = img.get_pixel(x, y).0;
let max_c = r.max(g).max(b);
let min_c = r.min(g).min(b);
if max_c.saturating_sub(min_c) >= 24 {
colored_px += 1;
}
}
}
assert!(
colored_px > 5_000,
"[for_you_new_releases_picks] Expected colored New Releases / More Picks cards, found only {} chromatic px",
colored_px
);
}
// 2. Official `My Collection` vertical feed (`my_collection_official.png`)
{
let mut shell = make_base_shell(
rt.handle().clone(),
vk.gpu_name.clone(),
Route::Collection,
ThemeMode::Dark,
Language::En,
0.0,
);
let extra_tracks = [
("c_1", "MONTAGEM TENTA", "KYOR", 141_000),
("c_2", "Midnight Sun", "SuperSolar", 184_000),
("c_3", "BANG A RANG", "GSTRNM", 100_000),
("c_4", "BOSS BITCH TEKK", "wharoxmane", 107_000),
("c_5", "Neon Rain", "Mirele", 192_000),
("c_6", "Skyline Pulse", "SALUKI", 168_000),
("c_7", "Electric Horizon", "SLAVA MARLOW", 155_000),
("c_8", "Deep Focus", "OG BLESS", 210_000),
];
shell.app.liked_tracks = extra_tracks
.iter()
.map(|(id, title, art, dur)| Track {
id: (*id).into(),
title: (*title).into(),
version: None,
artists: vec![ArtistSummary {
id: format!("ca_{id}"),
name: (*art).into(),
cover_uri: None,
genres: vec![],
}],
album_id: Some(format!("calb_{id}")),
album_title: Some((*title).into()),
duration_ms: *dur,
cover_uri: None,
is_explicit: false,
has_lossless: true,
has_lyrics: true,
chart_position: None,
chart_progress: None,
preview_url: None,
r128_i: None,
r128_tp: None,
derived_average_hex: None,
derived_accent_hex: None,
})
.collect();
shell.app.liked_artists = ["SALUKI", "Mirele", "KYOR", "SuperSolar", "GSTRNM", "OG BLESS"]
.iter()
.enumerate()
.map(|(i, name)| ArtistSummary {
id: format!("la_{i}"),
name: (*name).into(),
cover_uri: None,
genres: vec![],
})
.collect();
let _ = render_single_frame(&mut vk, &mut shell, 0.0);
let _ = render_single_frame(&mut vk, &mut shell, 0.016);
let img = render_single_frame(&mut vk, &mut shell, 0.032);
let _ = img.save(out_dir.join("my_collection_official.png"));
// Verify pink-magenta colored "color" word in subtitle + crimson 3D heart icon present,
// and ZERO old yellow-bordered My Favorites hero card!
let mut pink_subtitle_px = 0usize;
for y in 75..125 {
for x in 250..520 {
let [r, g, b] = img.get_pixel(x, y).0;
if r > 170 && b > 100 && (r as u16) > (g as u16) + 50 {
pink_subtitle_px += 1;
}
}
}
assert!(
pink_subtitle_px >= 15,
"[my_collection_official] Expected magenta-colored subtitle word 'color', found {} px",
pink_subtitle_px
);
}
// 3. Official `ConcertsPage` (`concerts_official.png`)
{
let mut shell = make_base_shell(
rt.handle().clone(),
vk.gpu_name.clone(),
Route::Concerts,
ThemeMode::Dark,
Language::Ru,
0.0,
);
shell.app.concerts = vec![
ConcertItem {
id: "con_1".into(),
title: "SALUKI — Большой сольный концерт".into(),
artist_name: "SALUKI".into(),
city: "Москва".into(),
place: "VK Stadium".into(),
date: "14 дек, 20:00".into(),
cover_uri: None,
afisha_url: Some("https://afisha.yandex.ru".into()),
min_price: Some(2500),
currency: Some("RUB".into()),
cashback_percent: Some(15),
cashback_title: Some("Кешбэк 15%".into()),
cover_color: Some("#4C2A85".into()),
event_kind: Some("concert".into()),
},
ConcertItem {
id: "con_2".into(),
title: "Mirele — Акустический вечер".into(),
artist_name: "Mirele".into(),
city: "Санкт-Петербург".into(),
place: "A2 Green Concert".into(),
date: "21 дек, 19:30".into(),
cover_uri: None,
afisha_url: Some("https://afisha.yandex.ru".into()),
min_price: Some(1900),
currency: Some("RUB".into()),
cashback_percent: Some(10),
cashback_title: None,
cover_color: Some("#1D5B79".into()),
event_kind: Some("concert".into()),
},
ConcertItem {
id: "con_3".into(),
title: "SLAVA MARLOW — Live Tour".into(),
artist_name: "SLAVA MARLOW".into(),
city: "Казань".into(),
place: "Korston Club Hotel".into(),
date: "28 дек, 20:00".into(),
cover_uri: None,
afisha_url: Some("https://afisha.yandex.ru".into()),
min_price: Some(2200),
currency: Some("RUB".into()),
cashback_percent: Some(20),
cashback_title: None,
cover_color: Some("#8C2F39".into()),
event_kind: Some("concert".into()),
},
ConcertItem {
id: "con_4".into(),
title: "Электрофорез — Зимний сет".into(),
artist_name: "Электрофорез".into(),
city: "Москва".into(),
place: "Урбан".into(),
date: "5 янв, 20:00".into(),
cover_uri: None,
afisha_url: Some("https://afisha.yandex.ru".into()),
min_price: Some(1700),
currency: Some("RUB".into()),
cashback_percent: Some(10),
cashback_title: None,
cover_color: Some("#2D4F1E".into()),
event_kind: Some("concert".into()),
},
];
let _ = render_single_frame(&mut vk, &mut shell, 0.0);
let _ = render_single_frame(&mut vk, &mut shell, 0.016);
let img = render_single_frame(&mut vk, &mut shell, 0.032);
let _ = img.save(out_dir.join("concerts_official.png"));
// Verify Top 3 colored poster cards + upcoming feed rendered cleanly
let mut poster_chromatic_px = 0usize;
for y in 160..420 {
for x in 250..1240 {
let [r, g, b] = img.get_pixel(x, y).0;
if r.max(g).max(b).saturating_sub(r.min(g).min(b)) >= 20 {
poster_chromatic_px += 1;
}
}
}
assert!(
poster_chromatic_px > 10_000,
"[concerts_official] Expected Top 3 concert poster cards + cashback pills, found {} chromatic px",
poster_chromatic_px
);
}
// 4. Official `WordsCardFullscreen` (`words_fullscreen_official.png`)
{
let mut shell = make_base_shell(
rt.handle().clone(),
vk.gpu_name.clone(),
Route::MyVibe,
ThemeMode::Dark,
Language::Ru,
108.0,
);
shell.app.words_cards.insert(
"t_1".into(),
WordsCard {
id: "wc_fs_1".into(),
track_id: "t_1".into(),
text: "MONTAGEM TENTA сочетает бразильский фонк и жёсткие хардстайл-кики.".into(),
tags: vec!["FACT".into()],
action: None,
actions: vec![],
big_card_ids: vec!["bc_1".into()],
feedback_state: None,
},
);
shell.app.words_big_card_open = true;
shell.app.words_big_card_loading = false;
shell.app.words_big_card = Some(WordsBigCard {
id: "bc_1".into(),
text: "MONTAGEM TENTA (Hardstyle) — взрывной кроссовер бразильского фонка и европейского хардстайла с плотным саб-басом и стремительным ритмом.".into(),
actions: vec![WordsCardSource {
title: "Обсудить с Алисой AI".into(),
url: "https://alice.yandex.ru".into(),
favicon_url: None,
}],
});
let _ = render_single_frame(&mut vk, &mut shell, 0.0);
let _ = render_single_frame(&mut vk, &mut shell, 0.016);
let img = render_single_frame(&mut vk, &mut shell, 0.032);
let _ = img.save(out_dir.join("words_fullscreen_official.png"));
// Verify purple Alice ring (#8B5CF6) rendered inside the centered source pill
let mut alice_purple_px = 0usize;
for y in 360..600 {
for x in 560..960 {
let [r, g, b] = img.get_pixel(x, y).0;
if b > 160 && r > 90 && (b as u16) > (g as u16) + 50 {
alice_purple_px += 1;
}
}
}
assert!(
alice_purple_px >= 15,
"[words_fullscreen_official] Expected purple Alice AI icon inside source pill, found {} px",
alice_purple_px
);
}
}