Use MultiFrameImageStreamProvider in the various image providers. (#12997)
This commit is contained in:
@@ -3,12 +3,15 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart' show createHttpClient;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../lib/card_collection.dart' as card_collection;
|
||||
import 'mock_image_http.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Card Collection smoke test', (WidgetTester tester) async {
|
||||
createHttpClient = createMockImageHttpClient;
|
||||
card_collection.main(); // builds the app and schedules a frame but doesn't trigger one
|
||||
await tester.pump(); // see https://github.com/flutter/flutter/issues/1865
|
||||
await tester.pump(); // triggers a frame
|
||||
|
||||
@@ -3,12 +3,16 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart' show createHttpClient;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../lib/color_testing_demo.dart' as color_testing_demo;
|
||||
import 'mock_image_http.dart';
|
||||
|
||||
void main() {
|
||||
|
||||
testWidgets('Color testing demo smoke test', (WidgetTester tester) async {
|
||||
createHttpClient = createMockImageHttpClient;
|
||||
color_testing_demo.main(); // builds the app and schedules a frame but doesn't trigger one
|
||||
await tester.pump(); // see https://github.com/flutter/flutter/issues/1865
|
||||
await tester.pump(); // triggers a frame
|
||||
|
||||
15
dev/manual_tests/test/mock_image_http.dart
Normal file
15
dev/manual_tests/test/mock_image_http.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/foundation.dart' show ValueGetter;
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:http/testing.dart' as http;
|
||||
|
||||
import '../../../packages/flutter/test/services/image_data.dart';
|
||||
|
||||
// Returns a mock HTTP client that responds with an image to all requests.
|
||||
ValueGetter<http.Client> createMockImageHttpClient = () {
|
||||
return new http.MockClient((http.BaseRequest request) {
|
||||
return new Future<http.Response>.value(
|
||||
new http.Response.bytes(kTransparentImage, 200, request: request)
|
||||
);
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user