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

Commit 932a737

Browse files
author
Chris Yang
committed
add scenario tset
1 parent f2c3d78 commit 932a737

File tree

8 files changed

+71
-1
lines changed

8 files changed

+71
-1
lines changed

shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,7 @@ static bool ClipBoundsContainsPlatformViewBoundingRect(const SkRect& clip_bounds
798798
return layer;
799799
}
800800
SkCanvas* overlay_canvas = frame->SkiaCanvas();
801+
overlay_canvas->clipRect(rect);
801802
overlay_canvas->clear(SK_ColorTRANSPARENT);
802803
if (frame->GetDisplayListBuilder()) {
803804
slice->render_into(frame->GetDisplayListBuilder().get());

testing/scenario_app/ios/Scenarios/Scenarios.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
6816DB9E231750ED00A51400 /* GoldenPlatformViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6816DB9D231750ED00A51400 /* GoldenPlatformViewTests.m */; };
3838
6816DBA12317573300A51400 /* GoldenImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 6816DBA02317573300A51400 /* GoldenImage.m */; };
3939
6816DBA42318358200A51400 /* GoldenTestManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6816DBA32318358200A51400 /* GoldenTestManager.m */; };
40+
687AF8E9291EBDE0003912C7 /* golden_platform_view_clippath_with_transform_iPhone 8_13.0_simulator.png in Resources */ = {isa = PBXBuildFile; fileRef = 687AF8E8291EBDE0003912C7 /* golden_platform_view_clippath_with_transform_iPhone 8_13.0_simulator.png */; };
4041
68A5B63423EB71D300BDBCDB /* PlatformViewGestureRecognizerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 68A5B63323EB71D300BDBCDB /* PlatformViewGestureRecognizerTests.m */; };
4142
68D4017D2564859300ECD91A /* ContinuousTexture.m in Sources */ = {isa = PBXBuildFile; fileRef = 68D4017C2564859300ECD91A /* ContinuousTexture.m */; };
4243
F26F15B8268B6B5600EC54D3 /* iPadGestureTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F26F15B7268B6B5500EC54D3 /* iPadGestureTests.m */; };
@@ -148,6 +149,7 @@
148149
6816DBA02317573300A51400 /* GoldenImage.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GoldenImage.m; sourceTree = "<group>"; };
149150
6816DBA22318358200A51400 /* GoldenTestManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GoldenTestManager.h; sourceTree = "<group>"; };
150151
6816DBA32318358200A51400 /* GoldenTestManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GoldenTestManager.m; sourceTree = "<group>"; };
152+
687AF8E8291EBDE0003912C7 /* golden_platform_view_clippath_with_transform_iPhone 8_13.0_simulator.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "golden_platform_view_clippath_with_transform_iPhone 8_13.0_simulator.png"; sourceTree = "<group>"; };
151153
68A5B63323EB71D300BDBCDB /* PlatformViewGestureRecognizerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PlatformViewGestureRecognizerTests.m; sourceTree = "<group>"; };
152154
68D4017B2564859300ECD91A /* ContinuousTexture.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ContinuousTexture.h; sourceTree = "<group>"; };
153155
68D4017C2564859300ECD91A /* ContinuousTexture.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ContinuousTexture.m; sourceTree = "<group>"; };
@@ -290,6 +292,7 @@
290292
F7B464DC2759D02B00079189 /* Goldens */ = {
291293
isa = PBXGroup;
292294
children = (
295+
687AF8E8291EBDE0003912C7 /* golden_platform_view_clippath_with_transform_iPhone 8_13.0_simulator.png */,
293296
F7B464E32759D0A900079189 /* golden_bogus_font_text_iPhone 8_13.0_simulator.png */,
294297
F7B464E92759D0A900079189 /* golden_non_full_screen_flutter_view_platform_view_iPhone 8_13.0_simulator.png */,
295298
F7B464E52759D0A900079189 /* golden_platform_view_clippath_iPhone 8_13.0_simulator.png */,
@@ -444,6 +447,7 @@
444447
F7B464ED2759D0A900079189 /* golden_platform_view_cliprrect_iPhone 8_13.0_simulator.png in Resources */,
445448
F7B464EB2759D0A900079189 /* golden_two_platform_views_with_other_backdrop_filter_iPhone 8_13.0_simulator.png in Resources */,
446449
F7B464F42759D0A900079189 /* golden_platform_view_with_other_backdrop_filter_iPhone 8_13.0_simulator.png in Resources */,
450+
687AF8E9291EBDE0003912C7 /* golden_platform_view_clippath_with_transform_iPhone 8_13.0_simulator.png in Resources */,
447451
F769EB53276312BB007AC10F /* golden_platform_view_cliprect_iPhone 8_13.0_simulator.png in Resources */,
448452
F7B464EF2759D0A900079189 /* golden_platform_view_multiple_iPhone 8_13.0_simulator.png in Resources */,
449453
);

testing/scenario_app/ios/Scenarios/Scenarios/AppDelegate.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ - (BOOL)application:(UIApplication*)application
4444
@"--platform-view-cliprect" : @"platform_view_cliprect",
4545
@"--platform-view-cliprrect" : @"platform_view_cliprrect",
4646
@"--platform-view-clippath" : @"platform_view_clippath",
47+
@"--platform-view-clippath-with-transform" : @"platform_view_clippath_with_transform",
4748
@"--platform-view-transform" : @"platform_view_transform",
4849
@"--platform-view-opacity" : @"platform_view_opacity",
4950
@"--platform-view-with-other-backdrop-filter" : @"platform_view_with_other_backdrop_filter",

testing/scenario_app/ios/Scenarios/ScenariosUITests/GoldenTestManager.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ - (instancetype)initWithLaunchArg:(NSString*)launchArg {
3030
@"--platform-view-cliprect" : @"platform_view_cliprect",
3131
@"--platform-view-cliprrect" : @"platform_view_cliprrect",
3232
@"--platform-view-clippath" : @"platform_view_clippath",
33+
@"--platform-view-clippath-with-transform" : @"platform_view_clippath_with_transform",
3334
@"--platform-view-transform" : @"platform_view_transform",
3435
@"--platform-view-opacity" : @"platform_view_opacity",
3536
@"--platform-view-with-other-backdrop-filter" : @"platform_view_with_other_backdrop_filter",

testing/scenario_app/ios/Scenarios/ScenariosUITests/PlatformViewUITests.m

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,24 @@ - (void)testPlatformView {
134134

135135
@end
136136

137+
@interface PlatformViewMutationClipPathWithTransformTests : GoldenPlatformViewTests
138+
139+
@end
140+
141+
@implementation PlatformViewMutationClipPathWithTransformTests
142+
143+
- (instancetype)initWithInvocation:(NSInvocation*)invocation {
144+
GoldenTestManager* manager =
145+
[[GoldenTestManager alloc] initWithLaunchArg:@"--platform-view-clippath-with-transform"];
146+
return [super initWithManager:manager invocation:invocation];
147+
}
148+
149+
- (void)testPlatformView {
150+
[self checkPlatformViewGolden];
151+
}
152+
153+
@end
154+
137155
@interface PlatformViewMutationTransformTests : GoldenPlatformViewTests
138156

139157
@end

testing/scenario_app/lib/src/platform_view.dart

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ class PlatformViewClipRRectScenario extends PlatformViewScenario {
620620

621621
/// Platform view with clip path.
622622
class PlatformViewClipPathScenario extends PlatformViewScenario {
623-
/// Constructs a platform view with clip rrect scenario.
623+
/// Constructs a platform view with clip path scenario.
624624
PlatformViewClipPathScenario(
625625
PlatformDispatcher dispatcher, {
626626
int id = 0,
@@ -645,6 +645,50 @@ class PlatformViewClipPathScenario extends PlatformViewScenario {
645645
}
646646
}
647647

648+
/// Platform view with clip path after transformed.
649+
class PlatformViewClipPathWithTransformScenario extends PlatformViewScenario {
650+
/// Constructs a platform view with clip path wit transform scenario.
651+
PlatformViewClipPathWithTransformScenario(
652+
PlatformDispatcher dispatcher, {
653+
int id = 0,
654+
}) : super(dispatcher, id: id);
655+
656+
@override
657+
void onBeginFrame(Duration duration) {
658+
final Matrix4 matrix4 = Matrix4.identity()
659+
..rotateZ(1)
660+
..scale(0.5, 0.5, 1.0)
661+
..translate(1000.0, 100.0);
662+
663+
final SceneBuilder builder = SceneBuilder()..pushTransform(matrix4.storage);
664+
final Path path = Path()
665+
..moveTo(100, 100)
666+
..quadraticBezierTo(50, 250, 100, 400)
667+
..lineTo(350, 400)
668+
..cubicTo(400, 300, 300, 200, 350, 100)
669+
..close();
670+
671+
builder.pushClipPath(path);
672+
addPlatformView(
673+
id,
674+
dispatcher: dispatcher,
675+
sceneBuilder: builder,
676+
);
677+
678+
// Add a translucent rect that has the same size of PlatformView.
679+
final PictureRecorder recorder = PictureRecorder();
680+
final Canvas canvas = Canvas(recorder);
681+
canvas.drawRect(
682+
const Rect.fromLTWH(0, 0, 500, 500),
683+
Paint()..color = const Color(0x22FF0000),
684+
);
685+
final Picture picture = recorder.endRecording();
686+
builder.addPicture(const Offset(0, 0), picture);
687+
688+
finishBuilder(builder);
689+
}
690+
}
691+
648692
/// Platform view with transform.
649693
class PlatformViewTransformScenario extends PlatformViewScenario {
650694
/// Constructs a platform view with transform scenario.

testing/scenario_app/lib/src/scenarios.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Map<String, ScenarioFactory> _scenarios = <String, ScenarioFactory>{
3333
'platform_view_cliprect': () => PlatformViewClipRectScenario(PlatformDispatcher.instance, id: _viewId++),
3434
'platform_view_cliprrect': () => PlatformViewClipRRectScenario(PlatformDispatcher.instance, id: _viewId++),
3535
'platform_view_clippath': () => PlatformViewClipPathScenario(PlatformDispatcher.instance, id: _viewId++),
36+
'platform_view_clippath_with_transform': () => PlatformViewClipPathWithTransformScenario(PlatformDispatcher.instance, id: _viewId++),
3637
'platform_view_transform': () => PlatformViewTransformScenario(PlatformDispatcher.instance, id: _viewId++),
3738
'platform_view_opacity': () => PlatformViewOpacityScenario(PlatformDispatcher.instance, id: _viewId++),
3839
'platform_view_with_other_backdrop_filter': () => PlatformViewWithOtherBackDropFilter(PlatformDispatcher.instance, id: _viewId++),

0 commit comments

Comments
 (0)