mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-10-19 05:57:48 +02:00
test(ui): correct context menu and lyric spacing assertions
This commit is contained in:
1 parent
42207b6fa5
commit
40cd1909df
2 files changed
+21
-9
No files matched your search
@@ -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));
|
||||
|
||||
@@ -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),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user