From 86fc1fd47951eab6031c1c7e602d8499bf33216e Mon Sep 17 00:00:00 2001 From: Valentin Vignal <32538273+ValentinVignal@users.noreply.github.com> Date: Tue, 5 Nov 2024 16:21:20 +0800 Subject: [PATCH] Add test for `raw_scrollbar.shape.0.dart` (#158094) Contributes to https://github.com/flutter/flutter/issues/130459 It adds a test for - `examples/api/lib/widgets/scrollbar/raw_scrollbar.shape.0.dart` --- dev/bots/check_code_samples.dart | 1 - .../scrollbar/raw_scrollbar.shape.0_test.dart | 34 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 examples/api/test/widgets/scrollbar/raw_scrollbar.shape.0_test.dart diff --git a/dev/bots/check_code_samples.dart b/dev/bots/check_code_samples.dart index 5a2170a000..9eed55a638 100644 --- a/dev/bots/check_code_samples.dart +++ b/dev/bots/check_code_samples.dart @@ -314,5 +314,4 @@ final Set _knownMissingTests = { 'examples/api/test/widgets/image/image.loading_builder.0_test.dart', 'examples/api/test/widgets/scrollbar/raw_scrollbar.2_test.dart', 'examples/api/test/widgets/scrollbar/raw_scrollbar.desktop.0_test.dart', - 'examples/api/test/widgets/scrollbar/raw_scrollbar.shape.0_test.dart', }; diff --git a/examples/api/test/widgets/scrollbar/raw_scrollbar.shape.0_test.dart b/examples/api/test/widgets/scrollbar/raw_scrollbar.shape.0_test.dart new file mode 100644 index 0000000000..4825e9ff90 --- /dev/null +++ b/examples/api/test/widgets/scrollbar/raw_scrollbar.shape.0_test.dart @@ -0,0 +1,34 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/material.dart'; +import 'package:flutter_api_samples/widgets/scrollbar/raw_scrollbar.shape.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('The thumb shape is a stadium border', (WidgetTester tester) async { + await tester.pumpWidget( + const example.ShapeExampleApp(), + ); + + expect(find.byType(RawScrollbar), findsOne); + expect(find.byType(ListView), findsOne); + + expect(find.text('0'), findsOne); + expect(find.text('1'), findsOne); + expect(find.text('4'), findsOne); + + await tester.pumpAndSettle(); + + expect( + find.byType(RawScrollbar), + paints + ..path(color: Colors.blue) + ..rrect( + rrect: RRect.fromLTRBR(786.5, 1.5, 798.5, 178.5, const Radius.circular(6)), + color: Colors.brown, + ), + ); + }); +}