more ui-as-code (#35393)

* more ui-as-code

* address review comments
This commit is contained in:
Alexandre Ardhuin
2019-07-02 21:11:56 +02:00
committed by GitHub
parent e2a55fe83f
commit 758009ba70
62 changed files with 676 additions and 774 deletions

View File

@@ -77,15 +77,13 @@ class Testbed {
/// `overrides` may be used to provide new context values for the single test
/// case or override any context values from the setup.
FutureOr<T> run<T>(FutureOr<T> Function() test, {Map<Type, Generator> overrides}) {
final Map<Type, Generator> testOverrides = Map<Type, Generator>.from(_testbedDefaults);
// Add the initial setUp overrides
if (_overrides != null) {
testOverrides.addAll(_overrides);
}
// Add the test-specific overrides
if (overrides != null) {
testOverrides.addAll(overrides);
}
final Map<Type, Generator> testOverrides = <Type, Generator>{
..._testbedDefaults,
// Add the initial setUp overrides
...?_overrides,
// Add the test-specific overrides
...?overrides,
};
// Cache the original flutter root to restore after the test case.
final String originalFlutterRoot = Cache.flutterRoot;
return runInContext<T>(() {