Unverified Commit 20f029e3 authored by Phil Quitslund's avatar Phil Quitslund Committed by GitHub

[devicelab, flutter_test, ...] rename local functions with `_`s (#102833)

parent adb8b607
......@@ -21,8 +21,8 @@ TaskFunction createMicrobenchmarkTask() {
await device.unlock();
await device.clearLogs();
Future<Map<String, double>> _runMicrobench(String benchmarkPath) async {
Future<Map<String, double>> _run() async {
Future<Map<String, double>> runMicrobench(String benchmarkPath) async {
Future<Map<String, double>> run() async {
print('Running $benchmarkPath');
final Directory appDir = dir(
path.join(flutterDirectory.path, 'dev/benchmarks/microbenchmarks'));
......@@ -45,25 +45,25 @@ TaskFunction createMicrobenchmarkTask() {
return readJsonResults(flutterProcess);
}
return _run();
return run();
}
final Map<String, double> allResults = <String, double>{
...await _runMicrobench('lib/stocks/layout_bench.dart'),
...await _runMicrobench('lib/stocks/build_bench.dart'),
...await _runMicrobench('lib/geometry/matrix_utils_transform_bench.dart'),
...await _runMicrobench('lib/geometry/rrect_contains_bench.dart'),
...await _runMicrobench('lib/gestures/velocity_tracker_bench.dart'),
...await _runMicrobench('lib/gestures/gesture_detector_bench.dart'),
...await _runMicrobench('lib/stocks/animation_bench.dart'),
...await _runMicrobench('lib/language/compute_bench.dart'),
...await _runMicrobench('lib/language/sync_star_bench.dart'),
...await _runMicrobench('lib/language/sync_star_semantics_bench.dart'),
...await _runMicrobench('lib/foundation/all_elements_bench.dart'),
...await _runMicrobench('lib/foundation/change_notifier_bench.dart'),
...await _runMicrobench('lib/foundation/standard_method_codec_bench.dart'),
...await _runMicrobench('lib/foundation/standard_message_codec_bench.dart'),
...await _runMicrobench('lib/foundation/timeline_bench.dart'),
...await runMicrobench('lib/stocks/layout_bench.dart'),
...await runMicrobench('lib/stocks/build_bench.dart'),
...await runMicrobench('lib/geometry/matrix_utils_transform_bench.dart'),
...await runMicrobench('lib/geometry/rrect_contains_bench.dart'),
...await runMicrobench('lib/gestures/velocity_tracker_bench.dart'),
...await runMicrobench('lib/gestures/gesture_detector_bench.dart'),
...await runMicrobench('lib/stocks/animation_bench.dart'),
...await runMicrobench('lib/language/compute_bench.dart'),
...await runMicrobench('lib/language/sync_star_bench.dart'),
...await runMicrobench('lib/language/sync_star_semantics_bench.dart'),
...await runMicrobench('lib/foundation/all_elements_bench.dart'),
...await runMicrobench('lib/foundation/change_notifier_bench.dart'),
...await runMicrobench('lib/foundation/standard_method_codec_bench.dart'),
...await runMicrobench('lib/foundation/standard_message_codec_bench.dart'),
...await runMicrobench('lib/foundation/timeline_bench.dart'),
};
return TaskResult.success(allResults,
......
......@@ -2636,7 +2636,7 @@ void main() {
}
group('SliverAppBar', () {
Widget _buildSliverApp({
Widget buildSliverApp({
required double contentHeight,
bool reverse = false,
bool includeFlexibleSpace = false,
......@@ -2674,7 +2674,7 @@ void main() {
testWidgets('backgroundColor', (WidgetTester tester) async {
await tester.pumpWidget(
_buildSliverApp(contentHeight: 1200.0)
buildSliverApp(contentHeight: 1200.0)
);
expect(getAppBarBackgroundColor(tester), defaultColor);
......@@ -2699,7 +2699,7 @@ void main() {
testWidgets('backgroundColor with FlexibleSpace', (WidgetTester tester) async {
await tester.pumpWidget(
_buildSliverApp(contentHeight: 1200.0, includeFlexibleSpace: true)
buildSliverApp(contentHeight: 1200.0, includeFlexibleSpace: true)
);
expect(getAppBarBackgroundColor(tester), defaultColor);
......@@ -2724,7 +2724,7 @@ void main() {
testWidgets('backgroundColor - reverse', (WidgetTester tester) async {
await tester.pumpWidget(
_buildSliverApp(contentHeight: 1200.0, reverse: true)
buildSliverApp(contentHeight: 1200.0, reverse: true)
);
expect(getAppBarBackgroundColor(tester), defaultColor);
......@@ -2749,7 +2749,7 @@ void main() {
testWidgets('backgroundColor with FlexibleSpace - reverse', (WidgetTester tester) async {
await tester.pumpWidget(
_buildSliverApp(
buildSliverApp(
contentHeight: 1200.0,
reverse: true,
includeFlexibleSpace: true,
......@@ -2778,7 +2778,7 @@ void main() {
testWidgets('backgroundColor - not triggered in reverse for short content', (WidgetTester tester) async {
await tester.pumpWidget(
_buildSliverApp(contentHeight: 200, reverse: true)
buildSliverApp(contentHeight: 200, reverse: true)
);
// In reverse, the content here is not long enough to scroll under the app
......@@ -2797,7 +2797,7 @@ void main() {
testWidgets('backgroundColor with FlexibleSpace - not triggered in reverse for short content', (WidgetTester tester) async {
await tester.pumpWidget(
_buildSliverApp(
buildSliverApp(
contentHeight: 200,
reverse: true,
includeFlexibleSpace: true,
......@@ -2820,7 +2820,7 @@ void main() {
});
group('AppBar', () {
Widget _buildAppBar({
Widget buildAppBar({
required double contentHeight,
bool reverse = false,
bool includeFlexibleSpace = false
......@@ -2851,7 +2851,7 @@ void main() {
testWidgets('backgroundColor', (WidgetTester tester) async {
await tester.pumpWidget(
_buildAppBar(contentHeight: 1200.0)
buildAppBar(contentHeight: 1200.0)
);
expect(getAppBarBackgroundColor(tester), defaultColor);
......@@ -2876,7 +2876,7 @@ void main() {
testWidgets('backgroundColor with FlexibleSpace', (WidgetTester tester) async {
await tester.pumpWidget(
_buildAppBar(contentHeight: 1200.0, includeFlexibleSpace: true)
buildAppBar(contentHeight: 1200.0, includeFlexibleSpace: true)
);
expect(getAppBarBackgroundColor(tester), defaultColor);
......@@ -2901,7 +2901,7 @@ void main() {
testWidgets('backgroundColor - reverse', (WidgetTester tester) async {
await tester.pumpWidget(
_buildAppBar(contentHeight: 1200.0, reverse: true)
buildAppBar(contentHeight: 1200.0, reverse: true)
);
await tester.pump();
......@@ -2929,7 +2929,7 @@ void main() {
testWidgets('backgroundColor with FlexibleSpace - reverse', (WidgetTester tester) async {
await tester.pumpWidget(
_buildAppBar(
buildAppBar(
contentHeight: 1200.0,
reverse: true,
includeFlexibleSpace: true,
......@@ -3027,7 +3027,7 @@ void main() {
testWidgets('backgroundColor - not triggered in reverse for short content', (WidgetTester tester) async {
await tester.pumpWidget(
_buildAppBar(
buildAppBar(
contentHeight: 200.0,
reverse: true,
)
......@@ -3050,7 +3050,7 @@ void main() {
testWidgets('backgroundColor with FlexibleSpace - not triggered in reverse for short content', (WidgetTester tester) async {
await tester.pumpWidget(
_buildAppBar(
buildAppBar(
contentHeight: 200.0,
reverse: true,
includeFlexibleSpace: true,
......
......@@ -226,7 +226,7 @@ void main() {
const Size kCommonScreenSizePortrait = Size(1070, 1770);
const Size kCommonScreenSizeLandscape = Size(1770, 1070);
Future<void> _showPicker(WidgetTester tester, Locale locale, Size size) async {
Future<void> showPicker(WidgetTester tester, Locale locale, Size size) async {
tester.binding.window.physicalSizeTestValue = size;
addTearDown(tester.binding.window.clearPhysicalSizeTestValue);
tester.binding.window.devicePixelRatioTestValue = 1.0;
......@@ -260,22 +260,22 @@ void main() {
// Regression test for https://github.com/flutter/flutter/issues/20171
testWidgets('common screen size - portrait - Chinese', (WidgetTester tester) async {
await _showPicker(tester, const Locale('zh', 'CN'), kCommonScreenSizePortrait);
await showPicker(tester, const Locale('zh', 'CN'), kCommonScreenSizePortrait);
expect(tester.takeException(), isNull);
});
testWidgets('common screen size - landscape - Chinese', (WidgetTester tester) async {
await _showPicker(tester, const Locale('zh', 'CN'), kCommonScreenSizeLandscape);
await showPicker(tester, const Locale('zh', 'CN'), kCommonScreenSizeLandscape);
expect(tester.takeException(), isNull);
});
testWidgets('common screen size - portrait - Japanese', (WidgetTester tester) async {
await _showPicker(tester, const Locale('ja', 'JA'), kCommonScreenSizePortrait);
await showPicker(tester, const Locale('ja', 'JA'), kCommonScreenSizePortrait);
expect(tester.takeException(), isNull);
});
testWidgets('common screen size - landscape - Japanese', (WidgetTester tester) async {
await _showPicker(tester, const Locale('ja', 'JA'), kCommonScreenSizeLandscape);
await showPicker(tester, const Locale('ja', 'JA'), kCommonScreenSizeLandscape);
expect(tester.takeException(), isNull);
});
});
......
......@@ -638,7 +638,7 @@ Map<Color, int> _colorsWithinRect(
final Map<int, int> rgbaToCount = <int, int>{};
int _getPixel(ByteData data, int x, int y) {
int getPixel(ByteData data, int x, int y) {
final int offset = (y * width + x) * 4;
return data.getUint32(offset);
}
......@@ -646,7 +646,7 @@ Map<Color, int> _colorsWithinRect(
for (int x = leftX; x < rightX; x++) {
for (int y = topY; y < bottomY; y++) {
rgbaToCount.update(
_getPixel(data, x, y),
getPixel(data, x, y),
(int count) => count + 1,
ifAbsent: () => 1,
);
......
......@@ -757,7 +757,7 @@ class KeyEventSimulator {
PhysicalKeyboardKey? physicalKey,
String? character,
}) async {
Future<bool> _simulateByRawEvent() {
Future<bool> simulateByRawEvent() {
return _simulateKeyEventByRawEvent(() {
platform ??= _defaultPlatform;
return getKeyData(key, platform: platform!, physicalKey: physicalKey, character: character);
......@@ -765,7 +765,7 @@ class KeyEventSimulator {
}
switch (_transitMode) {
case KeyDataTransitMode.rawKeyData:
return _simulateByRawEvent();
return simulateByRawEvent();
case KeyDataTransitMode.keyDataThenRawKeyData:
final LogicalKeyboardKey logicalKey = _getKeySynonym(key);
final bool resultByKeyEvent = ServicesBinding.instance.keyEventManager.handleKeyData(
......@@ -778,7 +778,7 @@ class KeyEventSimulator {
synthesized: false,
),
);
return (await _simulateByRawEvent()) || resultByKeyEvent;
return (await simulateByRawEvent()) || resultByKeyEvent;
}
}
......@@ -802,7 +802,7 @@ class KeyEventSimulator {
String? platform,
PhysicalKeyboardKey? physicalKey,
}) async {
Future<bool> _simulateByRawEvent() {
Future<bool> simulateByRawEvent() {
return _simulateKeyEventByRawEvent(() {
platform ??= _defaultPlatform;
return getKeyData(key, platform: platform!, isDown: false, physicalKey: physicalKey);
......@@ -810,7 +810,7 @@ class KeyEventSimulator {
}
switch (_transitMode) {
case KeyDataTransitMode.rawKeyData:
return _simulateByRawEvent();
return simulateByRawEvent();
case KeyDataTransitMode.keyDataThenRawKeyData:
final LogicalKeyboardKey logicalKey = _getKeySynonym(key);
final bool resultByKeyEvent = ServicesBinding.instance.keyEventManager.handleKeyData(
......@@ -823,7 +823,7 @@ class KeyEventSimulator {
synthesized: false,
),
);
return (await _simulateByRawEvent()) || resultByKeyEvent;
return (await simulateByRawEvent()) || resultByKeyEvent;
}
}
......@@ -848,7 +848,7 @@ class KeyEventSimulator {
PhysicalKeyboardKey? physicalKey,
String? character,
}) async {
Future<bool> _simulateByRawEvent() {
Future<bool> simulateByRawEvent() {
return _simulateKeyEventByRawEvent(() {
platform ??= _defaultPlatform;
return getKeyData(key, platform: platform!, physicalKey: physicalKey, character: character);
......@@ -856,7 +856,7 @@ class KeyEventSimulator {
}
switch (_transitMode) {
case KeyDataTransitMode.rawKeyData:
return _simulateByRawEvent();
return simulateByRawEvent();
case KeyDataTransitMode.keyDataThenRawKeyData:
final LogicalKeyboardKey logicalKey = _getKeySynonym(key);
final bool resultByKeyEvent = ServicesBinding.instance.keyEventManager.handleKeyData(
......@@ -869,7 +869,7 @@ class KeyEventSimulator {
synthesized: false,
),
);
return (await _simulateByRawEvent()) || resultByKeyEvent;
return (await simulateByRawEvent()) || resultByKeyEvent;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment