Skip to content

Commit ed91ba1

Browse files
Add test for raw_scrollbar.1.dart (flutter#158069)
Contributes to flutter#130459 It adds a test for - `examples/api/lib/widgets/scrollbar/raw_scrollbar.1.dart`
1 parent a1fbc83 commit ed91ba1

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

dev/bots/check_code_samples.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ final Set<String> _knownMissingTests = <String>{
312312
'examples/api/test/material/color_scheme/dynamic_content_color.0_test.dart',
313313
'examples/api/test/widgets/image/image.frame_builder.0_test.dart',
314314
'examples/api/test/widgets/image/image.loading_builder.0_test.dart',
315-
'examples/api/test/widgets/scrollbar/raw_scrollbar.1_test.dart',
316315
'examples/api/test/widgets/scrollbar/raw_scrollbar.2_test.dart',
317316
'examples/api/test/widgets/scrollbar/raw_scrollbar.desktop.0_test.dart',
318317
'examples/api/test/widgets/scrollbar/raw_scrollbar.shape.0_test.dart',
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'package:flutter/gestures.dart';
6+
import 'package:flutter/material.dart';
7+
import 'package:flutter_api_samples/widgets/scrollbar/raw_scrollbar.1.dart' as example;
8+
import 'package:flutter_test/flutter_test.dart';
9+
10+
void main() {
11+
testWidgets('When thumbVisibility is true, the scrollbar thumb remains visible', (WidgetTester tester) async {
12+
await tester.pumpWidget(
13+
const example.RawScrollbarExampleApp(),
14+
);
15+
16+
expect(find.widgetWithText(AppBar, 'RawScrollbar Sample'), findsOne);
17+
expect(find.byType(RawScrollbar), findsOne);
18+
expect(find.byType(GridView), findsOne);
19+
expect(find.byType(RawScrollbar), paints..clipRect());
20+
21+
expect(find.text('item 0'), findsOne);
22+
expect(find.text('item 1'), findsOne);
23+
expect(find.text('item 2'), findsOne);
24+
25+
final TestPointer pointer = TestPointer(1, PointerDeviceKind.mouse);
26+
pointer.hover(tester.getCenter(find.byType(GridView)));
27+
await tester.sendEventToBinding(pointer.scroll(const Offset(0.0, 1000)));
28+
await tester.pumpAndSettle();
29+
30+
expect(find.byType(RawScrollbar), paints..clipRect());
31+
32+
expect(find.text('item 15'), findsOne);
33+
expect(find.text('item 16'), findsOne);
34+
expect(find.text('item 17'), findsOne);
35+
});
36+
}

0 commit comments

Comments
 (0)