forked from flutter/plugins
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add old gallery page transition (#106701)
- Loading branch information
1 parent
b731aee
commit 98f0c36
Showing
5 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// 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_devicelab/framework/devices.dart'; | ||
import 'package:flutter_devicelab/framework/framework.dart'; | ||
import 'package:flutter_devicelab/framework/utils.dart'; | ||
import 'package:flutter_devicelab/tasks/perf_tests.dart'; | ||
|
||
void main() async { | ||
deviceOperatingSystem = DeviceOperatingSystem.android; | ||
await task(PerfTest( | ||
'${flutterDirectory.path}/dev/integration_tests/flutter_gallery', | ||
'test_driver/page_transitions_perf.dart', | ||
'page_transition_perf', | ||
).run); | ||
} |
14 changes: 14 additions & 0 deletions
14
dev/integration_tests/flutter_gallery/test_driver/page_transitions_perf.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// 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_driver/driver_extension.dart'; | ||
import 'package:flutter_gallery/gallery/app.dart' show GalleryApp; | ||
|
||
void main() { | ||
enableFlutterDriverExtension(); | ||
// As in lib/main.dart: overriding https://github.com/flutter/flutter/issues/13736 | ||
// for better visual effect at the cost of performance. | ||
runApp(const GalleryApp(testMode: true)); | ||
} |
39 changes: 39 additions & 0 deletions
39
dev/integration_tests/flutter_gallery/test_driver/page_transitions_perf_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// 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_driver/flutter_driver.dart'; | ||
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf; | ||
|
||
void main() { | ||
group('page transition performance test', () { | ||
late FlutterDriver driver; | ||
|
||
setUpAll(() async { | ||
driver = await FlutterDriver.connect(); | ||
|
||
await driver.waitUntilFirstFrameRasterized(); | ||
}); | ||
|
||
tearDownAll(() async { | ||
driver.close(); | ||
}); | ||
|
||
test('measure', () async { | ||
final Timeline timeline = await driver.traceAction(() async { | ||
await driver.tap(find.text('Material')); | ||
|
||
for (int i = 0; i < 10; i++) { | ||
await driver.tap(find.text('Banner')); | ||
await Future<void>.delayed(const Duration(milliseconds: 500)); | ||
await driver.waitFor(find.byTooltip('Back')); | ||
await driver.tap(find.byTooltip('Back')); | ||
await Future<void>.delayed(const Duration(milliseconds: 500)); | ||
} | ||
}); | ||
|
||
final TimelineSummary summary = TimelineSummary.summarize(timeline); | ||
await summary.writeTimelineToFile('page_transition_perf', pretty: true); | ||
}, timeout: Timeout.none); | ||
}); | ||
} |