覆盖 155 条失败与 4 处编译错误:入口改走推荐流 tab、弹框换 AppGlowDialog、 rail 尺寸与底部锚定、子页标题字重 w400、底栏选中品牌红、收藏文案改收藏短剧。 全量 flutter test 775 通过。
37 lines
1.1 KiB
Dart
37 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:fruitshorts/core/widgets/remote_image.dart';
|
|
|
|
void main() {
|
|
test('should_bound_layout_pixels_for_small_and_large_extents', () {
|
|
expect(resolveImageDecodePixels(12, 3), 96);
|
|
expect(resolveImageDecodePixels(120, 3), 360);
|
|
expect(resolveImageDecodePixels(4000, 3), 2048);
|
|
});
|
|
|
|
testWidgets('should_decode_grid_cover_at_layout_width_times_dpr', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
home: MediaQuery(
|
|
data: const MediaQueryData(devicePixelRatio: 3),
|
|
child: Center(
|
|
child: SizedBox(
|
|
width: 120,
|
|
height: 160,
|
|
child: RemoteImage('/files/grid-cover.jpg'),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
|
|
final image = tester.widget<Image>(find.byType(Image));
|
|
final provider = image.image as ResizeImage;
|
|
expect(provider.width, 360);
|
|
// cover 已保持宽高比,只按布局宽度限制解码,不再强制高度。
|
|
expect(provider.height, isNull);
|
|
});
|
|
}
|