49 lines
1.5 KiB
Dart
49 lines
1.5 KiB
Dart
// Author: fruit.com.cn
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:fruitshorts/core/theme/app_dimens.dart';
|
|
import 'package:fruitshorts/l10n/app_localizations.dart';
|
|
import 'package:fruitshorts/pages/recommend/recommend_types.dart';
|
|
import 'package:fruitshorts/pages/recommend/widgets/recommend_top_nav.dart';
|
|
|
|
void main() {
|
|
testWidgets('should_keep_large_text_and_actions_inside_narrow_top_nav', (
|
|
tester,
|
|
) async {
|
|
tester.view.physicalSize = const Size(320, 640);
|
|
tester.view.devicePixelRatio = 1;
|
|
addTearDown(tester.view.resetPhysicalSize);
|
|
addTearDown(tester.view.resetDevicePixelRatio);
|
|
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
locale: const Locale('id'),
|
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
|
supportedLocales: AppLocalizations.supportedLocales,
|
|
home: MediaQuery(
|
|
data: const MediaQueryData(textScaler: TextScaler.linear(2)),
|
|
child: Scaffold(
|
|
body: RecommendTopNav(
|
|
selected: RecommendInnerTab.feed,
|
|
onSelected: (_) {},
|
|
onSearch: () {},
|
|
onGift: () {},
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
|
|
expect(tester.takeException(), isNull);
|
|
expect(
|
|
tester.getSize(find.byKey(const Key('recommend-search'))),
|
|
const Size.square(AppDimens.tapTarget),
|
|
);
|
|
expect(
|
|
tester.getSize(find.byKey(const Key('recommend-gift'))),
|
|
const Size.square(AppDimens.tapTarget),
|
|
);
|
|
});
|
|
}
|