Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Remove group() support from package:litetest #26342

Merged
merged 1 commit into from
May 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions testing/dart/dart_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,17 @@ import 'package:litetest/litetest.dart';

/// Verifies Dart semantics governed by flags set by Flutter tooling.
void main() {
group('Async', () {
String greeting = 'hello';
Future<void> changeGreeting() async {
greeting += ' 1';
await Future<void>.value(null);
greeting += ' 2';
}
test('execution of async method starts synchronously', () async {
expect(greeting, 'hello');
final Future<void> future = changeGreeting();
expect(greeting, 'hello 1');
await future;
expect(greeting, 'hello 1 2');
});
String greeting = 'hello';
Future<void> changeGreeting() async {
greeting += ' 1';
await Future<void>.value(null);
greeting += ' 2';
}
test('execution of async method starts synchronously', () async {
expect(greeting, 'hello');
final Future<void> future = changeGreeting();
expect(greeting, 'hello 1');
await future;
expect(greeting, 'hello 1 2');
});
}
74 changes: 33 additions & 41 deletions testing/dart/encoding_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,47 +18,39 @@ const Color _kBlack = Color.fromRGBO(0, 0, 0, 1.0);
const Color _kGreen = Color.fromRGBO(0, 255, 0, 1.0);

void main() {
group('Image.toByteData', () {
group('RGBA format', () {
test('works with simple image', () async {
final Image image = await Square4x4Image.image;
final ByteData data = await image.toByteData();
expect(Uint8List.view(data.buffer), Square4x4Image.bytes);
});

test('converts grayscale images', () async {
final Image image = await GrayscaleImage.load();
final ByteData data = await image.toByteData();
final Uint8List bytes = data.buffer.asUint8List();
expect(bytes, hasLength(16));
expect(bytes, GrayscaleImage.bytesAsRgba);
});
});

group('Unmodified format', () {
test('works with simple image', () async {
final Image image = await Square4x4Image.image;
final ByteData data = await image.toByteData(format: ImageByteFormat.rawUnmodified);
expect(Uint8List.view(data.buffer), Square4x4Image.bytes);
});

test('works with grayscale images', () async {
final Image image = await GrayscaleImage.load();
final ByteData data = await image.toByteData(format: ImageByteFormat.rawUnmodified);
final Uint8List bytes = data.buffer.asUint8List();
expect(bytes, hasLength(4));
expect(bytes, GrayscaleImage.bytesUnmodified);
});
});

group('PNG format', () {
test('works with simple image', () async {
final Image image = await Square4x4Image.image;
final ByteData data = await image.toByteData(format: ImageByteFormat.png);
final List<int> expected = await readFile('square.png');
expect(Uint8List.view(data.buffer), expected);
});
});
test('Image.toByteData RGBA format works with simple image', () async {
final Image image = await Square4x4Image.image;
final ByteData data = await image.toByteData();
expect(Uint8List.view(data.buffer), Square4x4Image.bytes);
});

test('Image.toByteData RGBA format converts grayscale images', () async {
final Image image = await GrayscaleImage.load();
final ByteData data = await image.toByteData();
final Uint8List bytes = data.buffer.asUint8List();
expect(bytes, hasLength(16));
expect(bytes, GrayscaleImage.bytesAsRgba);
});

test('Image.toByteData Unmodified format works with simple image', () async {
final Image image = await Square4x4Image.image;
final ByteData data = await image.toByteData(format: ImageByteFormat.rawUnmodified);
expect(Uint8List.view(data.buffer), Square4x4Image.bytes);
});

test('Image.toByteData Unmodified format works with grayscale images', () async {
final Image image = await GrayscaleImage.load();
final ByteData data = await image.toByteData(format: ImageByteFormat.rawUnmodified);
final Uint8List bytes = data.buffer.asUint8List();
expect(bytes, hasLength(4));
expect(bytes, GrayscaleImage.bytesUnmodified);
});

test('Image.toByteData PNG format works with simple image', () async {
final Image image = await Square4x4Image.image;
final ByteData data = await image.toByteData(format: ImageByteFormat.png);
final List<int> expected = await readFile('square.png');
expect(Uint8List.view(data.buffer), expected);
});
}

Expand Down
Loading