mirror of
https://github.com/flutter/packages.git
synced 2025-07-01 15:23:25 +08:00
[image_picker_platform_interface] fix test asset file location (#3467)
This commit is contained in:
@ -11,17 +11,8 @@ import 'dart:typed_data';
|
|||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:cross_file/cross_file.dart';
|
import 'package:cross_file/cross_file.dart';
|
||||||
|
|
||||||
// Please note that executing this test with command
|
final pathPrefix =
|
||||||
// `flutter test test/x_file_io_test.dart` will set the directory
|
Directory.current.path.endsWith('test') ? './assets/' : './test/assets/';
|
||||||
// to ./file_selector_platform_interface.
|
|
||||||
//
|
|
||||||
// This will cause our hello.txt file to be not be found. Please
|
|
||||||
// execute this test with `flutter test` or change the path prefix
|
|
||||||
// to ./test/assets/
|
|
||||||
//
|
|
||||||
// https://github.com/flutter/flutter/issues/20907
|
|
||||||
|
|
||||||
final pathPrefix = './assets/';
|
|
||||||
final path = pathPrefix + 'hello.txt';
|
final path = pathPrefix + 'hello.txt';
|
||||||
final String expectedStringContents = 'Hello, world!';
|
final String expectedStringContents = 'Hello, world!';
|
||||||
final Uint8List bytes = Uint8List.fromList(utf8.encode(expectedStringContents));
|
final Uint8List bytes = Uint8List.fromList(utf8.encode(expectedStringContents));
|
||||||
@ -30,7 +21,7 @@ final String textFilePath = textFile.path;
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
group('Create with a path', () {
|
group('Create with a path', () {
|
||||||
final file = XFile(textFilePath);
|
final XFile file = XFile(textFilePath);
|
||||||
|
|
||||||
test('Can be read as a string', () async {
|
test('Can be read as a string', () async {
|
||||||
expect(await file.readAsString(), equals(expectedStringContents));
|
expect(await file.readAsString(), equals(expectedStringContents));
|
||||||
|
Reference in New Issue
Block a user