From 40cd1909df21df6760831b2edb4bef544142ab51 Mon Sep 17 00:00:00 2001 From: zarzet <42882290+zarzet@users.noreply.github.com> Date: Sun, 11 Oct 2026 14:34:22 +0700 Subject: [PATCH] test(ui): correct context menu and lyric spacing assertions --- test/home_search_tabs_test.dart | 21 +++++++++++++------- test/now_playing_lyrics_transition_test.dart | 9 +++++++-- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/test/home_search_tabs_test.dart b/test/home_search_tabs_test.dart index 99d6d0ce..97284de3 100644 --- a/test/home_search_tabs_test.dart +++ b/test/home_search_tabs_test.dart @@ -101,13 +101,20 @@ void main() { expect(find.text('Download'), findsOneWidget); expect(find.text('Go to Album'), findsOneWidget); final menu = tester.getRect(find.byType(MornyeContextMenu)); - expect( - menu.top, - anyOf( - closeTo(anchor.bottom + 8, 1), - closeTo(anchor.top - menu.height - 8, 1), - ), - ); + if (anchor.bottom + 8 + menu.height > size.height - 16 && + anchor.top - menu.height - 8 < 16) { + // A tall featured card can leave no room on either side. The menu + // stays at the bottom safe margin instead of covering the viewport. + expect(menu.bottom, closeTo(size.height - 16, 1)); + } else { + expect( + menu.top, + anyOf( + closeTo(anchor.bottom + 8, 1), + closeTo(anchor.top - menu.height - 8, 1), + ), + ); + } expect(menu.left, greaterThanOrEqualTo(16)); expect(menu.right, lessThanOrEqualTo(size.width - 16)); expect(menu.top, greaterThanOrEqualTo(16)); diff --git a/test/now_playing_lyrics_transition_test.dart b/test/now_playing_lyrics_transition_test.dart index f0bfbeea..73ba4c28 100644 --- a/test/now_playing_lyrics_transition_test.dart +++ b/test/now_playing_lyrics_transition_test.dart @@ -3323,9 +3323,14 @@ void main() { ); expect(backing.textAlign, TextAlign.right); if (mornye) { + // Inactive vocals shrink around their center. Check the row gap + // before that paint transform, rather than the scaled text bounds. + Finder lyricScale(Finder content) => find + .ancestor(of: content, matching: find.byType(AnimatedScale)) + .first; expect( - tester.getTopLeft(find.text('Echo')).dy - - tester.getBottomLeft(timed('Lead')).dy, + tester.getTopLeft(lyricScale(find.text('Echo'))).dy - + tester.getBottomLeft(lyricScale(timed('Lead'))).dy, closeTo(6, 0.1), ); }