Skip to content

Instantly share code, notes, and snippets.

@pedromassango
Created April 22, 2021 18:09
Show Gist options
  • Save pedromassango/2fa04f07ba1a3ee42ae0e7b2aca5bc44 to your computer and use it in GitHub Desktop.
Save pedromassango/2fa04f07ba1a3ee42ae0e7b2aca5bc44 to your computer and use it in GitHub Desktop.
Test
testWidgets('Ellipsis is passed to the inner TextPainter when provided', (WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(
home: Material(
child: SelectableText(
'overflow',
maxLines: 1,
style: TextStyle(overflow: TextOverflow.ellipsis),
),
),
),
Duration.zero,
EnginePhase.build
);
final EditableTextState editableTextState = tester.state(find.byType(EditableText));
//expect(editableTextState.renderEditable.textPainter.ellipsis, kDefaultEllipsis);
// Getting no element
//final SelectableTextState state = tester.state<SelectableTextState>(find.byElementType(SelectableTextState));
final box = editableTextState.context.findRenderObject() as RenderBox?;
expect(box?.size.width, 8);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment