Michael Goderbauer 5491c8c146
Auto-format Framework (#160545)
This auto-formats all *.dart files in the repository outside of the
`engine` subdirectory and enforces that these files stay formatted with
a presubmit check.

**Reviewers:** Please carefully review all the commits except for the
one titled "formatted". The "formatted" commit was auto-generated by
running `dev/tools/format.sh -a -f`. The other commits were hand-crafted
to prepare the repo for the formatting change. I recommend reviewing the
commits one-by-one via the "Commits" tab and avoiding Github's "Files
changed" tab as it will likely slow down your browser because of the
size of this PR.

---------

Co-authored-by: Kate Lovett <katelovett@google.com>
Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
2024-12-19 20:06:21 +00:00

56 lines
2.1 KiB
Dart

// 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_gallery/gallery/app.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
if (binding is LiveTestWidgetsFlutterBinding) {
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
}
// Regression test for https://github.com/flutter/flutter/pull/5168
testWidgets('Pesto appbar heroics', (WidgetTester tester) async {
await tester.pumpWidget(
// The bug only manifests itself when the screen's orientation is portrait
const Center(child: SizedBox(width: 450.0, height: 800.0, child: GalleryApp(testMode: true))),
);
await tester.pump(); // see https://github.com/flutter/flutter/issues/1865
await tester.pump(); // triggers a frame
await tester.tap(find.text('Studies'));
await tester.pumpAndSettle();
await tester.tap(find.text('Pesto'));
await tester.pumpAndSettle();
await tester.tap(find.text('Roasted Chicken'));
await tester.pumpAndSettle();
await tester.drag(find.text('Roasted Chicken'), const Offset(0.0, -300.0));
await tester.pumpAndSettle();
Navigator.pop(find.byType(Scaffold).evaluate().single);
await tester.pumpAndSettle();
});
testWidgets('Pesto can be scrolled all the way down', (WidgetTester tester) async {
await tester.pumpWidget(const GalleryApp(testMode: true));
await tester.pump(); // see https://github.com/flutter/flutter/issues/1865
await tester.pump(); // triggers a frame
await tester.tap(find.text('Studies'));
await tester.pumpAndSettle();
await tester.tap(find.text('Pesto'));
await tester.pumpAndSettle();
await tester.fling(find.text('Roasted Chicken'), const Offset(0.0, -200.0), 10000.0);
await tester.pumpAndSettle(); // start and finish fling
expect(find.text('Spanakopita'), findsOneWidget);
});
}