Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
90a592bf
Unverified
Commit
90a592bf
authored
May 14, 2022
by
Jonah Williams
Committed by
GitHub
May 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] fix test asset loading (#103667)
parent
d3b80f88
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
28 additions
and
20 deletions
+28
-20
package_assets_test.dart
dev/automated_tests/flutter_test/package_assets_test.dart
+0
-1
pubspec.yaml
dev/automated_tests/pubspec.yaml
+1
-1
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+4
-1
flutter_platform.dart
packages/flutter_tools/lib/src/test/flutter_platform.dart
+5
-5
flutter_tester_device.dart
...ges/flutter_tools/lib/src/test/flutter_tester_device.dart
+7
-5
runner.dart
packages/flutter_tools/lib/src/test/runner.dart
+3
-3
test_test.dart
...flutter_tools/test/commands.shard/hermetic/test_test.dart
+1
-1
flutter_platform_test.dart
...utter_tools/test/general.shard/flutter_platform_test.dart
+2
-2
flutter_tester_device_test.dart
..._tools/test/general.shard/flutter_tester_device_test.dart
+5
-1
No files found.
dev/automated_tests/flutter_test/package_assets_test.dart
View file @
90a592bf
...
@@ -13,7 +13,6 @@ void main() {
...
@@ -13,7 +13,6 @@ void main() {
width:
54
,
width:
54
,
height:
54
,
height:
54
,
fit:
BoxFit
.
none
,
fit:
BoxFit
.
none
,
package:
'flutter_automated_tests'
,
),
),
);
);
});
});
...
...
dev/automated_tests/pubspec.yaml
View file @
90a592bf
...
@@ -70,6 +70,6 @@ dependencies:
...
@@ -70,6 +70,6 @@ dependencies:
flutter
:
flutter
:
uses-material-design
:
true
uses-material-design
:
true
assets
:
assets
:
-
icon/
-
icon/test.png
# PUBSPEC CHECKSUM: 53c0
# PUBSPEC CHECKSUM: 53c0
packages/flutter_tools/lib/src/commands/test.dart
View file @
90a592bf
...
@@ -320,8 +320,11 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
...
@@ -320,8 +320,11 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
);
);
}
}
String
testAssetDirectory
;
if
(
buildTestAssets
)
{
if
(
buildTestAssets
)
{
await
_buildTestAsset
();
await
_buildTestAsset
();
testAssetDirectory
=
globals
.
fs
.
path
.
join
(
flutterProject
?.
directory
?.
path
??
''
,
'build'
,
'unit_test_assets'
);
}
}
final
bool
startPaused
=
boolArgDeprecated
(
'start-paused'
);
final
bool
startPaused
=
boolArgDeprecated
(
'start-paused'
);
...
@@ -444,7 +447,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
...
@@ -444,7 +447,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
machine:
machine
,
machine:
machine
,
updateGoldens:
boolArgDeprecated
(
'update-goldens'
),
updateGoldens:
boolArgDeprecated
(
'update-goldens'
),
concurrency:
jobs
,
concurrency:
jobs
,
buildTestAssets:
buildTestAssets
,
testAssetDirectory:
testAssetDirectory
,
flutterProject:
flutterProject
,
flutterProject:
flutterProject
,
web:
stringArgDeprecated
(
'platform'
)
==
'chrome'
,
web:
stringArgDeprecated
(
'platform'
)
==
'chrome'
,
randomSeed:
stringArgDeprecated
(
'test-randomize-ordering-seed'
),
randomSeed:
stringArgDeprecated
(
'test-randomize-ordering-seed'
),
...
...
packages/flutter_tools/lib/src/test/flutter_platform.dart
View file @
90a592bf
...
@@ -55,7 +55,7 @@ FlutterPlatform installHook({
...
@@ -55,7 +55,7 @@ FlutterPlatform installHook({
String
precompiledDillPath
,
String
precompiledDillPath
,
Map
<
String
,
String
>
precompiledDillFiles
,
Map
<
String
,
String
>
precompiledDillFiles
,
bool
updateGoldens
=
false
,
bool
updateGoldens
=
false
,
bool
buildTestAssets
=
false
,
String
testAssetDirectory
,
InternetAddressType
serverType
=
InternetAddressType
.
IPv4
,
InternetAddressType
serverType
=
InternetAddressType
.
IPv4
,
Uri
projectRootDirectory
,
Uri
projectRootDirectory
,
FlutterProject
flutterProject
,
FlutterProject
flutterProject
,
...
@@ -86,7 +86,7 @@ FlutterPlatform installHook({
...
@@ -86,7 +86,7 @@ FlutterPlatform installHook({
precompiledDillPath:
precompiledDillPath
,
precompiledDillPath:
precompiledDillPath
,
precompiledDillFiles:
precompiledDillFiles
,
precompiledDillFiles:
precompiledDillFiles
,
updateGoldens:
updateGoldens
,
updateGoldens:
updateGoldens
,
buildTestAssets:
buildTestAssets
,
testAssetDirectory:
testAssetDirectory
,
projectRootDirectory:
projectRootDirectory
,
projectRootDirectory:
projectRootDirectory
,
flutterProject:
flutterProject
,
flutterProject:
flutterProject
,
icudtlPath:
icudtlPath
,
icudtlPath:
icudtlPath
,
...
@@ -280,7 +280,7 @@ class FlutterPlatform extends PlatformPlugin {
...
@@ -280,7 +280,7 @@ class FlutterPlatform extends PlatformPlugin {
this.precompiledDillPath,
this.precompiledDillPath,
this.precompiledDillFiles,
this.precompiledDillFiles,
this.updateGoldens,
this.updateGoldens,
this.
buildTestAssets
,
this.
testAssetDirectory
,
this.projectRootDirectory,
this.projectRootDirectory,
this.flutterProject,
this.flutterProject,
this.icudtlPath,
this.icudtlPath,
...
@@ -297,7 +297,7 @@ class FlutterPlatform extends PlatformPlugin {
...
@@ -297,7 +297,7 @@ class FlutterPlatform extends PlatformPlugin {
final String precompiledDillPath;
final String precompiledDillPath;
final Map<String, String> precompiledDillFiles;
final Map<String, String> precompiledDillFiles;
final bool updateGoldens;
final bool updateGoldens;
final
bool buildTestAssets
;
final
String testAssetDirectory
;
final Uri projectRootDirectory;
final Uri projectRootDirectory;
final FlutterProject flutterProject;
final FlutterProject flutterProject;
final String icudtlPath;
final String icudtlPath;
...
@@ -419,7 +419,7 @@ class FlutterPlatform extends PlatformPlugin {
...
@@ -419,7 +419,7 @@ class FlutterPlatform extends PlatformPlugin {
machine:
machine
,
machine:
machine
,
debuggingOptions:
debuggingOptions
,
debuggingOptions:
debuggingOptions
,
host:
host
,
host:
host
,
buildTestAssets:
buildTestAssets
,
testAssetDirectory:
testAssetDirectory
,
flutterProject:
flutterProject
,
flutterProject:
flutterProject
,
icudtlPath:
icudtlPath
,
icudtlPath:
icudtlPath
,
compileExpression:
_compileExpressionService
,
compileExpression:
_compileExpressionService
,
...
...
packages/flutter_tools/lib/src/test/flutter_tester_device.dart
View file @
90a592bf
...
@@ -39,7 +39,7 @@ class FlutterTesterTestDevice extends TestDevice {
...
@@ -39,7 +39,7 @@ class FlutterTesterTestDevice extends TestDevice {
@required
this
.
enableObservatory
,
@required
this
.
enableObservatory
,
@required
this
.
machine
,
@required
this
.
machine
,
@required
this
.
host
,
@required
this
.
host
,
@required
this
.
buildTestAssets
,
@required
this
.
testAssetDirectory
,
@required
this
.
flutterProject
,
@required
this
.
flutterProject
,
@required
this
.
icudtlPath
,
@required
this
.
icudtlPath
,
@required
this
.
compileExpression
,
@required
this
.
compileExpression
,
...
@@ -66,7 +66,7 @@ class FlutterTesterTestDevice extends TestDevice {
...
@@ -66,7 +66,7 @@ class FlutterTesterTestDevice extends TestDevice {
final
bool
enableObservatory
;
final
bool
enableObservatory
;
final
bool
machine
;
final
bool
machine
;
final
InternetAddress
host
;
final
InternetAddress
host
;
final
bool
buildTestAssets
;
final
String
testAssetDirectory
;
final
FlutterProject
flutterProject
;
final
FlutterProject
flutterProject
;
final
String
icudtlPath
;
final
String
icudtlPath
;
final
CompileExpression
compileExpression
;
final
CompileExpression
compileExpression
;
...
@@ -93,7 +93,6 @@ class FlutterTesterTestDevice extends TestDevice {
...
@@ -93,7 +93,6 @@ class FlutterTesterTestDevice extends TestDevice {
// Let the server choose an unused port.
// Let the server choose an unused port.
_server
=
await
bind
(
host
,
/*port*/
0
);
_server
=
await
bind
(
host
,
/*port*/
0
);
logger
.
printTrace
(
'test
$id
: test harness socket server is running at port:
${_server.port}
'
);
logger
.
printTrace
(
'test
$id
: test harness socket server is running at port:
${_server.port}
'
);
final
List
<
String
>
command
=
<
String
>[
final
List
<
String
>
command
=
<
String
>[
// Until an arm64 flutter tester binary is available, force to run in Rosetta
// Until an arm64 flutter tester binary is available, force to run in Rosetta
// to avoid "unexpectedly got a signal in sigtramp" crash.
// to avoid "unexpectedly got a signal in sigtramp" crash.
...
@@ -128,7 +127,10 @@ class FlutterTesterTestDevice extends TestDevice {
...
@@ -128,7 +127,10 @@ class FlutterTesterTestDevice extends TestDevice {
'--enable-dart-profiling'
,
'--enable-dart-profiling'
,
'--non-interactive'
,
'--non-interactive'
,
'--use-test-fonts'
,
'--use-test-fonts'
,
'--disable-asset-fonts'
,
'--packages=
${debuggingOptions.buildInfo.packagesPath}
'
,
'--packages=
${debuggingOptions.buildInfo.packagesPath}
'
,
if
(
testAssetDirectory
!=
null
)
'--flutter-assets-dir=
$testAssetDirectory
'
,
if
(
debuggingOptions
.
nullAssertions
)
if
(
debuggingOptions
.
nullAssertions
)
'--dart-flags=--null_assertions'
,
'--dart-flags=--null_assertions'
,
...
debuggingOptions
.
dartEntrypointArgs
,
...
debuggingOptions
.
dartEntrypointArgs
,
...
@@ -148,8 +150,8 @@ class FlutterTesterTestDevice extends TestDevice {
...
@@ -148,8 +150,8 @@ class FlutterTesterTestDevice extends TestDevice {
'FONTCONFIG_FILE'
:
fontConfigManager
.
fontConfigFile
.
path
,
'FONTCONFIG_FILE'
:
fontConfigManager
.
fontConfigFile
.
path
,
'SERVER_PORT'
:
_server
.
port
.
toString
(),
'SERVER_PORT'
:
_server
.
port
.
toString
(),
'APP_NAME'
:
flutterProject
?.
manifest
?.
appName
??
''
,
'APP_NAME'
:
flutterProject
?.
manifest
?.
appName
??
''
,
if
(
buildTestAssets
)
if
(
testAssetDirectory
!=
null
)
'UNIT_TEST_ASSETS'
:
fileSystem
.
path
.
join
(
flutterProject
?.
directory
?.
path
??
''
,
'build'
,
'unit_test_assets'
)
,
'UNIT_TEST_ASSETS'
:
testAssetDirectory
,
};
};
logger
.
printTrace
(
'test
$id
: Starting flutter_tester process with command=
$command
, environment=
$environment
'
);
logger
.
printTrace
(
'test
$id
: Starting flutter_tester process with command=
$command
, environment=
$environment
'
);
...
...
packages/flutter_tools/lib/src/test/runner.dart
View file @
90a592bf
...
@@ -42,7 +42,7 @@ abstract class FlutterTestRunner {
...
@@ -42,7 +42,7 @@ abstract class FlutterTestRunner {
bool
updateGoldens
=
false
,
bool
updateGoldens
=
false
,
TestWatcher
watcher
,
TestWatcher
watcher
,
@required
int
concurrency
,
@required
int
concurrency
,
bool
buildTestAssets
=
false
,
String
testAssetDirectory
,
FlutterProject
flutterProject
,
FlutterProject
flutterProject
,
String
icudtlPath
,
String
icudtlPath
,
Directory
coverageDirectory
,
Directory
coverageDirectory
,
...
@@ -78,7 +78,7 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
...
@@ -78,7 +78,7 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
bool
updateGoldens
=
false
,
bool
updateGoldens
=
false
,
TestWatcher
watcher
,
TestWatcher
watcher
,
@required
int
concurrency
,
@required
int
concurrency
,
bool
buildTestAssets
=
false
,
String
testAssetDirectory
,
FlutterProject
flutterProject
,
FlutterProject
flutterProject
,
String
icudtlPath
,
String
icudtlPath
,
Directory
coverageDirectory
,
Directory
coverageDirectory
,
...
@@ -202,7 +202,7 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
...
@@ -202,7 +202,7 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
precompiledDillPath:
precompiledDillPath
,
precompiledDillPath:
precompiledDillPath
,
precompiledDillFiles:
precompiledDillFiles
,
precompiledDillFiles:
precompiledDillFiles
,
updateGoldens:
updateGoldens
,
updateGoldens:
updateGoldens
,
buildTestAssets:
buildTestAssets
,
testAssetDirectory:
testAssetDirectory
,
projectRootDirectory:
globals
.
fs
.
currentDirectory
.
uri
,
projectRootDirectory:
globals
.
fs
.
currentDirectory
.
uri
,
flutterProject:
flutterProject
,
flutterProject:
flutterProject
,
icudtlPath:
icudtlPath
,
icudtlPath:
icudtlPath
,
...
...
packages/flutter_tools/test/commands.shard/hermetic/test_test.dart
View file @
90a592bf
...
@@ -754,7 +754,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
...
@@ -754,7 +754,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
bool
updateGoldens
=
false
,
bool
updateGoldens
=
false
,
TestWatcher
watcher
,
TestWatcher
watcher
,
int
concurrency
,
int
concurrency
,
bool
buildTestAssets
=
false
,
String
testAssetDirectory
,
FlutterProject
flutterProject
,
FlutterProject
flutterProject
,
String
icudtlPath
,
String
icudtlPath
,
Directory
coverageDirectory
,
Directory
coverageDirectory
,
...
...
packages/flutter_tools/test/general.shard/flutter_platform_test.dart
View file @
90a592bf
...
@@ -95,7 +95,7 @@ void main() {
...
@@ -95,7 +95,7 @@ void main() {
precompiledDillPath:
'def'
,
precompiledDillPath:
'def'
,
precompiledDillFiles:
expectedPrecompiledDillFiles
,
precompiledDillFiles:
expectedPrecompiledDillFiles
,
updateGoldens:
true
,
updateGoldens:
true
,
buildTestAssets:
true
,
testAssetDirectory:
'/build/test'
,
serverType:
InternetAddressType
.
IPv6
,
serverType:
InternetAddressType
.
IPv6
,
icudtlPath:
'ghi'
,
icudtlPath:
'ghi'
,
platformPluginRegistration:
(
FlutterPlatform
platform
)
{
platformPluginRegistration:
(
FlutterPlatform
platform
)
{
...
@@ -114,7 +114,7 @@ void main() {
...
@@ -114,7 +114,7 @@ void main() {
expect
(
flutterPlatform
.
precompiledDillPath
,
equals
(
'def'
));
expect
(
flutterPlatform
.
precompiledDillPath
,
equals
(
'def'
));
expect
(
flutterPlatform
.
precompiledDillFiles
,
expectedPrecompiledDillFiles
);
expect
(
flutterPlatform
.
precompiledDillFiles
,
expectedPrecompiledDillFiles
);
expect
(
flutterPlatform
.
updateGoldens
,
equals
(
true
));
expect
(
flutterPlatform
.
updateGoldens
,
equals
(
true
));
expect
(
flutterPlatform
.
buildTestAssets
,
equals
(
true
)
);
expect
(
flutterPlatform
.
testAssetDirectory
,
'/build/test'
);
expect
(
flutterPlatform
.
icudtlPath
,
equals
(
'ghi'
));
expect
(
flutterPlatform
.
icudtlPath
,
equals
(
'ghi'
));
});
});
});
});
...
...
packages/flutter_tools/test/general.shard/flutter_tester_device_test.dart
View file @
90a592bf
...
@@ -87,6 +87,7 @@ void main() {
...
@@ -87,6 +87,7 @@ void main() {
'--enable-dart-profiling'
,
'--enable-dart-profiling'
,
'--non-interactive'
,
'--non-interactive'
,
'--use-test-fonts'
,
'--use-test-fonts'
,
'--disable-asset-fonts'
,
'--packages=.dart_tool/package_config.json'
,
'--packages=.dart_tool/package_config.json'
,
'example.dill'
,
'example.dill'
,
],
environment:
<
String
,
String
>{
],
environment:
<
String
,
String
>{
...
@@ -131,6 +132,7 @@ void main() {
...
@@ -131,6 +132,7 @@ void main() {
'--enable-dart-profiling'
,
'--enable-dart-profiling'
,
'--non-interactive'
,
'--non-interactive'
,
'--use-test-fonts'
,
'--use-test-fonts'
,
'--disable-asset-fonts'
,
'--packages=.dart_tool/package_config.json'
,
'--packages=.dart_tool/package_config.json'
,
'example.dill'
,
'example.dill'
,
],
environment:
<
String
,
String
>{
],
environment:
<
String
,
String
>{
...
@@ -203,6 +205,7 @@ void main() {
...
@@ -203,6 +205,7 @@ void main() {
'--enable-dart-profiling'
,
'--enable-dart-profiling'
,
'--non-interactive'
,
'--non-interactive'
,
'--use-test-fonts'
,
'--use-test-fonts'
,
'--disable-asset-fonts'
,
'--packages=.dart_tool/package_config.json'
,
'--packages=.dart_tool/package_config.json'
,
'--foo'
,
'--foo'
,
'--bar'
,
'--bar'
,
...
@@ -244,6 +247,7 @@ void main() {
...
@@ -244,6 +247,7 @@ void main() {
'--enable-dart-profiling'
,
'--enable-dart-profiling'
,
'--non-interactive'
,
'--non-interactive'
,
'--use-test-fonts'
,
'--use-test-fonts'
,
'--disable-asset-fonts'
,
'--packages=.dart_tool/package_config.json'
,
'--packages=.dart_tool/package_config.json'
,
'example.dill'
,
'example.dill'
,
],
],
...
@@ -293,7 +297,7 @@ class TestFlutterTesterDevice extends FlutterTesterTestDevice {
...
@@ -293,7 +297,7 @@ class TestFlutterTesterDevice extends FlutterTesterTestDevice {
enableObservatory:
enableObservatory
,
enableObservatory:
enableObservatory
,
machine:
false
,
machine:
false
,
host:
InternetAddress
.
loopbackIPv6
,
host:
InternetAddress
.
loopbackIPv6
,
buildTestAssets:
false
,
testAssetDirectory:
null
,
flutterProject:
null
,
flutterProject:
null
,
icudtlPath:
null
,
icudtlPath:
null
,
compileExpression:
null
,
compileExpression:
null
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment