Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Conversation

@dnfield
Copy link
Contributor

@dnfield dnfield commented May 29, 2020

Fixes flutter/flutter#51885
Fixes flutter/flutter#57623

On versions of Flutter containing flutter/flutter#58210, this will make sure we don't automatically register the test text input and httpoverrides.

This will also default the window size to whatever the device or browser actually thinks it should be, rather than forcing it to start at 800x600. We can, if needed, still alter the size in a test using the binding's setSurfaceSize from within a test.

/cc @chunhtai since you helped review the upstream PR related to this.

@dnfield dnfield requested a review from nturgut May 29, 2020 23:15
// TODO(dnfield): Remove the ignore once we bump the minimum Flutter version
// ignore: override_on_non_overriding_member
@override
bool get registerTestTextInput => false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! I'll cleanup our tests too

@dnfield dnfield merged commit 946b37b into flutter:master May 30, 2020
@ened
Copy link
Contributor

ened commented Jun 1, 2020

@dnfield @nturgut could you please schedule a release of the e2e plugin .. ?

EdwinRomelta pushed a commit to EdwinRomelta/plugins that referenced this pull request Jun 11, 2020
jiahaog added a commit to jiahaog/flutter-plugins that referenced this pull request Jul 15, 2020
… mode

In release mode, it is possible for the app to start too quickly, which causes `window.physicalSize` to return `Size.zero` and trip the following assertion in the engine:

```
transform_layer.cc(20)] Check failed: transform_.isFinite().
```

