Files
pipelines/app/test/features/chat/conversation/chat_composer_placeholder_test.dart
T

34 lines
1.4 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/chat/conversation/chat_composer_bar.dart';
import 'chat_composer_bar_fixtures.dart';
void main() {
testWidgets('an empty Cupertino composer holds its whole placeholder at '
'320px with 2x text', (tester) async {
tester.view.physicalSize = const Size(640, 1400);
tester.view.devicePixelRatio = 2;
tester.platformDispatcher.textScaleFactorTestValue = 2;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
addTearDown(tester.platformDispatcher.clearTextScaleFactorTestValue);
final gateway = ComposerBarGateway();
addTearDown(gateway.close);
await tester.pumpWidget(composerThread(gateway, cupertino: true));
await tester.pumpAndSettle();
final field = tester.getRect(find.byType(CupertinoTextField));
final placeholder = find.text(chatComposerPlaceholder);
final rect = tester.getRect(placeholder);
expect(rect.bottom, lessThanOrEqualTo(field.bottom));
// Longer than three lines it ends in an ellipsis, never a clipped line.
final paragraph = tester.renderObject<RenderParagraph>(placeholder);
if (paragraph.didExceedMaxLines) {
expect(paragraph.overflow, TextOverflow.ellipsis);
}
});
}