I have kind of an responsive Text-widget which uses as much space as possible, but truncates overflowing Texts.
To get stable and reliable code-base I want to have an test. which verifies that truncation works. I thought about something like the following example, but as text i get the passed-in content, not the visible (truncated) one.
@override
Future<void> test() async {
expect($(MultiLineText), findsOneWidget, reason: 'Cannot find main [MultiLineText] widget');
String? textContent = $(MultiLineText).$(Text).first.text;
expect(textContent?.contains('...'), true, reason: 'Cannot find ... ellipsis in too long content.');
}
Is there a way to get the visible content of a Text widget while Testing?