test(ui): correct context menu and lyric spacing assertions

This commit is contained in:
zarzet committed 2026-10-11 14:34:22 +07:00
1 parent 42207b6fa5
commit 40cd1909df
2 files changed
+21 -9

No files matched your search

+14 -7
View File
@@ -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));
+7 -2
View File
@@ -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),
);
}