chore(release): v0.1.4 - 1:1 SyncLyrics, scroll isolation, object-fit cover, Concerts icon, friends' likes & duplicate-title albums
This commit is contained in:
parent
0b2561503f
commit
f063382410
21 changed files with 1287 additions and 288 deletions
|
|
@ -1890,6 +1890,7 @@ fn test_ext_17_for_you_collection_concerts_words_fullscreen() {
|
|||
let mk_album = |id: &str, title: &str, artist: &str| AlbumSummary {
|
||||
id: id.into(),
|
||||
title: title.into(),
|
||||
version: None,
|
||||
year: Some(2026),
|
||||
cover_uri: None,
|
||||
artists: vec![ArtistSummary {
|
||||
|
|
@ -2170,9 +2171,9 @@ fn test_ext_17_for_you_collection_concerts_words_fullscreen() {
|
|||
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
|
||||
// Verify Top 3 poster cards (aspect 0.963, h~320px) + cashback pills + yellow price CTAs rendered cleanly
|
||||
let mut poster_chromatic_px = 0usize;
|
||||
for y in 160..420 {
|
||||
for y in 160..540 {
|
||||
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 {
|
||||
|
|
@ -2244,3 +2245,273 @@ fn test_ext_17_for_you_collection_concerts_words_fullscreen() {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_ext_18_qa_sync_lyrics_scroll_concerts_duplicate_albums() {
|
||||
use std::sync::atomic::Ordering;
|
||||
use yandex_music_rs::api::models::{AlbumSummary, LyricLine, TrackLyrics};
|
||||
use yandex_music_rs::app::CollectionTab;
|
||||
use yandex_music_rs::engine::input::{InputState, ZLayer};
|
||||
use yandex_music_rs::engine::scroll::ScrollState;
|
||||
use yandex_music_rs::engine::types::{Pos2, Rect};
|
||||
use yandex_music_rs::engine::widgets::cover_fit_uv;
|
||||
|
||||
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. 1-to-1 Official FullscreenPlayerDesktop 50/50 SyncLyrics (`fullscreen_sync_lyrics_official.png`)
|
||||
{
|
||||
let mut shell = make_base_shell(
|
||||
rt.handle().clone(),
|
||||
vk.gpu_name.clone(),
|
||||
Route::LikedTracks,
|
||||
ThemeMode::Dark,
|
||||
Language::Ru,
|
||||
0.0,
|
||||
);
|
||||
if let Some(tr) = shell.app.queue.get_mut(0) {
|
||||
tr.derived_average_hex = Some("#1A2238".into());
|
||||
}
|
||||
shell.app.current_lyrics = Some(TrackLyrics {
|
||||
track_id: "t_1".into(),
|
||||
is_synced: true,
|
||||
lines: vec![
|
||||
LyricLine { time_ms: 4_000, text: "Первая строчка уходит вверх".into() },
|
||||
LyricLine { time_ms: 10_000, text: "Вторая строчка уже прозвучала".into() },
|
||||
LyricLine { time_ms: 16_000, text: "Третья строчка перед текущей".into() },
|
||||
LyricLine { time_ms: 21_000, text: "Активная яркая строка прямо по центру".into() },
|
||||
LyricLine { time_ms: 28_000, text: "Следующая строчка ждёт своей очереди".into() },
|
||||
LyricLine { time_ms: 35_000, text: "Пятая строчка чуть дальше вниз".into() },
|
||||
LyricLine { time_ms: 42_000, text: "Шестая строчка в приглушённом цвете".into() },
|
||||
LyricLine { time_ms: 49_000, text: "Финальная строчка композиции".into() },
|
||||
],
|
||||
writers: Some("Test Writer".into()),
|
||||
major: Some("Genius".into()),
|
||||
});
|
||||
shell.app.fullscreen_open = true;
|
||||
shell.app.fullscreen_lyrics_open = true;
|
||||
shell.app.audio.state.position_ms.store(22_000, Ordering::SeqCst);
|
||||
shell.app.audio.state.is_playing.store(true, Ordering::SeqCst);
|
||||
shell.shell.fs_lyrics_upper_until = 0.0;
|
||||
shell.shell.fs_lyrics_manual_until = 0.0;
|
||||
|
||||
// Settle 0.45s split + opacity animations cleanly with mouse idle
|
||||
let mut img = render_single_frame(&mut vk, &mut shell, 0.0);
|
||||
for f in 1..25 {
|
||||
img = render_single_frame(&mut vk, &mut shell, f as f64 * 0.05);
|
||||
}
|
||||
let _ = img.save(out_dir.join("fullscreen_sync_lyrics_official.png"));
|
||||
|
||||
// Verify bright white active line near 40vh (y=250..410, x=600..1220)
|
||||
let mut active_bright_px = 0usize;
|
||||
for y in 250..410 {
|
||||
for x in 600..1220 {
|
||||
let [r, g, b] = img.get_pixel(x, y).0;
|
||||
if r >= 200 && g >= 200 && b >= 200 {
|
||||
active_bright_px += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
assert!(
|
||||
active_bright_px >= 600,
|
||||
"[fullscreen_sync_lyrics] Expected bright white active line near 40vh, found {} px",
|
||||
active_bright_px
|
||||
);
|
||||
|
||||
// Verify past lines above active (y=60..210, x=640..1180) are hidden (0 bright white px) when mouse is idle
|
||||
let mut past_bright_px = 0usize;
|
||||
for y in 60..210 {
|
||||
for x in 640..1180 {
|
||||
let [r, g, b] = img.get_pixel(x, y).0;
|
||||
if r >= 170 && g >= 170 && b >= 170 {
|
||||
past_bright_px += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
assert_eq!(
|
||||
past_bright_px, 0,
|
||||
"[fullscreen_sync_lyrics] Past upper lines must be hidden (opacity 0.0) when mouse is idle, found {} bright px",
|
||||
past_bright_px
|
||||
);
|
||||
|
||||
// Verify Volume button is anchored in the bottom-right corner (center ~(1236, 760)), NOT bottom-center
|
||||
let mut vol_corner_bright_px = 0usize;
|
||||
for y in 740..780 {
|
||||
for x in 1216..1256 {
|
||||
let [r, g, b] = img.get_pixel(x, y).0;
|
||||
if r >= 160 && g >= 160 && b >= 160 {
|
||||
vol_corner_bright_px += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
assert!(
|
||||
vol_corner_bright_px >= 25,
|
||||
"[fullscreen_sync_lyrics] Expected Volume icon anchored in bottom-right corner (1236,760), found {} bright px",
|
||||
vol_corner_bright_px
|
||||
);
|
||||
}
|
||||
|
||||
// 2. Horizontal Scroll Isolation: plain vertical wheel MUST NOT scroll horizontal-only carousels!
|
||||
{
|
||||
let vp = Rect::from_xywh(0.0, 0.0, 600.0, 200.0);
|
||||
let mut st = ScrollState::new();
|
||||
st.content_size = Vec2::new(2000.0, 200.0);
|
||||
|
||||
let mut inp = InputState::new();
|
||||
inp.pointer_pos = Some(Pos2::new(200.0, 100.0));
|
||||
inp.wheel_delta = Vec2::new(0.0, -120.0);
|
||||
st.update(&inp, ZLayer::Base, vp, false, true);
|
||||
assert!(
|
||||
st.target.x.abs() < 0.001,
|
||||
"Horizontal-only ScrollState must ignore plain vertical wheel_delta.y, got target.x={}",
|
||||
st.target.x
|
||||
);
|
||||
|
||||
// Shift + vertical wheel scrolls horizontally
|
||||
inp.modifiers.shift = true;
|
||||
st.update(&inp, ZLayer::Base, vp, false, true);
|
||||
assert!(
|
||||
st.target.x > 50.0,
|
||||
"Shift + wheel_delta.y must scroll horizontally, got target.x={}",
|
||||
st.target.x
|
||||
);
|
||||
|
||||
// Trackpad horizontal wheel_delta.x scrolls horizontally without Shift
|
||||
st.reset();
|
||||
inp.modifiers.shift = false;
|
||||
inp.wheel_delta = Vec2::new(-120.0, 0.0);
|
||||
st.update(&inp, ZLayer::Base, vp, false, true);
|
||||
assert!(
|
||||
st.target.x > 50.0,
|
||||
"Horizontal wheel_delta.x must scroll horizontally, got target.x={}",
|
||||
st.target.x
|
||||
);
|
||||
}
|
||||
|
||||
// 3. `object-fit: cover` (`cover_fit_uv`) preserves aspect ratio with zero stretching
|
||||
{
|
||||
let uv_wide = cover_fit_uv(400, 400, Rect::from_xywh(0.0, 0.0, 300.0, 150.0), 0.35);
|
||||
assert!(
|
||||
(uv_wide.w - 1.0).abs() < 1e-4 && (uv_wide.h - 0.5).abs() < 1e-4,
|
||||
"400x400 in 300x150 expected uv (w=1.0, h=0.5), got {:?}",
|
||||
uv_wide
|
||||
);
|
||||
let uv_portrait = cover_fit_uv(200, 400, Rect::from_xywh(0.0, 0.0, 200.0, 200.0), 0.35);
|
||||
assert!(
|
||||
(uv_portrait.w - 1.0).abs() < 1e-4 && (uv_portrait.h - 0.5).abs() < 1e-4,
|
||||
"200x400 in 200x200 expected uv (w=1.0, h=0.5), got {:?}",
|
||||
uv_portrait
|
||||
);
|
||||
}
|
||||
|
||||
// 4. Concerts Active Icon (`Icon::ConcertsSelected`) rasterizes with symmetric filled ticket silhouette
|
||||
{
|
||||
let opt = resvg::usvg::Options::default();
|
||||
let tree = resvg::usvg::Tree::from_data(Icon::ConcertsSelected.raw_svg(), &opt)
|
||||
.expect("ConcertsSelected SVG parse failed");
|
||||
let sz = 48u32;
|
||||
let mut pixmap = resvg::tiny_skia::Pixmap::new(sz, sz).unwrap();
|
||||
let sx = sz as f32 / tree.size().width();
|
||||
let sy = sz as f32 / tree.size().height();
|
||||
resvg::render(
|
||||
&tree,
|
||||
resvg::tiny_skia::Transform::from_scale(sx, sy),
|
||||
&mut pixmap.as_mut(),
|
||||
);
|
||||
let data = pixmap.data();
|
||||
let mut left_cov = 0u64;
|
||||
let mut right_cov = 0u64;
|
||||
for y in 0..sz {
|
||||
for x in 0..sz {
|
||||
let a = data[((y * sz + x) * 4 + 3) as usize] as u64;
|
||||
if x < sz / 2 {
|
||||
left_cov += a;
|
||||
} else {
|
||||
right_cov += a;
|
||||
}
|
||||
}
|
||||
}
|
||||
let total = left_cov + right_cov;
|
||||
assert!(
|
||||
total > 40_000,
|
||||
"ConcertsSelected SVG coverage too small ({})",
|
||||
total
|
||||
);
|
||||
let asym = (left_cov as i64 - right_cov as i64).unsigned_abs() as f64 / total as f64;
|
||||
assert!(
|
||||
asym < 0.05,
|
||||
"ConcertsSelected SVG is asymmetric (left={}, right={}, asym={:.3})",
|
||||
left_cov,
|
||||
right_cov,
|
||||
asym
|
||||
);
|
||||
}
|
||||
|
||||
// 5. Duplicate-Title Albums render distinctly in Collection overview + Albums sub-view with zero panics
|
||||
{
|
||||
let mk_dup = |id: &str, version: Option<&str>| AlbumSummary {
|
||||
id: id.into(),
|
||||
title: "Same Title Album".into(),
|
||||
version: version.map(String::from),
|
||||
year: Some(2025),
|
||||
cover_uri: None,
|
||||
artists: vec![ArtistSummary {
|
||||
id: "art_dup".into(),
|
||||
name: "Test Artist".into(),
|
||||
cover_uri: None,
|
||||
genres: vec![],
|
||||
}],
|
||||
track_count: 10,
|
||||
genre: Some("pop".into()),
|
||||
is_explicit: false,
|
||||
content_type: Some("album".into()),
|
||||
};
|
||||
let std_alb = mk_dup("alb_std", None);
|
||||
let dlx_alb = mk_dup("alb_dlx", Some("Deluxe"));
|
||||
assert_eq!(std_alb.full_title(), "Same Title Album");
|
||||
assert_eq!(dlx_alb.full_title(), "Same Title Album (Deluxe)");
|
||||
|
||||
let mut shell = make_base_shell(
|
||||
rt.handle().clone(),
|
||||
vk.gpu_name.clone(),
|
||||
Route::Collection,
|
||||
ThemeMode::Dark,
|
||||
Language::Ru,
|
||||
0.0,
|
||||
);
|
||||
shell.app.liked_albums = vec![std_alb, dlx_alb];
|
||||
shell.app.collection_tab = CollectionTab::Tracks;
|
||||
let _ = render_single_frame(&mut vk, &mut shell, 0.0);
|
||||
let _ = render_single_frame(&mut vk, &mut shell, 0.016);
|
||||
|
||||
shell.app.collection_tab = CollectionTab::Albums;
|
||||
let _ = render_single_frame(&mut vk, &mut shell, 0.032);
|
||||
let img_albums = render_single_frame(&mut vk, &mut shell, 0.048);
|
||||
|
||||
// Confirm both album cards rendered distinct non-empty content in the Albums grid (x=250..650, y=130..360)
|
||||
let mut card1_lit = 0usize;
|
||||
let mut card2_lit = 0usize;
|
||||
for y in 130..360 {
|
||||
for x in 250..430 {
|
||||
let [r, g, b] = img_albums.get_pixel(x, y).0;
|
||||
if r > 30 || g > 30 || b > 30 {
|
||||
card1_lit += 1;
|
||||
}
|
||||
}
|
||||
for x in 450..630 {
|
||||
let [r, g, b] = img_albums.get_pixel(x, y).0;
|
||||
if r > 30 || g > 30 || b > 30 {
|
||||
card2_lit += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
assert!(
|
||||
card1_lit > 2_000 && card2_lit > 2_000,
|
||||
"Expected both duplicate-title album cards to render distinctly (card1={}, card2={})",
|
||||
card1_lit,
|
||||
card2_lit
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue