Skip to content

Commit ad8a340

Browse files
christopherfujinogspencergoog
authored andcommitted
Revert "Remove package:image dependency (flutter#115674)" (flutter#115680)
This reverts commit cf2c9f6.
1 parent 151ae42 commit ad8a340

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

dev/integration_tests/ui/pubspec.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ environment:
88
# It can probably be removed, see the comment in that file.
99

1010
dependencies:
11+
image: 3.2.2
1112
flutter:
1213
sdk: flutter
1314
flutter_driver:
@@ -42,6 +43,7 @@ dependencies:
4243
node_preamble: 2.0.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
4344
package_config: 2.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
4445
path: 1.8.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
46+
petitparser: 5.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
4547
pool: 1.5.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
4648
pub_semver: 2.1.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
4749
shelf: 1.4.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -64,6 +66,7 @@ dependencies:
6466
web_socket_channel: 2.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
6567
webdriver: 3.0.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
6668
webkit_inspection_protocol: 1.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
69+
xml: 6.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
6770
yaml: 3.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
6871

6972
dev_dependencies:
@@ -79,4 +82,4 @@ flutter:
7982
assets:
8083
- assets/foo.png
8184

82-
# PUBSPEC CHECKSUM: 691e
85+
# PUBSPEC CHECKSUM: 321a
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// This test is used by devicelab, test "integration_ui_ios_screenshot".
6+
// Its use of package:image is, at the time of writing, the only use of that
7+
// package in this repository. If package:image is a problem, it is probably
8+
// fine to just remove this test since the value of the test is probably not
9+
// as much as the cost of the dependency.
10+
11+
import 'package:flutter_driver/flutter_driver.dart';
12+
import 'package:image/image.dart';
13+
14+
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
15+
16+
void main() {
17+
group('FlutterDriver', () {
18+
late FlutterDriver driver;
19+
20+
setUpAll(() async {
21+
driver = await FlutterDriver.connect();
22+
});
23+
24+
tearDownAll(() async {
25+
await driver.close();
26+
});
27+
28+
test('should take screenshot', () async {
29+
final SerializableFinder toggleBtn = find.byValueKey('toggle');
30+
// Cards use a magic background color that we look for in the screenshots.
31+
final Matcher cardsAreVisible = contains(getColor(0xff, 0x01, 0x02));
32+
await driver.waitFor(toggleBtn);
33+
34+
bool cardsShouldBeVisible = false;
35+
Image? imageBefore = decodePng(await driver.screenshot());
36+
for (int i = 0; i < 10; i += 1) {
37+
await driver.tap(toggleBtn);
38+
cardsShouldBeVisible = !cardsShouldBeVisible;
39+
final Image? imageAfter = decodePng(await driver.screenshot());
40+
41+
if (cardsShouldBeVisible) {
42+
expect(imageBefore?.data, isNot(cardsAreVisible));
43+
expect(imageAfter?.data, cardsAreVisible);
44+
} else {
45+
expect(imageBefore?.data, cardsAreVisible);
46+
expect(imageAfter?.data, isNot(cardsAreVisible));
47+
}
48+
49+
imageBefore = imageAfter;
50+
}
51+
}, timeout: Timeout.none);
52+
});
53+
}

0 commit comments

Comments
 (0)