mirror of
https://github.com/flutter/packages.git
synced 2025-06-30 14:47:22 +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:cross_file/cross_file.dart';
|
||||
|
||||
// Please note that executing this test with command
|
||||
// `flutter test test/x_file_io_test.dart` will set the directory
|
||||
// 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 pathPrefix =
|
||||
Directory.current.path.endsWith('test') ? './assets/' : './test/assets/';
|
||||
final path = pathPrefix + 'hello.txt';
|
||||
final String expectedStringContents = 'Hello, world!';
|
||||
final Uint8List bytes = Uint8List.fromList(utf8.encode(expectedStringContents));
|
||||
@ -30,7 +21,7 @@ final String textFilePath = textFile.path;
|
||||
|
||||
void main() {
|
||||
group('Create with a path', () {
|
||||
final file = XFile(textFilePath);
|
||||
final XFile file = XFile(textFilePath);
|
||||
|
||||
test('Can be read as a string', () async {
|
||||
expect(await file.readAsString(), equals(expectedStringContents));
|
||||
|
Reference in New Issue
Block a user