@@ -0,0 +1,42 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:plezy/utils/media_image_helper.dart';
|
||||
import 'package:plezy/widgets/optimized_media_image.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('failed image placeholders keep explicit dimensions in loose layouts', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
OptimizedMediaImage(
|
||||
client: null,
|
||||
imagePath: 'https://example.invalid/broken-actor-image.jpg',
|
||||
width: 96,
|
||||
height: 96,
|
||||
imageType: ImageType.avatar,
|
||||
fallbackIcon: Symbols.person_rounded,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Text('Actor Name'),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byIcon(Symbols.person_rounded), findsOneWidget);
|
||||
|
||||
final placeholder = find.descendant(of: find.byType(OptimizedMediaImage), matching: find.byType(Container));
|
||||
expect(placeholder, findsOneWidget);
|
||||
expect(tester.getSize(placeholder), const Size(96, 96));
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user