test: scroll service test for editor

This commit is contained in:
Sean Riley Hawkins 2022-10-28 15:25:04 +02:00 committed by GitHub
parent 43e4b1efad
commit 4d89b7a24e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import '../infra/test_editor.dart';
void main() async {
setUpAll(() {
TestWidgetsFlutterBinding.ensureInitialized();
});
group('Testing Scroll With Gestures', () {
testWidgets('Test Gestsure Scroll', (tester) async {
final editor = tester.editor;
for (var i = 0; i < 100; i++) {
editor.insertTextNode('$i');
}
editor.insertTextNode('mark');
for (var i = 100; i < 200; i++) {
editor.insertTextNode('$i');
}
await editor.startTesting();
final listFinder = find.byType(Scrollable);
final itemFinder = find.text('mark', findRichText: true);
await tester.scrollUntilVisible(itemFinder, 500.0,
scrollable: listFinder);
expect(itemFinder, findsOneWidget);
});
});
}