-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/engine
#33488Labels
a: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.0Found to occur in 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1Found to occur in 3.1frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Steps to Reproduce
- Create new app via
flutter create. - Set
useMaterial3ofMaterialAppsthemetotrue. - Run the following "test":
testWidgets('Foo bar', (tester) async {
await tester.pumpWidget(const MyApp());
await tester.tap(find.byType(FloatingActionButton));
});Expected results: Test passing
Actual results: Test failing
Code sample
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
}
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also a layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Invoke "debug painting" (press "p" in the console, choose the
// "Toggle Debug Paint" action from the Flutter Inspector in Android
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
// to see the wireframe for each widget.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
Logs
Pending timers:
Timer (duration: 0:00:00.000000, periodic: false), created:
#0 new FakeTimer._ (package:fake_async/fake_async.dart:308:62)
#1 FakeAsync._createTimer (package:fake_async/fake_async.dart:252:27)
#2 FakeAsync.run.<anonymous closure> (package:fake_async/fake_async.dart:185:19)
#7 FragmentProgram.compile (dart:ui/painting.dart:3872:12)
#8 FragmentShaderManager.compile (package:flutter/src/material/ink_sparkle.dart:620:41)
#9 FragmentShaderManager.inkSparkle (package:flutter/src/material/ink_sparkle.dart:614:19)
#10 _InkSparkleFactory.compileShaderIfNeccessary (package:flutter/src/material/ink_sparkle.dart:427:29)
#11 new InkSparkle (package:flutter/src/material/ink_sparkle.dart:125:24)
#12 _InkSparkleFactory.create (package:flutter/src/material/ink_sparkle.dart:452:12)
#13 _InkResponseState._createInkFeature (package:flutter/src/material/ink_well.dart:912:72)
#14 _InkResponseState._startSplash (package:flutter/src/material/ink_well.dart:990:42)
#15 _InkResponseState._handleTapDown (package:flutter/src/material/ink_well.dart:971:5)
#16 TapGestureRecognizer.handleTapDown.<anonymous closure> (package:flutter/src/gestures/tap.dart:586:61)
#17 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:198:24)
#18 TapGestureRecognizer.handleTapDown (package:flutter/src/gestures/tap.dart:586:11)
#19 BaseTapGestureRecognizer._checkDown (package:flutter/src/gestures/tap.dart:289:5)
#20 BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:267:7)
#21 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:157:27)
#22 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:449:20)
#23 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:425:22)
#24 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:329:11)
#25 GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:380:7)
#26 GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:344:5)
#27 TestWidgetsFlutterBinding.handlePointerEventForSource.<anonymous closure> (package:flutter_test/src/binding.dart:523:42)
#28 TestWidgetsFlutterBinding.withPointerEventSource (package:flutter_test/src/binding.dart:533:11)
#29 TestWidgetsFlutterBinding.handlePointerEventForSource (package:flutter_test/src/binding.dart:523:5)
#30 WidgetTester.sendEventToBinding.<anonymous closure> (package:flutter_test/src/widget_tester.dart:808:15)
#31 WidgetTester.sendEventToBinding.<anonymous closure> (package:flutter_test/src/widget_tester.dart:807:39)
#34 TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:71:41)
#35 WidgetTester.sendEventToBinding (package:flutter_test/src/widget_tester.dart:807:27)
#36 TestGesture.up.<anonymous closure> (package:flutter_test/src/test_pointer.dart:396:24)
#37 TestGesture.up.<anonymous closure> (package:flutter_test/src/test_pointer.dart:394:39)
#40 TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:71:41)
#41 TestGesture.up (package:flutter_test/src/test_pointer.dart:394:27)
#42 WidgetController.tapAt.<anonymous closure> (package:flutter_test/src/controller.dart:280:21)
asynchronous suspension>
<asynchronous suspension>
(elided 9 frames from dart:async and package:stack_trace)
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following assertion was thrown running a test:
A Timer is still pending even after the widget tree was disposed.
'package:flutter_test/src/binding.dart':
Failed assertion: line 1291 pos 12: '!timersPending'
When the exception was thrown, this was the stack:
#2 AutomatedTestWidgetsFlutterBinding._verifyInvariants (package:flutter_test/src/binding.dart:1291:12)
#3 TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:848:7)
<asynchronous suspension>
(elided 2 frames from class _AssertionError)
No issues found! (ran in 2.6s)
[✓] Flutter (Channel stable, 3.0.0, on macOS 11.6.5 20G527 darwin-x64, locale de-DE)
• Flutter version 3.0.0 at /usr/local/Caskroom/flutter/3.0.0/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ee4e09cce0 (9 days ago), 2022-05-09 16:45:18 -0700
• Engine revision d1b9a6938a
• Dart version 2.17.0
• DevTools version 2.12.2
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc2)
• Android SDK at /Users/jonas/Library/Android/sdk
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
[✓] IntelliJ IDEA Community Edition (version 2021.2.2)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.67.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.40.0
[✓] HTTP Host Availability
• All required HTTP hosts are available
Metadata
Metadata
Assignees
Labels
a: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.0Found to occur in 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1Found to occur in 3.1frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version