feat: 1:1 Yandex ID account menu, official WordsCard AI replies, VibeResetButton pill, and git.tatar updater

This commit is contained in:
marwy 2026-11-27 13:43:33 +03:00
parent 682e3579ab
commit 6c30a33a9b
28 changed files with 2574 additions and 461 deletions

View file

@ -398,6 +398,7 @@ fn build_reference_matched_shell(
uid: 42,
login: "marwy".into(),
display_name: "Marwy".into(),
default_email: None,
has_plus: true,
avatar_uri: Some("test.local/avatar_marwy/%%".into()),
});

View file

@ -105,6 +105,7 @@ fn make_base_shell(
uid: 1,
login: "Marwy".into(),
display_name: "Marwy".into(),
default_email: Some("marwy@yandex.ru".into()),
has_plus: true,
avatar_uri: None,
});
@ -1673,3 +1674,188 @@ fn test_ext_15_opengl33_strict_shaders_and_renderer_backend() {
);
}
}
#[test]
fn test_ext_16_yandex_id_popup_and_words_card_visual_parity() {
use yandex_music_rs::api::models::{WordsCard, WordsCardSource};
use yandex_music_rs::engine::types::Pos2;
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. Dark Theme Yandex ID v2.79.0 Account Popup + Appearance Popover (`dark_profile_popup.png`)
{
let mut shell = make_base_shell(
rt.handle().clone(),
vk.gpu_name.clone(),
Route::LikedTracks,
ThemeMode::Dark,
Language::Ru,
0.0,
);
shell.shell.sidebar_profile_open = true;
shell.shell.sidebar_appearance_open = true;
let mut img = render_single_frame(&mut vk, &mut shell, 0.0);
for f in 1..3 {
img = render_single_frame(&mut vk, &mut shell, f as f64 * 0.016);
}
let _ = img.save(out_dir.join("dark_profile_popup.png"));
// Verify `#1F1F24` dark Yandex ID card surface inside x=32..320, y=240..660
let mut card_bg_px = 0usize;
let mut bright_text_px = 0usize;
for y in 240..660 {
for x in 32..320 {
let [r, g, b] = img.get_pixel(x, y).0;
if (r as i32 - 0x1F).abs() <= 6
&& (g as i32 - 0x1F).abs() <= 6
&& (b as i32 - 0x24).abs() <= 6
{
card_bg_px += 1;
} else if r >= 220 && g >= 220 && b >= 225 {
bright_text_px += 1;
}
}
}
assert!(
card_bg_px > 40_000,
"[dark_profile_popup] Expected Yandex ID #1F1F24 dark surface (got {} px)",
card_bg_px
);
assert!(
bright_text_px > 1_200,
"[dark_profile_popup] Expected high-contrast #FAFAFF text/icons (got {} px)",
bright_text_px
);
// Verify Appearance submenu popover rendered to the right of the card (x=345..555)
let mut sub_bg_px = 0usize;
for y in 420..660 {
for x in 348..555 {
let [r, g, b] = img.get_pixel(x, y).0;
if (r as i32 - 0x2D).abs() <= 8
&& (g as i32 - 0x2D).abs() <= 8
&& (b as i32 - 0x34).abs() <= 8
{
sub_bg_px += 1;
}
}
}
assert!(
sub_bg_px > 10_000,
"[dark_profile_popup] Expected Yandex ID #2D2D34 Appearance popover (got {} px)",
sub_bg_px
);
}
// 2. My Vibe official 5.129.0 `WordsCard` + `WordsCardPopoverDesktop` (`my_vibe_words_popover.png`)
{
// Static guard: fake AI Vibe-settings string MUST be completely gone from `src/views/my_vibe.rs`
let mv_src = std::fs::read_to_string(
Path::new(env!("CARGO_MANIFEST_DIR")).join("src/views/my_vibe.rs"),
)
.expect("read src/views/my_vibe.rs");
assert!(
!mv_src.contains("Мою волну по настроению и характеру"),
"Fake AI Vibe-settings phrase must be removed from WordsCard in src/views/my_vibe.rs!"
);
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_test_1".into(),
track_id: "t_1".into(),
text: "Трек вдохновлён бразильским фонком и энергичными рейвами 2000-х".into(),
tags: vec!["FACT".into()],
action: None,
actions: vec![WordsCardSource {
title: "Подробнее об артисте".into(),
url: "https://music.yandex.ru".into(),
favicon_url: None,
}],
big_card_ids: Vec::new(),
feedback_state: None,
},
);
// Warm up WordsCard layout (renders State B around cx~943, ai_y~732)
let before = render_single_frame(&mut vk, &mut shell, 0.0);
let click_pos = Pos2::new(943.0, 732.0);
// Simulate genuine left-click press + release on WordsCard to toggle WordsCardPopoverDesktop
shell.ui.input.pointer_pos = Some(click_pos);
shell.ui.input.left_down = true;
shell.ui.input.left_pressed = true;
let _ = render_single_frame(&mut vk, &mut shell, 0.016);
shell.ui.input.left_down = false;
shell.ui.input.left_released = true;
let _ = render_single_frame(&mut vk, &mut shell, 0.032);
let after = render_single_frame(&mut vk, &mut shell, 0.048);
let _ = after.save(out_dir.join("my_vibe_words_popover.png"));
// Verify WordsCardPopoverDesktop actually appeared above WordsCard (y=500..700, x=810..1075)
let popover_delta = region_mean_abs_diff(&before, &after, 810, 500, 1075, 700);
assert!(
popover_delta > 4.0,
"[my_vibe_words_popover] Clicking WordsCard did not open WordsCardPopoverDesktop (delta={:.2} RGB)",
popover_delta
);
assert!(
!shell.app.vibe_modal_open,
"[my_vibe_words_popover] Clicking WordsCard MUST NOT open fake Vibe settings modal!"
);
}
// 3. Official 1-to-1 `VibeResetButton` unified pill + `0.1.0` version badge (`my_vibe_context_pill.png`)
{
use yandex_music_rs::app::APP_VERSION;
assert_eq!(APP_VERSION, "0.1.0", "APP_VERSION must match Cargo.toml 0.1.0");
let mut shell = make_base_shell(
rt.handle().clone(),
vk.gpu_name.clone(),
Route::MyVibe,
ThemeMode::Dark,
Language::En,
12.0,
);
if let Some(tr) = shell.app.queue.get_mut(0) {
tr.derived_average_hex = Some("#F56E00".into());
}
shell.app.is_vibe_active = false;
shell.app.context_name = "My Favorites".into();
shell.app.context_key = "likes".into();
shell.app.set_vibe_playback_for_test(true, 0.45, 0.35);
let mut img = render_single_frame(&mut vk, &mut shell, 0.0);
for f in 1..4 {
img = render_single_frame(&mut vk, &mut shell, f as f64 * 0.2);
}
let _ = img.save(out_dir.join("my_vibe_context_pill.png"));
// Verify bright electric yellow pixels (#FFFF00) inside top-center VibeResetButton pill (y=32..80, x=830..1060)
let mut pill_yellow_px = 0usize;
for y in 32..80 {
for x in 830..1060 {
if is_yandex_yellow(img.get_pixel(x, y).0) {
pill_yellow_px += 1;
}
}
}
assert!(
pill_yellow_px >= 400,
"[my_vibe_context_pill] Expected electric yellow text + filled yellow close circle inside unified VibeResetButton pill, found {} yellow px",
pill_yellow_px
);
}
}