Unverified Commit 1b5899a4 authored by Tomasz Gucio's avatar Tomasz Gucio Committed by GitHub

Avoid catching FlutterError in TextPainter tests (#127604)

parent 90afc5e8
...@@ -1253,34 +1253,34 @@ void main() { ...@@ -1253,34 +1253,34 @@ void main() {
..text = const TextSpan(text: 'TEXT') ..text = const TextSpan(text: 'TEXT')
..textDirection = TextDirection.ltr; ..textDirection = TextDirection.ltr;
FlutterError? exception; expect(
try { () => painter.getPositionForOffset(Offset.zero),
painter.getPositionForOffset(Offset.zero); throwsA(isA<FlutterError>().having(
} on FlutterError catch (e) { (FlutterError error) => error.message,
exception = e; 'message',
} contains('The TextPainter has never been laid out.'),
expect(exception?.message, contains('The TextPainter has never been laid out.')); )),
exception = null; );
try { expect(
() {
painter.layout(); painter.layout();
painter.getPositionForOffset(Offset.zero); painter.getPositionForOffset(Offset.zero);
} on FlutterError catch (e) { },
exception = e; returnsNormally,
} );
expect(exception, isNull);
exception = null;
try { expect(
() {
painter.markNeedsLayout(); painter.markNeedsLayout();
painter.getPositionForOffset(Offset.zero); painter.getPositionForOffset(Offset.zero);
} on FlutterError catch (e) { },
exception = e; throwsA(isA<FlutterError>().having(
} (FlutterError error) => error.message,
'message',
expect(exception?.message, contains('The calls that first invalidated the text layout were:')); contains('The calls that first invalidated the text layout were:'),
exception = null; )),
);
painter.dispose(); painter.dispose();
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment