mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

* Update project.pbxproj files to say Flutter rather than Chromium Also, the templates now have an empty organization so that we don't cause people to give their apps a Flutter copyright. * Update the copyright notice checker to require a standard notice on all files * Update copyrights on Dart files. (This was a mechanical commit.) * Fix weird license headers on Dart files that deviate from our conventions; relicense Shrine. Some were already marked "The Flutter Authors", not clear why. Their dates have been normalized. Some were missing the blank line after the license. Some were randomly different in trivial ways for no apparent reason (e.g. missing the trailing period). * Clean up the copyrights in non-Dart files. (Manual edits.) Also, make sure templates don't have copyrights. * Fix some more ORGANIZATIONNAMEs
87 lines
2.9 KiB
Dart
87 lines
2.9 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.
|
|
|
|
// See //dev/devicelab/bin/tasks/flutter_gallery__memory_nav.dart
|
|
|
|
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/scheduler.dart';
|
|
import 'package:flutter_gallery/gallery/app.dart' show GalleryApp;
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
Future<void> endOfAnimation() async {
|
|
do {
|
|
await SchedulerBinding.instance.endOfFrame;
|
|
} while (SchedulerBinding.instance.hasScheduledFrame);
|
|
}
|
|
|
|
Rect boundsFor(WidgetController controller, Finder item) {
|
|
final RenderBox box = controller.renderObject<RenderBox>(item);
|
|
return box.localToGlobal(Offset.zero) & box.size;
|
|
}
|
|
|
|
Future<void> main() async {
|
|
final Completer<void> ready = Completer<void>();
|
|
runApp(GestureDetector(
|
|
onTap: () {
|
|
debugPrint('Received tap.');
|
|
ready.complete();
|
|
},
|
|
behavior: HitTestBehavior.opaque,
|
|
child: const IgnorePointer(
|
|
ignoring: true,
|
|
child: GalleryApp(testMode: true),
|
|
),
|
|
));
|
|
await SchedulerBinding.instance.endOfFrame;
|
|
await Future<void>.delayed(const Duration(milliseconds: 50));
|
|
debugPrint('==== MEMORY BENCHMARK ==== READY ====');
|
|
|
|
await ready.future;
|
|
debugPrint('Continuing...');
|
|
|
|
// remove onTap handler, enable pointer events for app
|
|
runApp(GestureDetector(
|
|
child: const IgnorePointer(
|
|
ignoring: false,
|
|
child: GalleryApp(testMode: true),
|
|
),
|
|
));
|
|
await SchedulerBinding.instance.endOfFrame;
|
|
|
|
final WidgetController controller = LiveWidgetController(WidgetsBinding.instance);
|
|
|
|
debugPrint('Navigating...');
|
|
await controller.tap(find.text('Material'));
|
|
await Future<void>.delayed(const Duration(milliseconds: 150));
|
|
final Finder demoList = find.byKey(const Key('GalleryDemoList'));
|
|
final Finder demoItem = find.text('Text fields');
|
|
do {
|
|
await controller.drag(demoList, const Offset(0.0, -300.0));
|
|
await Future<void>.delayed(const Duration(milliseconds: 20));
|
|
} while (!demoItem.precache());
|
|
|
|
// Ensure that the center of the "Text fields" item is visible
|
|
// because that's where we're going to tap
|
|
final Rect demoItemBounds = boundsFor(controller, demoItem);
|
|
final Rect demoListBounds = boundsFor(controller, demoList);
|
|
if (!demoListBounds.contains(demoItemBounds.center)) {
|
|
await controller.drag(demoList, Offset(0.0, demoListBounds.center.dy - demoItemBounds.center.dy));
|
|
await endOfAnimation();
|
|
}
|
|
|
|
for (int iteration = 0; iteration < 15; iteration += 1) {
|
|
debugPrint('Tapping... (iteration $iteration)');
|
|
await controller.tap(demoItem);
|
|
await endOfAnimation();
|
|
debugPrint('Backing out...');
|
|
await controller.tap(find.byTooltip('Back'));
|
|
await endOfAnimation();
|
|
await Future<void>.delayed(const Duration(milliseconds: 50));
|
|
}
|
|
|
|
debugPrint('==== MEMORY BENCHMARK ==== DONE ====');
|
|
}
|