Unverified Commit 42fa4f03 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Migrate some more non-test utils for tests (#67351)

parent 8998167d
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
class Dessert {
Dessert(this.name, this.calories, this.fat, this.carbs, this.protein, this.sodium, this.calcium, this.iron);
......
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/services.dart';
/// Tracks how often feedback has been requested since its instantiation.
......
......@@ -10,7 +10,6 @@ import 'package:flutter/painting.dart';
import 'package:flutter_test/flutter_test.dart';
class TestImageProvider extends ImageProvider<TestImageProvider> {
TestImageProvider(this.testImage);
......
......@@ -2,15 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'dart:typed_data';
import 'package:flutter/services.dart';
import '../flutter_test_alternative.dart';
void checkEncoding<T>(MessageCodec<T> codec, T message, List<int> expectedBytes) {
final ByteData encoded = codec.encodeMessage(message);
final ByteData encoded = codec.encodeMessage(message)!;
expect(
encoded.buffer.asUint8List(0, encoded.lengthInBytes),
orderedEquals(expectedBytes),
......@@ -18,17 +16,17 @@ void checkEncoding<T>(MessageCodec<T> codec, T message, List<int> expectedBytes)
}
void checkEncodeDecode<T>(MessageCodec<T> codec, T message) {
final ByteData encoded = codec.encodeMessage(message);
final ByteData? encoded = codec.encodeMessage(message);
final T decoded = codec.decodeMessage(encoded);
if (message == null) {
expect(encoded, isNull);
expect(decoded, isNull);
} else {
expect(deepEquals(message, decoded), isTrue);
final ByteData encodedAgain = codec.encodeMessage(decoded);
final ByteData encodedAgain = codec.encodeMessage(decoded)!;
expect(
encodedAgain.buffer.asUint8List(),
orderedEquals(encoded.buffer.asUint8List()),
orderedEquals(encoded!.buffer.asUint8List()),
);
}
}
......
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