Returning `Size.zero` is a documented behavior [here](https://api.flutter.dev/flutter/dart-ui/Window/physicalSize.html)

This occurs when `createViewConfiguration` is overriden (flutter#2805 related), otherwise it falls back to the default window size of 800x600. As such, this PR makes `ensureInitialized` wait for a non-zero `window.physicalSize` before proceeding.

I'm not sure if this is the best solution, because:

1. Breaking change to `ensureInitialized`. I'm also not sure if it's a convention for `ensureInitialized` to be async. The key thing we need to do is to set the view configuration correctly before handing control back to the user code, but this does not seem possible with the current sync APIs.
2. Accessing dart:ui.window which is recommended to [avoid](https://api.flutter.dev/flutter/dart-ui/window.html), though this does fall into the exception where:

> The only place that `WidgetsBinding.instance.window` is inappropriate is if a `Window` is required before invoking `runApp()`. In that case, it is acceptable (though unfortunate) to use this object statically.

Another alternative we can do would be to introduce another method to wait for the physical size, but this seems more clunky to users.
jiahaog added a commit to jiahaog/flutter-plugins that referenced this pull request Jul 15, 2020
In release mode, it is possible for the app to start too quickly, which causes `window.physicalSize` to return `Size.zero` and trip the following assertion in the engine:

```
transform_layer.cc(20)] Check failed: transform_.isFinite().
```

Returning `Size.zero` is a documented behavior [here](https://api.flutter.dev/flutter/dart-ui/Window/physicalSize.html)

This occurs when `createViewConfiguration` is overriden (flutter#2805 related), otherwise it falls back to the default window size of 800x600. As such, this PR makes `ensureInitialized` wait for a non-zero `window.physicalSize` before proceeding.

I'm not sure if this is the best solution, because:

1. Breaking change to `ensureInitialized`. I'm also not sure if it's a convention for `ensureInitialized` to be async. The key thing we need to do is to set the view configuration correctly before handing control back to the user code, but this does not seem possible with the current sync APIs.
2. Accessing dart:ui.window which is recommended to [avoid](https://api.flutter.dev/flutter/dart-ui/window.html), though this does fall into the exception where:

> The only place that `WidgetsBinding.instance.window` is inappropriate is if a `Window` is required before invoking `runApp()`. In that case, it is acceptable (though unfortunate) to use this object statically.

Another alternative we can do would be to introduce another method to wait for the physical size, but this seems more clunky to users.
jiahaog added a commit to jiahaog/flutter-plugins that referenced this pull request Jul 15, 2020
…lutter#2875

In release mode, it is possible for the app to start too quickly, which causes `window.physicalSize` to return `Size.zero` and trip the following assertion in the engine:

```
transform_layer.cc(20)] Check failed: transform_.isFinite().
```

Returning `Size.zero` is a documented behavior [here](https://api.flutter.dev/flutter/dart-ui/Window/physicalSize.html)

This occurs when `createViewConfiguration` is overiden (flutter#2805 related), otherwise it falls back to the default window size of 800x600. As such, this PR makes `ensureInitialized` wait for a non-zero `window.physicalSize` before proceeding.

I'm not sure if this is the best solution, because:

1. Breaking change to `ensureInitialized`. I'm also not sure if it's a convention for `ensureInitialized` to be async. The key thing we need to do is to set the view configuration correctly before handing control back to the user code, but this does not seem possible with the current sync APIs.
2. Accessing dart:ui.window which is recommended to [avoid](https://api.flutter.dev/flutter/dart-ui/window.html), though this does fall into the exception where:

> The only place that `WidgetsBinding.instance.window` is inappropriate is if a `Window` is required before invoking `runApp()`. In that case, it is acceptable (though unfortunate) to use this object statically.

Some other alternatives I can think of:
- Introduce another method to wait for the physical size, but this seems more clunky to users.
- Recommend users call `setSurfaceSize` instead and explicitly pass in the desired size
- Don't use `window.physicalSize` and instead always use the defaults of 800x600
jiahaog added a commit to jiahaog/flutter-plugins that referenced this pull request Jul 15, 2020
…lutter#2875

In release mode, it is possible for the app to start too quickly, which causes `window.physicalSize` to return `Size.zero` and trip the following assertion in the engine:

```
transform_layer.cc(20)] Check failed: transform_.isFinite().
```

Returning `Size.zero` is a documented behavior [here](https://api.flutter.dev/flutter/dart-ui/Window/physicalSize.html)

This occurs when `createViewConfiguration` is overiden (flutter#2805 related), otherwise it falls back to the default window size of 800x600. As such, this PR makes `ensureInitialized` wait for a non-zero `window.physicalSize` before proceeding.

I'm not sure if this is the best solution, because:

1. Breaking change to `ensureInitialized`. I'm also not sure if it's a convention for `ensureInitialized` to be async. The key thing we need to do is to set the view configuration correctly before handing control back to the user code, but this does not seem possible with the current sync APIs.
2. Accessing dart:ui.window which is recommended to [avoid](https://api.flutter.dev/flutter/dart-ui/window.html), though this does fall into the exception where:

> The only place that `WidgetsBinding.instance.window` is inappropriate is if a `Window` is required before invoking `runApp()`. In that case, it is acceptable (though unfortunate) to use this object statically.

Some other alternatives I can think of:
- Introduce another method to wait for the physical size, but this seems more clunky to users.
- Recommend users call `setSurfaceSize` instead and explicitly pass in the desired size
- Don't use `window.physicalSize` and instead always use the defaults of 800x600
jiahaog added a commit to jiahaog/flutter-plugins that referenced this pull request Jul 15, 2020
…lutter#2875

In release mode, it is possible for the app to start too quickly, which causes `window.physicalSize` to return `Size.zero` and trip the following assertion in the engine:

```
transform_layer.cc(20)] Check failed: transform_.isFinite().
```

Returning `Size.zero` is a documented behavior [here](https://api.flutter.dev/flutter/dart-ui/Window/physicalSize.html)

This occurs when `createViewConfiguration` is overiden (flutter#2805 related), otherwise it falls back to the default window size of 800x600. As such, this PR makes `ensureInitialized` wait for a non-zero `window.physicalSize` before proceeding.

I'm not sure if this is the best solution, because:

1. Breaking change to `ensureInitialized`. I'm also not sure if it's a convention for `ensureInitialized` to be async. The key thing we need to do is to set the view configuration correctly before handing control back to the user code, but this does not seem possible with the current sync APIs.
2. Accessing dart:ui.window which is recommended to [avoid](https://api.flutter.dev/flutter/dart-ui/window.html), though this does fall into the exception where:

> The only place that `WidgetsBinding.instance.window` is inappropriate is if a `Window` is required before invoking `runApp()`. In that case, it is acceptable (though unfortunate) to use this object statically.

Some other alternatives I can think of:
- Introduce another method to wait for the physical size, but this seems more clunky to users.
- Recommend users call `setSurfaceSize` instead and explicitly pass in the desired size
- Don't use `window.physicalSize` and instead always use the defaults of 800x600
jorgefspereira pushed a commit to jorgefspereira/plugins_flutter that referenced this pull request Oct 10, 2020
FlutterSu pushed a commit to FlutterSu/flutter-plugins that referenced this pull request Nov 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[e2e] should support running an application in as "realistic" a mode as possible [e2e] Use real textInput channels and http bindings instead of mocks

4 participants