Skip to content

Commit

Permalink
Fix scenario platform view tests on Android (#18332)
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Garcia committed May 13, 2020
1 parent 80fa77e commit 480d8e4
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 7 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 17 additions & 7 deletions testing/scenario_app/lib/src/platform_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,6 @@ class PlatformViewClipPathScenario extends PlatformViewScenario {

builder.pushOffset(0, 0);

// Create a path of rectangle with width of 200 and height of 300, starting from (100, 100).
//
// Refer to "../../ios/Scenarios/Scenarios/ScenariosUITests/golden_platform_view_clippath_iPhone SE_simulator.png" for the exact path after clipping.
final Path path = Path()
..moveTo(100, 100)
..quadraticBezierTo(50, 250, 100, 400)
Expand Down Expand Up @@ -632,11 +629,18 @@ mixin _BasePlatformViewScenarioMixin on Scenario {
);
}

void _addPlatformViewtoScene(SceneBuilder sceneBuilder, int viewId, double width, double height) {
void _addPlatformViewtoScene(
SceneBuilder sceneBuilder,
int viewId,
double width,
double height, {
Offset overlayOffset,
}) {
overlayOffset ??= const Offset(50, 50);
if (Platform.isIOS) {
sceneBuilder.addPlatformView(viewId, width: width, height: height);
sceneBuilder.addPlatformView(viewId, offset: overlayOffset, width: width, height: height);
} else if (Platform.isAndroid && _textureId != null) {
sceneBuilder.addTexture(_textureId, offset: const Offset(150, 300), width: width, height: height);
sceneBuilder.addTexture(_textureId, offset: overlayOffset, width: width, height: height);
} else {
throw UnsupportedError('Platform ${Platform.operatingSystem} is not supported');
}
Expand All @@ -649,7 +653,13 @@ mixin _BasePlatformViewScenarioMixin on Scenario {
Offset overlayOffset,
}) {
overlayOffset ??= const Offset(50, 50);
_addPlatformViewtoScene(sceneBuilder, viewId, 500, 500);
_addPlatformViewtoScene(
sceneBuilder,
viewId,
500,
500,
overlayOffset: overlayOffset,
);
final PictureRecorder recorder = PictureRecorder();
final Canvas canvas = Canvas(recorder);
canvas.drawCircle(
Expand Down

0 comments on commit 480d8e4

Please sign in to comment.