Skip to content

Commit 1aaf89f

Browse files
authored
Remove group() support from package:litetest (flutter#26342)
1 parent c5195ea commit 1aaf89f

File tree

7 files changed

+511
-593
lines changed

7 files changed

+511
-593
lines changed

testing/dart/dart_test.dart

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,17 @@ import 'package:litetest/litetest.dart';
99

1010
/// Verifies Dart semantics governed by flags set by Flutter tooling.
1111
void main() {
12-
group('Async', () {
13-
String greeting = 'hello';
14-
Future<void> changeGreeting() async {
15-
greeting += ' 1';
16-
await Future<void>.value(null);
17-
greeting += ' 2';
18-
}
19-
test('execution of async method starts synchronously', () async {
20-
expect(greeting, 'hello');
21-
final Future<void> future = changeGreeting();
22-
expect(greeting, 'hello 1');
23-
await future;
24-
expect(greeting, 'hello 1 2');
25-
});
12+
String greeting = 'hello';
13+
Future<void> changeGreeting() async {
14+
greeting += ' 1';
15+
await Future<void>.value(null);
16+
greeting += ' 2';
17+
}
18+
test('execution of async method starts synchronously', () async {
19+
expect(greeting, 'hello');
20+
final Future<void> future = changeGreeting();
21+
expect(greeting, 'hello 1');
22+
await future;
23+
expect(greeting, 'hello 1 2');
2624
});
2725
}

testing/dart/encoding_test.dart

Lines changed: 33 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,47 +18,39 @@ const Color _kBlack = Color.fromRGBO(0, 0, 0, 1.0);
1818
const Color _kGreen = Color.fromRGBO(0, 255, 0, 1.0);
1919

2020
void main() {
21-
group('Image.toByteData', () {
22-
group('RGBA format', () {
23-
test('works with simple image', () async {
24-
final Image image = await Square4x4Image.image;
25-
final ByteData data = await image.toByteData();
26-
expect(Uint8List.view(data.buffer), Square4x4Image.bytes);
27-
});
28-
29-
test('converts grayscale images', () async {
30-
final Image image = await GrayscaleImage.load();
31-
final ByteData data = await image.toByteData();
32-
final Uint8List bytes = data.buffer.asUint8List();
33-
expect(bytes, hasLength(16));
34-
expect(bytes, GrayscaleImage.bytesAsRgba);
35-
});
36-
});
37-
38-
group('Unmodified format', () {
39-
test('works with simple image', () async {
40-
final Image image = await Square4x4Image.image;
41-
final ByteData data = await image.toByteData(format: ImageByteFormat.rawUnmodified);
42-
expect(Uint8List.view(data.buffer), Square4x4Image.bytes);
43-
});
44-
45-
test('works with grayscale images', () async {
46-
final Image image = await GrayscaleImage.load();
47-
final ByteData data = await image.toByteData(format: ImageByteFormat.rawUnmodified);
48-
final Uint8List bytes = data.buffer.asUint8List();
49-
expect(bytes, hasLength(4));
50-
expect(bytes, GrayscaleImage.bytesUnmodified);
51-
});
52-
});
53-
54-
group('PNG format', () {
55-
test('works with simple image', () async {
56-
final Image image = await Square4x4Image.image;
57-
final ByteData data = await image.toByteData(format: ImageByteFormat.png);
58-
final List<int> expected = await readFile('square.png');
59-
expect(Uint8List.view(data.buffer), expected);
60-
});
61-
});
21+
test('Image.toByteData RGBA format works with simple image', () async {
22+
final Image image = await Square4x4Image.image;
23+
final ByteData data = await image.toByteData();
24+
expect(Uint8List.view(data.buffer), Square4x4Image.bytes);
25+
});
26+
27+
test('Image.toByteData RGBA format converts grayscale images', () async {
28+
final Image image = await GrayscaleImage.load();
29+
final ByteData data = await image.toByteData();
30+
final Uint8List bytes = data.buffer.asUint8List();
31+
expect(bytes, hasLength(16));
32+
expect(bytes, GrayscaleImage.bytesAsRgba);
33+
});
34+
35+
test('Image.toByteData Unmodified format works with simple image', () async {
36+
final Image image = await Square4x4Image.image;
37+
final ByteData data = await image.toByteData(format: ImageByteFormat.rawUnmodified);
38+
expect(Uint8List.view(data.buffer), Square4x4Image.bytes);
39+
});
40+
41+
test('Image.toByteData Unmodified format works with grayscale images', () async {
42+
final Image image = await GrayscaleImage.load();
43+
final ByteData data = await image.toByteData(format: ImageByteFormat.rawUnmodified);
44+
final Uint8List bytes = data.buffer.asUint8List();
45+
expect(bytes, hasLength(4));
46+
expect(bytes, GrayscaleImage.bytesUnmodified);
47+
});
48+
49+
test('Image.toByteData PNG format works with simple image', () async {
50+
final Image image = await Square4x4Image.image;
51+
final ByteData data = await image.toByteData(format: ImageByteFormat.png);
52+
final List<int> expected = await readFile('square.png');
53+
expect(Uint8List.view(data.buffer), expected);
6254
});
6355
}
6456

0 commit comments

Comments
 (0)