2019-11-27 23:04:02 +00:00
|
|
|
// Copyright 2014 The Flutter Authors. All rights reserved.
|
2017-06-14 15:09:05 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2021-07-12 05:36:43 +00:00
|
|
|
// @dart = 2.8
|
|
|
|
|
2021-06-07 17:33:00 +00:00
|
|
|
import 'package:flutter_devicelab/framework/devices.dart';
|
2017-06-14 15:09:05 +00:00
|
|
|
import 'package:flutter_devicelab/framework/framework.dart';
|
2020-10-07 23:37:09 +00:00
|
|
|
import 'package:flutter_devicelab/framework/task_result.dart';
|
2021-04-21 20:49:03 +00:00
|
|
|
import 'package:flutter_devicelab/tasks/gallery.dart';
|
2017-06-14 15:09:05 +00:00
|
|
|
|
2021-04-06 23:28:54 +00:00
|
|
|
Future<void> main() async {
|
2017-06-14 15:09:05 +00:00
|
|
|
deviceOperatingSystem = DeviceOperatingSystem.android;
|
|
|
|
await task(() async {
|
2021-04-06 23:28:54 +00:00
|
|
|
final TaskResult withoutSemantics = await createGalleryTransitionTest()();
|
|
|
|
final TaskResult withSemantics = await createGalleryTransitionTest(semanticsEnabled: true)();
|
2021-07-12 05:36:43 +00:00
|
|
|
if (withSemantics.benchmarkScoreKeys.isEmpty || withoutSemantics.benchmarkScoreKeys.isEmpty) {
|
2020-08-14 23:37:08 +00:00
|
|
|
String message = 'Lack of data';
|
2021-07-12 05:36:43 +00:00
|
|
|
if (withSemantics.benchmarkScoreKeys.isEmpty) {
|
2020-08-14 23:37:08 +00:00
|
|
|
message += ' for test with semantics';
|
2021-07-12 05:36:43 +00:00
|
|
|
if (withoutSemantics.benchmarkScoreKeys.isEmpty) {
|
2020-08-14 23:37:08 +00:00
|
|
|
message += ' and without semantics';
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
message += 'for test without semantics';
|
|
|
|
}
|
|
|
|
return TaskResult.failure(message);
|
|
|
|
}
|
2017-06-14 15:09:05 +00:00
|
|
|
|
|
|
|
final List<String> benchmarkScoreKeys = <String>[];
|
|
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
2021-07-12 05:36:43 +00:00
|
|
|
for (final String key in withSemantics.benchmarkScoreKeys) {
|
2017-06-14 15:09:05 +00:00
|
|
|
final String deltaKey = 'delta_$key';
|
2021-07-12 05:36:43 +00:00
|
|
|
data[deltaKey] = (withSemantics.data[key] as num) - (withoutSemantics.data[key] as num);
|
|
|
|
data['semantics_$key'] = withSemantics.data[key];
|
|
|
|
data[key] = withoutSemantics.data[key];
|
2017-06-14 15:09:05 +00:00
|
|
|
benchmarkScoreKeys.add(deltaKey);
|
|
|
|
}
|
|
|
|
|
2018-09-12 06:29:29 +00:00
|
|
|
return TaskResult.success(data, benchmarkScoreKeys: benchmarkScoreKeys);
|
2017-06-14 15:09:05 +00:00
|
|
|
});
|
|
|
|
}
|