fix(player): 收紧图片与快速切集资源占用
This commit is contained in:
1 parent
2fef7470e0
commit
80c962a95c
10 files changed
+281
-30
No files matched your search
@@ -0,0 +1,35 @@
|
||||
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);
|
||||
expect(provider.height, 480);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user