5#import <OCMock/OCMock.h>
7#import <XCTest/XCTest.h>
9#import "flutter/fml/thread.h"
10#import "flutter/shell/platform/darwin/common/framework/Headers/FlutterMacros.h"
11#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterPlatformViews.h"
12#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h"
13#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h"
14#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterTouchInterceptingView_Test.h"
15#import "flutter/shell/platform/darwin/ios/platform_view_ios.h"
42@property(nonatomic, strong) UIView* view;
43@property(nonatomic, assign)
BOOL viewCreated;
57 [
self checkViewCreatedOnce];
62 if (
self.viewCreated) {
65 self.viewCreated = YES;
71 : NSObject <FlutterPlatformViewFactory>
76 viewIdentifier:(int64_t)viewId
77 arguments:(
id _Nullable)args {
85class FlutterPlatformViewsTestMockPlatformViewDelegate :
public PlatformView::Delegate {
87 void OnPlatformViewCreated(std::unique_ptr<Surface>
surface)
override {}
88 void OnPlatformViewDestroyed()
override {}
89 void OnPlatformViewScheduleFrame()
override {}
90 void OnPlatformViewAddView(int64_t view_id,
91 const ViewportMetrics& viewport_metrics,
92 AddViewCallback
callback)
override {}
93 void OnPlatformViewRemoveView(int64_t view_id, RemoveViewCallback
callback)
override {}
95 void OnPlatformViewSetViewportMetrics(int64_t view_id,
const ViewportMetrics& metrics)
override {}
97 void OnPlatformViewDispatchPlatformMessage(std::unique_ptr<PlatformMessage>
message)
override {}
98 void OnPlatformViewDispatchPointerDataPacket(std::unique_ptr<PointerDataPacket> packet)
override {
100 void OnPlatformViewDispatchSemanticsAction(int32_t
id,
103 void OnPlatformViewSetSemanticsEnabled(
bool enabled)
override {}
104 void OnPlatformViewSetAccessibilityFeatures(int32_t
flags)
override {}
105 void OnPlatformViewRegisterTexture(std::shared_ptr<Texture>
texture)
override {}
106 void OnPlatformViewUnregisterTexture(int64_t
texture_id)
override {}
107 void OnPlatformViewMarkTextureFrameAvailable(int64_t
texture_id)
override {}
110 std::unique_ptr<const fml::Mapping> snapshot_data,
111 std::unique_ptr<const fml::Mapping> snapshot_instructions)
override {
113 void LoadDartDeferredLibraryError(intptr_t loading_unit_id,
114 const std::string error_message,
115 bool transient)
override {}
116 void UpdateAssetResolverByType(std::unique_ptr<flutter::AssetResolver> updated_asset_resolver,
127 auto thread = std::make_unique<fml::Thread>(
name);
128 auto runner = thread->GetTaskRunner();
139 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
146 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
147 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
149 mock_delegate.settings_.enable_impeller
152 flutterPlatformViewsController,
155 std::make_shared<fml::SyncSwitch>());
159 flutterPlatformViewsController->RegisterViewFactory(
160 factory,
@"MockFlutterPlatformView",
164 flutterPlatformViewsController->OnMethodCall(
166 methodCallWithMethodName:
@"create"
167 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
169 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)];
170 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
181 finalMatrix.
setConcat(screenScaleMatrix, translateMatrix);
183 auto embeddedViewParams =
184 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(300, 300), stack);
186 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
187 flutterPlatformViewsController->CompositeEmbeddedView(2);
189 flutterPlatformViewsController->GetPlatformViewRect(2);
193 flutterPlatformViewsController->Reset();
197 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
204 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
205 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
207 mock_delegate.settings_.enable_impeller
210 flutterPlatformViewsController,
213 std::make_shared<fml::SyncSwitch>());
217 flutterPlatformViewsController->RegisterViewFactory(
218 factory,
@"MockFlutterPlatformView",
222 flutterPlatformViewsController->OnMethodCall(
224 methodCallWithMethodName:
@"create"
225 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
234 UIView* childView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
235 [childClippingView addSubview:childView];
237 XCTAssertFalse([childClippingView pointInside:CGPointMake(50, 50) withEvent:nil]);
238 XCTAssertFalse([childClippingView pointInside:CGPointMake(99, 100) withEvent:nil]);
239 XCTAssertFalse([childClippingView pointInside:CGPointMake(100, 99) withEvent:nil]);
240 XCTAssertFalse([childClippingView pointInside:CGPointMake(201, 200) withEvent:nil]);
241 XCTAssertFalse([childClippingView pointInside:CGPointMake(200, 201) withEvent:nil]);
242 XCTAssertFalse([childClippingView pointInside:CGPointMake(99, 200) withEvent:nil]);
243 XCTAssertFalse([childClippingView pointInside:CGPointMake(200, 299) withEvent:nil]);
245 XCTAssertTrue([childClippingView pointInside:CGPointMake(150, 150) withEvent:nil]);
246 XCTAssertTrue([childClippingView pointInside:CGPointMake(100, 100) withEvent:nil]);
247 XCTAssertTrue([childClippingView pointInside:CGPointMake(199, 100) withEvent:nil]);
248 XCTAssertTrue([childClippingView pointInside:CGPointMake(100, 199) withEvent:nil]);
249 XCTAssertTrue([childClippingView pointInside:CGPointMake(199, 199) withEvent:nil]);
253 __weak NSMutableArray<UIVisualEffectView*>* weakBackdropFilterSubviews = nil;
254 __weak UIVisualEffectView* weakVisualEffectView1 = nil;
255 __weak UIVisualEffectView* weakVisualEffectView2 = nil;
259 UIVisualEffectView* visualEffectView1 = [[UIVisualEffectView alloc]
260 initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
261 weakVisualEffectView1 = visualEffectView1;
265 visualEffectView:visualEffectView1];
270 UIVisualEffectView* visualEffectView2 = [[UIVisualEffectView alloc]
271 initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]];
272 weakVisualEffectView2 = visualEffectView2;
276 visualEffectView:visualEffectView2];
280 XCTAssertNotNil(weakBackdropFilterSubviews);
283 XCTAssertNil(weakBackdropFilterSubviews);
284 XCTAssertNil(weakVisualEffectView1);
285 XCTAssertNil(weakVisualEffectView2);
289 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
296 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
297 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
299 mock_delegate.settings_.enable_impeller
302 flutterPlatformViewsController,
305 std::make_shared<fml::SyncSwitch>());
309 flutterPlatformViewsController->RegisterViewFactory(
310 factory,
@"MockFlutterPlatformView",
314 flutterPlatformViewsController->OnMethodCall(
316 methodCallWithMethodName:
@"create"
317 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
322 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
323 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
327 CGFloat screenScale = [UIScreen mainScreen].scale;
334 auto embeddedViewParams =
335 std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
SkSize::Make(10, 10), stack);
337 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
338 flutterPlatformViewsController->CompositeEmbeddedView(2);
341 [mockFlutterView addSubview:childClippingView];
343 [mockFlutterView setNeedsLayout];
344 [mockFlutterView layoutIfNeeded];
347 NSUInteger numberOfExpectedVisualEffectView = 0;
348 for (UIView* subview in childClippingView.subviews) {
349 if (![subview isKindOfClass:[UIVisualEffectView
class]]) {
352 XCTAssertLessThan(numberOfExpectedVisualEffectView, 1u);
353 if ([
self validateOneVisualEffectView:subview
354 expectedFrame:CGRectMake(0, 0, 10, 10)
356 numberOfExpectedVisualEffectView++;
359 XCTAssertEqual(numberOfExpectedVisualEffectView, 1u);
363 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
370 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
371 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
373 mock_delegate.settings_.enable_impeller
376 flutterPlatformViewsController,
379 std::make_shared<fml::SyncSwitch>());
383 flutterPlatformViewsController->RegisterViewFactory(
384 factory,
@"MockFlutterPlatformView",
388 flutterPlatformViewsController->OnMethodCall(
390 methodCallWithMethodName:
@"create"
391 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
396 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
397 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
401 CGFloat screenScale = [UIScreen mainScreen].scale;
408 auto embeddedViewParams =
409 std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
SkSize::Make(5, 10), stack);
411 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
412 flutterPlatformViewsController->CompositeEmbeddedView(2);
415 [mockFlutterView addSubview:childClippingView];
417 [mockFlutterView setNeedsLayout];
418 [mockFlutterView layoutIfNeeded];
421 NSUInteger numberOfExpectedVisualEffectView = 0;
422 for (UIView* subview in childClippingView.subviews) {
423 if (![subview isKindOfClass:[UIVisualEffectView
class]]) {
426 XCTAssertLessThan(numberOfExpectedVisualEffectView, 1u);
427 if ([
self validateOneVisualEffectView:subview
428 expectedFrame:CGRectMake(0, 0, 5, 8)
430 numberOfExpectedVisualEffectView++;
433 XCTAssertEqual(numberOfExpectedVisualEffectView, 1u);
437 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
444 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
445 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
447 mock_delegate.settings_.enable_impeller
450 flutterPlatformViewsController,
453 std::make_shared<fml::SyncSwitch>());
457 flutterPlatformViewsController->RegisterViewFactory(
458 factory,
@"MockFlutterPlatformView",
462 flutterPlatformViewsController->OnMethodCall(
464 methodCallWithMethodName:
@"create"
465 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
470 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
471 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
475 CGFloat screenScale = [UIScreen mainScreen].scale;
479 for (
int i = 0;
i < 50;
i++) {
484 auto embeddedViewParams =
485 std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
SkSize::Make(20, 20), stack);
487 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
488 flutterPlatformViewsController->CompositeEmbeddedView(2);
491 [mockFlutterView addSubview:childClippingView];
493 [mockFlutterView setNeedsLayout];
494 [mockFlutterView layoutIfNeeded];
496 NSUInteger numberOfExpectedVisualEffectView = 0;
497 for (UIView* subview in childClippingView.subviews) {
498 if (![subview isKindOfClass:[UIVisualEffectView
class]]) {
501 XCTAssertLessThan(numberOfExpectedVisualEffectView, 50u);
502 if ([
self validateOneVisualEffectView:subview
503 expectedFrame:CGRectMake(0, 0, 10, 10)
504 inputRadius:(CGFloat)numberOfExpectedVisualEffectView]) {
505 numberOfExpectedVisualEffectView++;
508 XCTAssertEqual(numberOfExpectedVisualEffectView, (NSUInteger)numberOfExpectedVisualEffectView);
512 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
519 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
520 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
522 mock_delegate.settings_.enable_impeller
525 flutterPlatformViewsController,
528 std::make_shared<fml::SyncSwitch>());
532 flutterPlatformViewsController->RegisterViewFactory(
533 factory,
@"MockFlutterPlatformView",
537 flutterPlatformViewsController->OnMethodCall(
539 methodCallWithMethodName:
@"create"
540 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
545 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
546 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
550 CGFloat screenScale = [UIScreen mainScreen].scale;
557 auto embeddedViewParams =
558 std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
SkSize::Make(10, 10), stack);
560 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
561 flutterPlatformViewsController->CompositeEmbeddedView(2);
564 [mockFlutterView addSubview:childClippingView];
566 [mockFlutterView setNeedsLayout];
567 [mockFlutterView layoutIfNeeded];
569 NSMutableArray* originalVisualEffectViews = [[NSMutableArray alloc]
init];
570 for (UIView* subview in childClippingView.subviews) {
571 if (![subview isKindOfClass:[UIVisualEffectView
class]]) {
574 XCTAssertLessThan(originalVisualEffectViews.count, 1u);
575 if ([
self validateOneVisualEffectView:subview
576 expectedFrame:CGRectMake(0, 0, 10, 10)
577 inputRadius:(CGFloat)5]) {
578 [originalVisualEffectViews addObject:subview];
581 XCTAssertEqual(originalVisualEffectViews.count, 1u);
590 for (
int i = 0;
i < 2;
i++) {
594 embeddedViewParams = std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
597 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
598 flutterPlatformViewsController->CompositeEmbeddedView(2);
599 [mockFlutterView setNeedsLayout];
600 [mockFlutterView layoutIfNeeded];
602 NSMutableArray* newVisualEffectViews = [[NSMutableArray alloc] init];
603 for (UIView* subview in childClippingView.subviews) {
604 if (![subview isKindOfClass:[UIVisualEffectView
class]]) {
607 XCTAssertLessThan(newVisualEffectViews.count, 2u);
609 if ([
self validateOneVisualEffectView:subview
610 expectedFrame:CGRectMake(0, 0, 10, 10)
611 inputRadius:(CGFloat)5]) {
612 [newVisualEffectViews addObject:subview];
615 XCTAssertEqual(newVisualEffectViews.count, 2u);
616 for (NSUInteger
i = 0;
i < originalVisualEffectViews.count;
i++) {
617 UIView* originalView = originalVisualEffectViews[i];
618 UIView* newView = newVisualEffectViews[i];
620 XCTAssertEqual(originalView, newView);
621 id mockOrignalView = OCMPartialMock(originalView);
622 OCMReject([mockOrignalView removeFromSuperview]);
623 [mockOrignalView stopMocking];
628 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
635 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
636 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
638 mock_delegate.settings_.enable_impeller
641 flutterPlatformViewsController,
644 std::make_shared<fml::SyncSwitch>());
648 flutterPlatformViewsController->RegisterViewFactory(
649 factory,
@"MockFlutterPlatformView",
653 flutterPlatformViewsController->OnMethodCall(
655 methodCallWithMethodName:
@"create"
656 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
661 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
662 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
666 CGFloat screenScale = [UIScreen mainScreen].scale;
671 for (
int i = 0;
i < 5;
i++) {
675 auto embeddedViewParams =
676 std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
SkSize::Make(10, 10), stack);
678 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
679 flutterPlatformViewsController->CompositeEmbeddedView(2);
682 [mockFlutterView addSubview:childClippingView];
684 [mockFlutterView setNeedsLayout];
685 [mockFlutterView layoutIfNeeded];
687 NSMutableArray* originalVisualEffectViews = [[NSMutableArray alloc]
init];
688 for (UIView* subview in childClippingView.subviews) {
689 if (![subview isKindOfClass:[UIVisualEffectView
class]]) {
692 XCTAssertLessThan(originalVisualEffectViews.count, 5u);
693 if ([
self validateOneVisualEffectView:subview
694 expectedFrame:CGRectMake(0, 0, 10, 10)
695 inputRadius:(CGFloat)5]) {
696 [originalVisualEffectViews addObject:subview];
706 for (
int i = 0;
i < 4;
i++) {
710 embeddedViewParams = std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
713 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
714 flutterPlatformViewsController->CompositeEmbeddedView(2);
715 [mockFlutterView setNeedsLayout];
716 [mockFlutterView layoutIfNeeded];
718 NSMutableArray* newVisualEffectViews = [[NSMutableArray alloc] init];
719 for (UIView* subview in childClippingView.subviews) {
720 if (![subview isKindOfClass:[UIVisualEffectView
class]]) {
723 XCTAssertLessThan(newVisualEffectViews.count, 4u);
724 if ([
self validateOneVisualEffectView:subview
725 expectedFrame:CGRectMake(0, 0, 10, 10)
726 inputRadius:(CGFloat)5]) {
727 [newVisualEffectViews addObject:subview];
730 XCTAssertEqual(newVisualEffectViews.count, 4u);
732 for (NSUInteger
i = 0;
i < newVisualEffectViews.count;
i++) {
733 UIView* newView = newVisualEffectViews[i];
734 id mockNewView = OCMPartialMock(newView);
735 UIView* originalView = originalVisualEffectViews[i];
737 XCTAssertEqual(originalView, newView);
738 OCMReject([mockNewView removeFromSuperview]);
739 [mockNewView stopMocking];
744 for (
int i = 0;
i < 5;
i++) {
749 embeddedViewParams = std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
752 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
753 flutterPlatformViewsController->CompositeEmbeddedView(2);
754 [mockFlutterView setNeedsLayout];
755 [mockFlutterView layoutIfNeeded];
757 NSUInteger numberOfExpectedVisualEffectView = 0u;
758 for (UIView* subview in childClippingView.subviews) {
759 if ([subview isKindOfClass:[UIVisualEffectView
class]]) {
760 numberOfExpectedVisualEffectView++;
763 XCTAssertEqual(numberOfExpectedVisualEffectView, 0u);
767 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
774 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
775 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
777 mock_delegate.settings_.enable_impeller
780 flutterPlatformViewsController,
783 std::make_shared<fml::SyncSwitch>());
787 flutterPlatformViewsController->RegisterViewFactory(
788 factory,
@"MockFlutterPlatformView",
792 flutterPlatformViewsController->OnMethodCall(
794 methodCallWithMethodName:
@"create"
795 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
800 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
801 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
805 CGFloat screenScale = [UIScreen mainScreen].scale;
810 for (
int i = 0;
i < 5;
i++) {
814 auto embeddedViewParams =
815 std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
SkSize::Make(10, 10), stack);
817 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
818 flutterPlatformViewsController->CompositeEmbeddedView(2);
821 [mockFlutterView addSubview:childClippingView];
823 [mockFlutterView setNeedsLayout];
824 [mockFlutterView layoutIfNeeded];
826 NSMutableArray* originalVisualEffectViews = [[NSMutableArray alloc]
init];
827 for (UIView* subview in childClippingView.subviews) {
828 if (![subview isKindOfClass:[UIVisualEffectView
class]]) {
831 XCTAssertLessThan(originalVisualEffectViews.count, 5u);
832 if ([
self validateOneVisualEffectView:subview
833 expectedFrame:CGRectMake(0, 0, 10, 10)
834 inputRadius:(CGFloat)5]) {
835 [originalVisualEffectViews addObject:subview];
845 for (
int i = 0;
i < 5;
i++) {
858 embeddedViewParams = std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
861 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
862 flutterPlatformViewsController->CompositeEmbeddedView(2);
863 [mockFlutterView setNeedsLayout];
864 [mockFlutterView layoutIfNeeded];
866 NSMutableArray* newVisualEffectViews = [[NSMutableArray alloc] init];
867 for (UIView* subview in childClippingView.subviews) {
868 if (![subview isKindOfClass:[UIVisualEffectView
class]]) {
871 XCTAssertLessThan(newVisualEffectViews.count, 5u);
872 CGFloat expectInputRadius = 5;
873 if (newVisualEffectViews.count == 3) {
874 expectInputRadius = 2;
876 if ([
self validateOneVisualEffectView:subview
877 expectedFrame:CGRectMake(0, 0, 10, 10)
878 inputRadius:(CGFloat)expectInputRadius]) {
879 [newVisualEffectViews addObject:subview];
882 XCTAssertEqual(newVisualEffectViews.count, 5u);
883 for (NSUInteger
i = 0;
i < newVisualEffectViews.count;
i++) {
884 UIView* newView = newVisualEffectViews[i];
885 id mockNewView = OCMPartialMock(newView);
886 UIView* originalView = originalVisualEffectViews[i];
888 XCTAssertEqual(originalView, newView);
889 OCMReject([mockNewView removeFromSuperview]);
890 [mockNewView stopMocking];
892 [newVisualEffectViews removeAllObjects];
896 for (
int i = 0;
i < 5;
i++) {
900 for (
int i = 0;
i < 5;
i++) {
912 embeddedViewParams = std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
915 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
916 flutterPlatformViewsController->CompositeEmbeddedView(2);
917 [mockFlutterView setNeedsLayout];
918 [mockFlutterView layoutIfNeeded];
920 for (UIView* subview in childClippingView.subviews) {
921 if (![subview isKindOfClass:[UIVisualEffectView
class]]) {
924 XCTAssertLessThan(newVisualEffectViews.count, 5u);
925 CGFloat expectInputRadius = 5;
926 if (newVisualEffectViews.count == 0) {
927 expectInputRadius = 2;
929 if ([
self validateOneVisualEffectView:subview
930 expectedFrame:CGRectMake(0, 0, 10, 10)
931 inputRadius:(CGFloat)expectInputRadius]) {
932 [newVisualEffectViews addObject:subview];
935 for (NSUInteger
i = 0;
i < newVisualEffectViews.count;
i++) {
936 UIView* newView = newVisualEffectViews[i];
937 id mockNewView = OCMPartialMock(newView);
938 UIView* originalView = originalVisualEffectViews[i];
940 XCTAssertEqual(originalView, newView);
941 OCMReject([mockNewView removeFromSuperview]);
942 [mockNewView stopMocking];
944 [newVisualEffectViews removeAllObjects];
948 for (
int i = 0;
i < 5;
i++) {
952 for (
int i = 0;
i < 5;
i++) {
964 embeddedViewParams = std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
967 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
968 flutterPlatformViewsController->CompositeEmbeddedView(2);
969 [mockFlutterView setNeedsLayout];
970 [mockFlutterView layoutIfNeeded];
972 for (UIView* subview in childClippingView.subviews) {
973 if (![subview isKindOfClass:[UIVisualEffectView
class]]) {
976 XCTAssertLessThan(newVisualEffectViews.count, 5u);
977 CGFloat expectInputRadius = 5;
978 if (newVisualEffectViews.count == 4) {
979 expectInputRadius = 2;
981 if ([
self validateOneVisualEffectView:subview
982 expectedFrame:CGRectMake(0, 0, 10, 10)
983 inputRadius:(CGFloat)expectInputRadius]) {
984 [newVisualEffectViews addObject:subview];
987 XCTAssertEqual(newVisualEffectViews.count, 5u);
989 for (NSUInteger
i = 0;
i < newVisualEffectViews.count;
i++) {
990 UIView* newView = newVisualEffectViews[i];
991 id mockNewView = OCMPartialMock(newView);
992 UIView* originalView = originalVisualEffectViews[i];
994 XCTAssertEqual(originalView, newView);
995 OCMReject([mockNewView removeFromSuperview]);
996 [mockNewView stopMocking];
998 [newVisualEffectViews removeAllObjects];
1002 for (
int i = 0;
i < 5;
i++) {
1006 for (
int i = 0;
i < 5;
i++) {
1012 embeddedViewParams = std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
1015 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
1016 flutterPlatformViewsController->CompositeEmbeddedView(2);
1017 [mockFlutterView setNeedsLayout];
1018 [mockFlutterView layoutIfNeeded];
1020 for (UIView* subview in childClippingView.subviews) {
1021 if (![subview isKindOfClass:[UIVisualEffectView
class]]) {
1024 XCTAssertLessThan(newVisualEffectViews.count, 5u);
1025 if ([
self validateOneVisualEffectView:subview
1026 expectedFrame:CGRectMake(0, 0, 10, 10)
1027 inputRadius:(CGFloat)newVisualEffectViews.count]) {
1028 [newVisualEffectViews addObject:subview];
1031 XCTAssertEqual(newVisualEffectViews.count, 5u);
1033 for (NSUInteger
i = 0;
i < newVisualEffectViews.count;
i++) {
1034 UIView* newView = newVisualEffectViews[i];
1035 id mockNewView = OCMPartialMock(newView);
1036 UIView* originalView = originalVisualEffectViews[i];
1038 XCTAssertEqual(originalView, newView);
1039 OCMReject([mockNewView removeFromSuperview]);
1040 [mockNewView stopMocking];
1042 [newVisualEffectViews removeAllObjects];
1046 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
1047 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
1052 thread_task_runner);
1053 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
1054 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
1056 mock_delegate.settings_.enable_impeller
1059 flutterPlatformViewsController,
1062 std::make_shared<fml::SyncSwitch>());
1066 flutterPlatformViewsController->RegisterViewFactory(
1067 factory,
@"MockFlutterPlatformView",
1071 flutterPlatformViewsController->OnMethodCall(
1073 methodCallWithMethodName:
@"create"
1074 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
1079 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
1080 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
1084 CGFloat screenScale = [UIScreen mainScreen].scale;
1088 auto dilateFilter = std::make_shared<flutter::DlDilateImageFilter>(5, 2);
1091 auto embeddedViewParams =
1092 std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
SkSize::Make(10, 10), stack);
1094 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
1095 flutterPlatformViewsController->CompositeEmbeddedView(2);
1099 [mockFlutterView addSubview:childClippingView];
1101 [mockFlutterView setNeedsLayout];
1102 [mockFlutterView layoutIfNeeded];
1104 NSUInteger numberOfExpectedVisualEffectView = 0;
1105 for (UIView* subview in childClippingView.subviews) {
1106 if ([subview isKindOfClass:[UIVisualEffectView
class]]) {
1107 numberOfExpectedVisualEffectView++;
1110 XCTAssertEqual(numberOfExpectedVisualEffectView, 0u);
1120 for (
int i = 0;
i < 5;
i++) {
1131 embeddedViewParams = std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
1134 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
1135 flutterPlatformViewsController->CompositeEmbeddedView(2);
1136 [mockFlutterView setNeedsLayout];
1137 [mockFlutterView layoutIfNeeded];
1139 numberOfExpectedVisualEffectView = 0;
1140 for (UIView* subview in childClippingView.subviews) {
1141 if (![subview isKindOfClass:[UIVisualEffectView
class]]) {
1144 XCTAssertLessThan(numberOfExpectedVisualEffectView, 4u);
1145 if ([
self validateOneVisualEffectView:subview
1146 expectedFrame:CGRectMake(0, 0, 10, 10)
1147 inputRadius:(CGFloat)5]) {
1148 numberOfExpectedVisualEffectView++;
1151 XCTAssertEqual(numberOfExpectedVisualEffectView, 4u);
1155 for (
int i = 0;
i < 5;
i++) {
1159 for (
int i = 0;
i < 5;
i++) {
1170 embeddedViewParams = std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
1173 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
1174 flutterPlatformViewsController->CompositeEmbeddedView(2);
1175 [mockFlutterView setNeedsLayout];
1176 [mockFlutterView layoutIfNeeded];
1178 numberOfExpectedVisualEffectView = 0;
1179 for (UIView* subview in childClippingView.subviews) {
1180 if (![subview isKindOfClass:[UIVisualEffectView
class]]) {
1183 XCTAssertLessThan(numberOfExpectedVisualEffectView, 4u);
1184 if ([
self validateOneVisualEffectView:subview
1185 expectedFrame:CGRectMake(0, 0, 10, 10)
1186 inputRadius:(CGFloat)5]) {
1187 numberOfExpectedVisualEffectView++;
1190 XCTAssertEqual(numberOfExpectedVisualEffectView, 4u);
1194 for (
int i = 0;
i < 5;
i++) {
1198 for (
int i = 0;
i < 5;
i++) {
1209 embeddedViewParams = std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
1212 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
1213 flutterPlatformViewsController->CompositeEmbeddedView(2);
1214 [mockFlutterView setNeedsLayout];
1215 [mockFlutterView layoutIfNeeded];
1217 numberOfExpectedVisualEffectView = 0;
1218 for (UIView* subview in childClippingView.subviews) {
1219 if (![subview isKindOfClass:[UIVisualEffectView
class]]) {
1222 XCTAssertLessThan(numberOfExpectedVisualEffectView, 4u);
1223 if ([
self validateOneVisualEffectView:subview
1224 expectedFrame:CGRectMake(0, 0, 10, 10)
1225 inputRadius:(CGFloat)5]) {
1226 numberOfExpectedVisualEffectView++;
1229 XCTAssertEqual(numberOfExpectedVisualEffectView, 4u);
1233 for (
int i = 0;
i < 5;
i++) {
1237 for (
int i = 0;
i < 5;
i++) {
1242 embeddedViewParams = std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
1245 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
1246 flutterPlatformViewsController->CompositeEmbeddedView(2);
1247 [mockFlutterView setNeedsLayout];
1248 [mockFlutterView layoutIfNeeded];
1250 numberOfExpectedVisualEffectView = 0;
1251 for (UIView* subview in childClippingView.subviews) {
1252 if ([subview isKindOfClass:[UIVisualEffectView
class]]) {
1253 numberOfExpectedVisualEffectView++;
1256 XCTAssertEqual(numberOfExpectedVisualEffectView, 0u);
1264 UIVisualEffectView* visualEffectView = [[UIVisualEffectView alloc]
1265 initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
1269 visualEffectView:visualEffectView];
1270 XCTAssertNotNil(platformViewFilter);
1275 UIVisualEffectView* visualEffectView = [[UIVisualEffectView alloc] init];
1279 visualEffectView:visualEffectView];
1280 XCTAssertNil(platformViewFilter);
1285 UIVisualEffectView* editedUIVisualEffectView = [[UIVisualEffectView alloc]
1286 initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
1287 NSArray* subviews = editedUIVisualEffectView.subviews;
1288 for (UIView* view in subviews) {
1289 if ([NSStringFromClass([view
class]) hasSuffix:
@"BackdropView"]) {
1290 for (CIFilter* filter in view.layer.filters) {
1291 if ([[filter valueForKey:
@"name"] isEqual:
@"gaussianBlur"]) {
1292 [filter setValue:@"notGaussianBlur" forKey:@"name"];
1302 visualEffectView:editedUIVisualEffectView];
1303 XCTAssertNil(platformViewFilter);
1308 UIVisualEffectView* editedUIVisualEffectView = [[UIVisualEffectView alloc]
1309 initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
1310 NSArray* subviews = editedUIVisualEffectView.subviews;
1311 for (UIView* view in subviews) {
1312 if ([NSStringFromClass([view
class]) hasSuffix:
@"BackdropView"]) {
1313 for (CIFilter* filter in view.layer.filters) {
1314 if ([[filter valueForKey:
@"name"] isEqual:
@"gaussianBlur"]) {
1315 [filter setValue:@"invalidInputRadius" forKey:@"inputRadius"];
1326 visualEffectView:editedUIVisualEffectView];
1327 XCTAssertNil(platformViewFilter);
1331 __weak UIVisualEffectView* weakVisualEffectView;
1334 UIVisualEffectView* visualEffectView = [[UIVisualEffectView alloc]
1335 initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
1336 weakVisualEffectView = visualEffectView;
1340 visualEffectView:visualEffectView];
1341 CGColorRef visualEffectSubviewBackgroundColor = nil;
1342 for (UIView* view in [platformViewFilter backdropFilterView].subviews) {
1343 if ([NSStringFromClass([view
class]) hasSuffix:
@"VisualEffectSubview"]) {
1344 visualEffectSubviewBackgroundColor = view.layer.backgroundColor;
1348 CGColorEqualToColor(visualEffectSubviewBackgroundColor, UIColor.clearColor.CGColor));
1350 XCTAssertNil(weakVisualEffectView);
1354 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
1355 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
1360 thread_task_runner);
1361 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
1362 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
1364 mock_delegate.settings_.enable_impeller
1367 flutterPlatformViewsController,
1370 std::make_shared<fml::SyncSwitch>());
1374 flutterPlatformViewsController->RegisterViewFactory(
1375 factory,
@"MockFlutterPlatformView",
1379 flutterPlatformViewsController->OnMethodCall(
1381 methodCallWithMethodName:
@"create"
1382 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
1387 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)];
1388 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
1399 finalMatrix.
setConcat(screenScaleMatrix, translateMatrix);
1401 auto embeddedViewParams =
1402 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(300, 300), stack);
1404 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
1405 flutterPlatformViewsController->CompositeEmbeddedView(2);
1406 CGRect platformViewRectInFlutterView = [gMockPlatformView convertRect:gMockPlatformView.bounds
1407 toView:mockFlutterView];
1408 XCTAssertTrue(CGRectEqualToRect(platformViewRectInFlutterView, CGRectMake(100, 100, 300, 300)));
1412 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
1413 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
1418 thread_task_runner);
1419 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
1420 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
1422 mock_delegate.settings_.enable_impeller
1425 flutterPlatformViewsController,
1428 std::make_shared<fml::SyncSwitch>());
1432 flutterPlatformViewsController->RegisterViewFactory(
1433 factory,
@"MockFlutterPlatformView",
1437 flutterPlatformViewsController->OnMethodCall(
1439 methodCallWithMethodName:
@"create"
1440 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
1445 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
1446 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
1450 CGFloat screenScale = [UIScreen mainScreen].scale;
1454 auto embeddedViewParams =
1455 std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
SkSize::Make(10, 10), stack);
1457 flutterPlatformViewsController->BeginFrame(
SkISize::Make(0, 0));
1458 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
1459 flutterPlatformViewsController->PushVisitedPlatformView(2);
1461 flutterPlatformViewsController->PushFilterToVisitedPlatformViews(
1463 flutterPlatformViewsController->CompositeEmbeddedView(2);
1466 [mockFlutterView addSubview:childClippingView];
1468 [mockFlutterView setNeedsLayout];
1469 [mockFlutterView layoutIfNeeded];
1472 NSUInteger numberOfExpectedVisualEffectView = 0;
1473 for (UIView* subview in childClippingView.subviews) {
1474 if (![subview isKindOfClass:[UIVisualEffectView
class]]) {
1477 XCTAssertLessThan(numberOfExpectedVisualEffectView, 1u);
1478 if ([
self validateOneVisualEffectView:subview
1479 expectedFrame:CGRectMake(0, 0, 10, 10)
1481 numberOfExpectedVisualEffectView++;
1484 XCTAssertEqual(numberOfExpectedVisualEffectView, 1u);
1487 auto embeddedViewParams2 =
1488 std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
SkSize::Make(10, 10), stack);
1489 flutterPlatformViewsController->BeginFrame(
SkISize::Make(0, 0));
1490 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams2));
1491 flutterPlatformViewsController->CompositeEmbeddedView(2);
1494 [mockFlutterView setNeedsLayout];
1495 [mockFlutterView layoutIfNeeded];
1497 numberOfExpectedVisualEffectView = 0;
1498 for (UIView* subview in childClippingView.subviews) {
1499 if (![subview isKindOfClass:[UIVisualEffectView
class]]) {
1502 numberOfExpectedVisualEffectView++;
1504 XCTAssertEqual(numberOfExpectedVisualEffectView, 0u);
1508 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
1509 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
1514 thread_task_runner);
1515 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
1516 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
1518 mock_delegate.settings_.enable_impeller
1521 flutterPlatformViewsController,
1524 std::make_shared<fml::SyncSwitch>());
1528 flutterPlatformViewsController->RegisterViewFactory(
1529 factory,
@"MockFlutterPlatformView",
1533 flutterPlatformViewsController->OnMethodCall(
1535 methodCallWithMethodName:
@"create"
1536 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
1541 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)];
1542 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
1554 finalMatrix.
setConcat(screenScaleMatrix, rotateMatrix);
1556 auto embeddedViewParams =
1557 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(300, 300), stack);
1559 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
1560 flutterPlatformViewsController->CompositeEmbeddedView(2);
1561 CGRect platformViewRectInFlutterView = [gMockPlatformView convertRect:gMockPlatformView.bounds
1562 toView:mockFlutterView];
1568 XCTAssertLessThan(fabs(platformViewRectInFlutterView.origin.x - childClippingView.frame.origin.x),
1570 XCTAssertLessThan(fabs(platformViewRectInFlutterView.origin.y - childClippingView.frame.origin.y),
1573 fabs(platformViewRectInFlutterView.size.width - childClippingView.frame.size.width),
1576 fabs(platformViewRectInFlutterView.size.height - childClippingView.frame.size.height),
1581 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
1582 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
1587 thread_task_runner);
1588 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
1589 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
1591 mock_delegate.settings_.enable_impeller
1594 flutterPlatformViewsController,
1597 std::make_shared<fml::SyncSwitch>());
1601 flutterPlatformViewsController->RegisterViewFactory(
1602 factory,
@"MockFlutterPlatformView",
1606 flutterPlatformViewsController->OnMethodCall(
1608 methodCallWithMethodName:
@"create"
1609 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
1614 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
1615 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
1634 auto embeddedViewParams = std::make_unique<flutter::EmbeddedViewParams>(
1637 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
1638 flutterPlatformViewsController->CompositeEmbeddedView(2);
1642 [mockFlutterView addSubview:childClippingView];
1644 [mockFlutterView setNeedsLayout];
1645 [mockFlutterView layoutIfNeeded];
1646 XCTAssertNil(childClippingView.maskView);
1650 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
1651 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
1656 thread_task_runner);
1657 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
1658 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
1660 mock_delegate.settings_.enable_impeller
1663 flutterPlatformViewsController,
1666 std::make_shared<fml::SyncSwitch>());
1670 flutterPlatformViewsController->RegisterViewFactory(
1671 factory,
@"MockFlutterPlatformView",
1675 flutterPlatformViewsController->OnMethodCall(
1677 methodCallWithMethodName:
@"create"
1678 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
1683 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
1684 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
1701 auto embeddedViewParams = std::make_unique<flutter::EmbeddedViewParams>(
1704 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
1705 flutterPlatformViewsController->CompositeEmbeddedView(2);
1709 [mockFlutterView addSubview:childClippingView];
1711 [mockFlutterView setNeedsLayout];
1712 [mockFlutterView layoutIfNeeded];
1714 XCTAssertNotNil(childClippingView.maskView);
1718 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
1719 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
1724 thread_task_runner);
1725 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
1726 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
1728 mock_delegate.settings_.enable_impeller
1731 flutterPlatformViewsController,
1734 std::make_shared<fml::SyncSwitch>());
1738 flutterPlatformViewsController->RegisterViewFactory(
1739 factory,
@"MockFlutterPlatformView",
1743 flutterPlatformViewsController->OnMethodCall(
1745 methodCallWithMethodName:
@"create"
1746 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
1751 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
1752 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
1763 auto embeddedViewParams =
1764 std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
SkSize::Make(10, 10), stack);
1766 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
1767 flutterPlatformViewsController->CompositeEmbeddedView(2);
1771 [mockFlutterView addSubview:childClippingView];
1773 [mockFlutterView setNeedsLayout];
1774 [mockFlutterView layoutIfNeeded];
1776 CGRect insideClipping = CGRectMake(2, 2, 3, 3);
1777 for (
int i = 0;
i < 10;
i++) {
1778 for (
int j = 0; j < 10; j++) {
1779 CGPoint point = CGPointMake(
i, j);
1781 if (CGRectContainsPoint(insideClipping, point)) {
1782 XCTAssertEqual(alpha, 255);
1784 XCTAssertEqual(alpha, 0);
1791 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
1792 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
1797 thread_task_runner);
1798 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
1799 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
1801 mock_delegate.settings_.enable_impeller
1804 flutterPlatformViewsController,
1807 std::make_shared<fml::SyncSwitch>());
1811 flutterPlatformViewsController->RegisterViewFactory(
1812 factory,
@"MockFlutterPlatformView",
1816 flutterPlatformViewsController->OnMethodCall(
1818 methodCallWithMethodName:
@"create"
1819 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
1824 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
1825 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
1836 auto embeddedViewParams =
1837 std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
SkSize::Make(10, 10), stack);
1839 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
1840 flutterPlatformViewsController->CompositeEmbeddedView(2);
1844 [mockFlutterView addSubview:childClippingView];
1846 [mockFlutterView setNeedsLayout];
1847 [mockFlutterView layoutIfNeeded];
1868 CGRect innerClipping1 = CGRectMake(3, 2, 4, 6);
1869 CGRect innerClipping2 = CGRectMake(2, 3, 6, 4);
1870 CGRect outterClipping = CGRectMake(2, 2, 6, 6);
1871 for (
int i = 0;
i < 10;
i++) {
1872 for (
int j = 0; j < 10; j++) {
1873 CGPoint point = CGPointMake(
i, j);
1875 if (CGRectContainsPoint(innerClipping1, point) ||
1876 CGRectContainsPoint(innerClipping2, point)) {
1878 XCTAssertEqual(alpha, 255);
1879 }
else if (CGRectContainsPoint(outterClipping, point)) {
1881 XCTAssert(0 < alpha && alpha < 255);
1884 XCTAssertEqual(alpha, 0);
1891 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
1892 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
1897 thread_task_runner);
1898 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
1899 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
1901 mock_delegate.settings_.enable_impeller
1904 flutterPlatformViewsController,
1907 std::make_shared<fml::SyncSwitch>());
1911 flutterPlatformViewsController->RegisterViewFactory(
1912 factory,
@"MockFlutterPlatformView",
1916 flutterPlatformViewsController->OnMethodCall(
1918 methodCallWithMethodName:
@"create"
1919 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
1924 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
1925 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
1937 auto embeddedViewParams =
1938 std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
SkSize::Make(10, 10), stack);
1940 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
1941 flutterPlatformViewsController->CompositeEmbeddedView(2);
1945 [mockFlutterView addSubview:childClippingView];
1947 [mockFlutterView setNeedsLayout];
1948 [mockFlutterView layoutIfNeeded];
1969 CGRect innerClipping1 = CGRectMake(3, 2, 4, 6);
1970 CGRect innerClipping2 = CGRectMake(2, 3, 6, 4);
1971 CGRect outterClipping = CGRectMake(2, 2, 6, 6);
1972 for (
int i = 0;
i < 10;
i++) {
1973 for (
int j = 0; j < 10; j++) {
1974 CGPoint point = CGPointMake(
i, j);
1976 if (CGRectContainsPoint(innerClipping1, point) ||
1977 CGRectContainsPoint(innerClipping2, point)) {
1979 XCTAssertEqual(alpha, 255);
1980 }
else if (CGRectContainsPoint(outterClipping, point)) {
1982 XCTAssert(0 < alpha && alpha < 255);
1985 XCTAssertEqual(alpha, 0);
1992 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
1993 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
1998 thread_task_runner);
1999 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
2000 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
2002 mock_delegate.settings_.enable_impeller
2005 flutterPlatformViewsController,
2008 std::make_shared<fml::SyncSwitch>());
2012 flutterPlatformViewsController->RegisterViewFactory(
2013 factory,
@"MockFlutterPlatformView",
2017 flutterPlatformViewsController->OnMethodCall(
2019 methodCallWithMethodName:
@"create"
2020 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
2027 while (touchInteceptorView != nil &&
2029 touchInteceptorView = touchInteceptorView.superview;
2031 XCTAssertNotNil(touchInteceptorView);
2034 UIGestureRecognizer* forwardGectureRecognizer = nil;
2035 for (UIGestureRecognizer* gestureRecognizer in touchInteceptorView.gestureRecognizers) {
2036 if ([gestureRecognizer isKindOfClass:NSClassFromString(
@"ForwardingGestureRecognizer")]) {
2037 forwardGectureRecognizer = gestureRecognizer;
2043 NSSet* touches1 = [[NSSet alloc] init];
2044 id event1 = OCMClassMock([
UIEvent class]);
2046 [forwardGectureRecognizer touchesBegan:touches1 withEvent:event1];
2047 OCMReject([mockFlutterViewContoller touchesBegan:touches1 withEvent:event1]);
2050 NSSet* touches2 = [[NSSet alloc] init];
2051 id event2 = OCMClassMock([
UIEvent class]);
2052 flutterPlatformViewsController->SetFlutterViewController(mockFlutterViewContoller);
2053 [forwardGectureRecognizer touchesBegan:touches2 withEvent:event2];
2054 OCMVerify([mockFlutterViewContoller touchesBegan:touches2 withEvent:event2]);
2058 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
2059 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
2064 thread_task_runner);
2065 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
2066 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
2068 mock_delegate.settings_.enable_impeller
2071 flutterPlatformViewsController,
2074 std::make_shared<fml::SyncSwitch>());
2078 flutterPlatformViewsController->RegisterViewFactory(
2079 factory,
@"MockFlutterPlatformView",
2083 flutterPlatformViewsController->OnMethodCall(
2085 methodCallWithMethodName:
@"create"
2086 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
2093 while (touchInteceptorView != nil &&
2095 touchInteceptorView = touchInteceptorView.superview;
2097 XCTAssertNotNil(touchInteceptorView);
2100 UIGestureRecognizer* forwardGectureRecognizer = nil;
2101 for (UIGestureRecognizer* gestureRecognizer in touchInteceptorView.gestureRecognizers) {
2102 if ([gestureRecognizer isKindOfClass:NSClassFromString(
@"ForwardingGestureRecognizer")]) {
2103 forwardGectureRecognizer = gestureRecognizer;
2110 flutterPlatformViewsController->SetFlutterViewController(mockFlutterViewContoller);
2112 NSSet* touches1 = [[NSSet alloc] init];
2113 id event1 = OCMClassMock([
UIEvent class]);
2114 [forwardGectureRecognizer touchesBegan:touches1 withEvent:event1];
2115 OCMVerify([mockFlutterViewContoller touchesBegan:touches1 withEvent:event1]);
2117 flutterPlatformViewsController->SetFlutterViewController(nil);
2120 NSSet* touches2 = [[NSSet alloc] init];
2121 id event2 = OCMClassMock([
UIEvent class]);
2122 [forwardGectureRecognizer touchesMoved:touches2 withEvent:event2];
2123 OCMVerify([mockFlutterViewContoller touchesMoved:touches2 withEvent:event2]);
2125 NSSet* touches3 = [[NSSet alloc] init];
2126 id event3 = OCMClassMock([
UIEvent class]);
2127 [forwardGectureRecognizer touchesEnded:touches3 withEvent:event3];
2128 OCMVerify([mockFlutterViewContoller touchesEnded:touches3 withEvent:event3]);
2131 NSSet* touches4 = [[NSSet alloc] init];
2132 id event4 = OCMClassMock([
UIEvent class]);
2133 [forwardGectureRecognizer touchesBegan:touches4 withEvent:event4];
2134 OCMReject([mockFlutterViewContoller touchesBegan:touches4 withEvent:event4]);
2136 NSSet* touches5 = [[NSSet alloc] init];
2137 id event5 = OCMClassMock([
UIEvent class]);
2138 [forwardGectureRecognizer touchesEnded:touches5 withEvent:event5];
2139 OCMReject([mockFlutterViewContoller touchesEnded:touches5 withEvent:event5]);
2144 flutterPlatformViewsController->SetFlutterViewController(mockFlutterViewContoller);
2146 NSSet* touches1 = [[NSSet alloc] init];
2147 id event1 = OCMClassMock([
UIEvent class]);
2148 [forwardGectureRecognizer touchesBegan:touches1 withEvent:event1];
2149 OCMVerify([mockFlutterViewContoller touchesBegan:touches1 withEvent:event1]);
2151 flutterPlatformViewsController->SetFlutterViewController(nil);
2154 NSSet* touches2 = [[NSSet alloc] init];
2155 id event2 = OCMClassMock([
UIEvent class]);
2156 [forwardGectureRecognizer touchesMoved:touches2 withEvent:event2];
2157 OCMVerify([mockFlutterViewContoller touchesMoved:touches2 withEvent:event2]);
2159 NSSet* touches3 = [[NSSet alloc] init];
2160 id event3 = OCMClassMock([
UIEvent class]);
2161 [forwardGectureRecognizer touchesCancelled:touches3 withEvent:event3];
2162 OCMVerify([mockFlutterViewContoller forceTouchesCancelled:touches3]);
2165 NSSet* touches4 = [[NSSet alloc] init];
2166 id event4 = OCMClassMock([
UIEvent class]);
2167 [forwardGectureRecognizer touchesBegan:touches4 withEvent:event4];
2168 OCMReject([mockFlutterViewContoller touchesBegan:touches4 withEvent:event4]);
2170 NSSet* touches5 = [[NSSet alloc] init];
2171 id event5 = OCMClassMock([
UIEvent class]);
2172 [forwardGectureRecognizer touchesEnded:touches5 withEvent:event5];
2173 OCMReject([mockFlutterViewContoller touchesEnded:touches5 withEvent:event5]);
2176 flutterPlatformViewsController->Reset();
2181 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
2182 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
2187 thread_task_runner);
2188 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
2189 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
2191 mock_delegate.settings_.enable_impeller
2194 flutterPlatformViewsController,
2197 std::make_shared<fml::SyncSwitch>());
2201 flutterPlatformViewsController->RegisterViewFactory(
2202 factory,
@"MockFlutterPlatformView",
2206 flutterPlatformViewsController->OnMethodCall(
2208 methodCallWithMethodName:
@"create"
2209 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
2216 while (touchInteceptorView != nil &&
2218 touchInteceptorView = touchInteceptorView.superview;
2220 XCTAssertNotNil(touchInteceptorView);
2223 UIGestureRecognizer* forwardGectureRecognizer = nil;
2224 for (UIGestureRecognizer* gestureRecognizer in touchInteceptorView.gestureRecognizers) {
2225 if ([gestureRecognizer isKindOfClass:NSClassFromString(
@"ForwardingGestureRecognizer")]) {
2226 forwardGectureRecognizer = gestureRecognizer;
2232 flutterPlatformViewsController->SetFlutterViewController(mockFlutterViewContoller);
2235 NSSet* touches1 = [NSSet setWithObject:@1];
2236 id event1 = OCMClassMock([
UIEvent class]);
2237 [forwardGectureRecognizer touchesBegan:touches1 withEvent:event1];
2238 OCMVerify([mockFlutterViewContoller touchesBegan:touches1 withEvent:event1]);
2241 flutterPlatformViewsController->SetFlutterViewController(mockFlutterViewContoller2);
2245 NSSet* touches2 = [NSSet setWithObject:@1];
2246 id event2 = OCMClassMock([
UIEvent class]);
2247 [forwardGectureRecognizer touchesBegan:touches2 withEvent:event2];
2248 OCMVerify([mockFlutterViewContoller touchesBegan:touches2 withEvent:event2]);
2249 OCMReject([mockFlutterViewContoller2 touchesBegan:touches2 withEvent:event2]);
2251 NSSet* touches3 = [NSSet setWithObject:@1];
2252 id event3 = OCMClassMock([
UIEvent class]);
2253 [forwardGectureRecognizer touchesMoved:touches3 withEvent:event3];
2254 OCMVerify([mockFlutterViewContoller touchesMoved:touches3 withEvent:event3]);
2255 OCMReject([mockFlutterViewContoller2 touchesMoved:touches3 withEvent:event3]);
2257 NSSet* touches4 = [NSSet setWithObject:@1];
2258 id event4 = OCMClassMock([
UIEvent class]);
2259 [forwardGectureRecognizer touchesEnded:touches4 withEvent:event4];
2260 OCMVerify([mockFlutterViewContoller touchesEnded:touches4 withEvent:event4]);
2261 OCMReject([mockFlutterViewContoller2 touchesEnded:touches4 withEvent:event4]);
2263 NSSet* touches5 = [NSSet setWithObject:@1];
2264 id event5 = OCMClassMock([
UIEvent class]);
2265 [forwardGectureRecognizer touchesEnded:touches5 withEvent:event5];
2266 OCMVerify([mockFlutterViewContoller touchesEnded:touches5 withEvent:event5]);
2267 OCMReject([mockFlutterViewContoller2 touchesEnded:touches5 withEvent:event5]);
2271 NSSet* touches6 = [NSSet setWithObject:@1];
2272 id event6 = OCMClassMock([
UIEvent class]);
2273 [forwardGectureRecognizer touchesBegan:touches6 withEvent:event6];
2274 OCMVerify([mockFlutterViewContoller2 touchesBegan:touches6 withEvent:event6]);
2275 OCMReject([mockFlutterViewContoller touchesBegan:touches6 withEvent:event6]);
2278 NSSet* touches7 = [NSSet setWithObject:@1];
2279 id event7 = OCMClassMock([
UIEvent class]);
2280 [forwardGectureRecognizer touchesMoved:touches7 withEvent:event7];
2281 OCMVerify([mockFlutterViewContoller2 touchesMoved:touches7 withEvent:event7]);
2282 OCMReject([mockFlutterViewContoller touchesMoved:touches7 withEvent:event7]);
2284 NSSet* touches8 = [NSSet setWithObject:@1];
2285 id event8 = OCMClassMock([
UIEvent class]);
2286 [forwardGectureRecognizer touchesEnded:touches8 withEvent:event8];
2287 OCMVerify([mockFlutterViewContoller2 touchesEnded:touches8 withEvent:event8]);
2288 OCMReject([mockFlutterViewContoller touchesEnded:touches8 withEvent:event8]);
2290 flutterPlatformViewsController->Reset();
2294 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
2295 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
2300 thread_task_runner);
2301 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
2302 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
2304 mock_delegate.settings_.enable_impeller
2307 flutterPlatformViewsController,
2310 std::make_shared<fml::SyncSwitch>());
2314 flutterPlatformViewsController->RegisterViewFactory(
2315 factory,
@"MockFlutterPlatformView",
2319 flutterPlatformViewsController->OnMethodCall(
2321 methodCallWithMethodName:
@"create"
2322 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
2329 while (touchInteceptorView != nil &&
2331 touchInteceptorView = touchInteceptorView.superview;
2333 XCTAssertNotNil(touchInteceptorView);
2336 UIGestureRecognizer* forwardGectureRecognizer = nil;
2337 for (UIGestureRecognizer* gestureRecognizer in touchInteceptorView.gestureRecognizers) {
2338 if ([gestureRecognizer isKindOfClass:NSClassFromString(
@"ForwardingGestureRecognizer")]) {
2339 forwardGectureRecognizer = gestureRecognizer;
2345 flutterPlatformViewsController->SetFlutterViewController(mockFlutterViewContoller);
2347 NSSet* touches1 = [NSSet setWithObject:@1];
2348 id event1 = OCMClassMock([
UIEvent class]);
2349 [forwardGectureRecognizer touchesBegan:touches1 withEvent:event1];
2351 [forwardGectureRecognizer touchesCancelled:touches1 withEvent:event1];
2352 OCMVerify([mockFlutterViewContoller forceTouchesCancelled:touches1]);
2354 flutterPlatformViewsController->Reset();
2358 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
2359 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
2364 thread_task_runner);
2365 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
2366 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
2368 mock_delegate.settings_.enable_impeller
2371 flutterPlatformViewsController,
2374 std::make_shared<fml::SyncSwitch>());
2378 flutterPlatformViewsController->RegisterViewFactory(
2379 factory,
@"MockFlutterPlatformView",
2383 flutterPlatformViewsController->OnMethodCall(
2385 methodCallWithMethodName:
@"create"
2386 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
2395 auto embeddedViewParams_1 =
2396 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(300, 300), stack);
2398 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams_1));
2399 flutterPlatformViewsController->CompositeEmbeddedView(2);
2401 auto mock_surface = std::make_unique<flutter::SurfaceFrame>(
2402 nullptr, framebuffer_info,
2406 flutterPlatformViewsController->SubmitFrame(
nullptr,
nullptr, std::move(
mock_surface)));
2408 auto embeddedViewParams_2 =
2409 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(300, 300), stack);
2410 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams_2));
2411 flutterPlatformViewsController->CompositeEmbeddedView(2);
2412 auto mock_surface_submit_true = std::make_unique<flutter::SurfaceFrame>(
2413 nullptr, framebuffer_info,
2416 XCTAssertTrue(flutterPlatformViewsController->SubmitFrame(
nullptr,
nullptr,
2417 std::move(mock_surface_submit_true)));
2422 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
2423 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
2428 thread_task_runner);
2429 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
2430 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
2432 mock_delegate.settings_.enable_impeller
2435 flutterPlatformViewsController,
2438 std::make_shared<fml::SyncSwitch>());
2440 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)];
2441 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
2445 flutterPlatformViewsController->RegisterViewFactory(
2446 factory,
@"MockFlutterPlatformView",
2452 flutterPlatformViewsController->OnMethodCall(
2454 methodCallWithMethodName:
@"create"
2455 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
2460 auto embeddedViewParams =
2461 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(300, 300), stack);
2462 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
2463 flutterPlatformViewsController->CompositeEmbeddedView(2);
2468 flutterPlatformViewsController->Reset();
2474 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
2475 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
2480 thread_task_runner);
2481 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
2482 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
2484 mock_delegate.settings_.enable_impeller
2487 flutterPlatformViewsController,
2490 std::make_shared<fml::SyncSwitch>());
2492 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)];
2493 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
2497 flutterPlatformViewsController->RegisterViewFactory(
2498 factory,
@"MockFlutterPlatformView",
2503 flutterPlatformViewsController->OnMethodCall(
2505 methodCallWithMethodName:
@"create"
2506 arguments:@{
@"id" : @0,
@"viewType" :
@"MockFlutterPlatformView"}],
2510 flutterPlatformViewsController->BeginFrame(
SkISize::Make(300, 300));
2513 auto embeddedViewParams1 =
2514 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(300, 300), stack);
2515 flutterPlatformViewsController->PrerollCompositeEmbeddedView(0, std::move(embeddedViewParams1));
2516 flutterPlatformViewsController->CompositeEmbeddedView(0);
2517 XCTAssertEqual(flutterPlatformViewsController->EmbeddedViewCount(), 1UL);
2520 flutterPlatformViewsController->BeginFrame(
SkISize::Make(300, 300));
2521 XCTAssertEqual(flutterPlatformViewsController->EmbeddedViewCount(), 0
UL);
2523 auto embeddedViewParams2 =
2524 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(300, 300), stack);
2525 flutterPlatformViewsController->PrerollCompositeEmbeddedView(0, std::move(embeddedViewParams2));
2526 flutterPlatformViewsController->CompositeEmbeddedView(0);
2527 XCTAssertEqual(flutterPlatformViewsController->EmbeddedViewCount(), 1UL);
2532 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
2533 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
2538 thread_task_runner);
2539 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
2540 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
2542 mock_delegate.settings_.enable_impeller
2545 flutterPlatformViewsController,
2548 std::make_shared<fml::SyncSwitch>());
2550 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)];
2551 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
2555 flutterPlatformViewsController->RegisterViewFactory(
2556 factory,
@"MockFlutterPlatformView",
2560 flutterPlatformViewsController->OnMethodCall(
2562 methodCallWithMethodName:
@"create"
2563 arguments:@{
@"id" : @0,
@"viewType" :
@"MockFlutterPlatformView"}],
2568 flutterPlatformViewsController->OnMethodCall(
2570 methodCallWithMethodName:
@"create"
2571 arguments:@{
@"id" : @1,
@"viewType" :
@"MockFlutterPlatformView"}],
2575 flutterPlatformViewsController->BeginFrame(
SkISize::Make(300, 300));
2578 auto embeddedViewParams1 =
2579 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(300, 300), stack);
2580 flutterPlatformViewsController->PrerollCompositeEmbeddedView(0, std::move(embeddedViewParams1));
2581 flutterPlatformViewsController->CompositeEmbeddedView(0);
2582 auto embeddedViewParams2 =
2583 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(500, 500), stack);
2584 flutterPlatformViewsController->PrerollCompositeEmbeddedView(1, std::move(embeddedViewParams2));
2585 flutterPlatformViewsController->CompositeEmbeddedView(1);
2591 auto mock_surface = std::make_unique<flutter::SurfaceFrame>(
2592 std::move(mock_sk_surface), framebuffer_info,
2597 flutterPlatformViewsController->SubmitFrame(
nullptr,
nullptr, std::move(
mock_surface)));
2599 UIView* clippingView1 = view1.superview.superview;
2600 UIView* clippingView2 = view2.superview.superview;
2601 UIView* flutterView = clippingView1.superview;
2602 XCTAssertTrue([flutterView.subviews indexOfObject:clippingView1] <
2603 [flutterView.subviews indexOfObject:clippingView2],
2604 @"The first clipping view should be added before the second clipping view.");
2607 flutterPlatformViewsController->BeginFrame(
SkISize::Make(300, 300));
2609 embeddedViewParams2 =
2610 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(500, 500), stack);
2611 flutterPlatformViewsController->PrerollCompositeEmbeddedView(1, std::move(embeddedViewParams2));
2612 flutterPlatformViewsController->CompositeEmbeddedView(1);
2613 embeddedViewParams1 =
2614 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(300, 300), stack);
2615 flutterPlatformViewsController->PrerollCompositeEmbeddedView(0, std::move(embeddedViewParams1));
2616 flutterPlatformViewsController->CompositeEmbeddedView(0);
2619 mock_surface = std::make_unique<flutter::SurfaceFrame>(
2620 std::move(mock_sk_surface), framebuffer_info,
2624 flutterPlatformViewsController->SubmitFrame(
nullptr,
nullptr, std::move(
mock_surface)));
2625 XCTAssertTrue([flutterView.subviews indexOfObject:clippingView1] >
2626 [flutterView.subviews indexOfObject:clippingView2],
2627 @"The first clipping view should be added after the second clipping view.");
2632 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
2633 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
2638 thread_task_runner);
2639 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
2640 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
2642 mock_delegate.settings_.enable_impeller
2645 flutterPlatformViewsController,
2648 std::make_shared<fml::SyncSwitch>());
2650 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)];
2651 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
2655 flutterPlatformViewsController->RegisterViewFactory(
2656 factory,
@"MockFlutterPlatformView",
2660 flutterPlatformViewsController->OnMethodCall(
2662 methodCallWithMethodName:
@"create"
2663 arguments:@{
@"id" : @0,
@"viewType" :
@"MockFlutterPlatformView"}],
2668 flutterPlatformViewsController->OnMethodCall(
2670 methodCallWithMethodName:
@"create"
2671 arguments:@{
@"id" : @1,
@"viewType" :
@"MockFlutterPlatformView"}],
2675 flutterPlatformViewsController->BeginFrame(
SkISize::Make(300, 300));
2678 auto embeddedViewParams1 =
2679 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(300, 300), stack);
2680 flutterPlatformViewsController->PrerollCompositeEmbeddedView(0, std::move(embeddedViewParams1));
2681 flutterPlatformViewsController->CompositeEmbeddedView(0);
2682 auto embeddedViewParams2 =
2683 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(500, 500), stack);
2684 flutterPlatformViewsController->PrerollCompositeEmbeddedView(1, std::move(embeddedViewParams2));
2685 flutterPlatformViewsController->CompositeEmbeddedView(1);
2691 auto mock_surface = std::make_unique<flutter::SurfaceFrame>(
2692 std::move(mock_sk_surface), framebuffer_info,
2697 flutterPlatformViewsController->SubmitFrame(
nullptr,
nullptr, std::move(
mock_surface)));
2699 UIView* clippingView1 = view1.superview.superview;
2700 UIView* clippingView2 = view2.superview.superview;
2701 UIView* flutterView = clippingView1.superview;
2702 XCTAssertTrue([flutterView.subviews indexOfObject:clippingView1] <
2703 [flutterView.subviews indexOfObject:clippingView2],
2704 @"The first clipping view should be added before the second clipping view.");
2707 flutterPlatformViewsController->BeginFrame(
SkISize::Make(300, 300));
2709 embeddedViewParams1 =
2710 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(300, 300), stack);
2711 flutterPlatformViewsController->PrerollCompositeEmbeddedView(0, std::move(embeddedViewParams1));
2712 flutterPlatformViewsController->CompositeEmbeddedView(0);
2713 embeddedViewParams2 =
2714 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(500, 500), stack);
2715 flutterPlatformViewsController->PrerollCompositeEmbeddedView(1, std::move(embeddedViewParams2));
2716 flutterPlatformViewsController->CompositeEmbeddedView(1);
2719 mock_surface = std::make_unique<flutter::SurfaceFrame>(
2720 std::move(mock_sk_surface), framebuffer_info,
2724 flutterPlatformViewsController->SubmitFrame(
nullptr,
nullptr, std::move(
mock_surface)));
2725 XCTAssertTrue([flutterView.subviews indexOfObject:clippingView1] <
2726 [flutterView.subviews indexOfObject:clippingView2],
2727 @"The first clipping view should be added before the second clipping view.");
2731 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
2732 auto thread_task_runner_platform =
CreateNewThread(
"FlutterPlatformViewsTest1");
2733 auto thread_task_runner_other =
CreateNewThread(
"FlutterPlatformViewsTest2");
2735 thread_task_runner_platform,
2736 thread_task_runner_other,
2737 thread_task_runner_other,
2738 thread_task_runner_other);
2739 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
2740 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
2742 mock_delegate.settings_.enable_impeller
2745 flutterPlatformViewsController,
2748 std::make_shared<fml::SyncSwitch>());
2750 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)];
2751 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
2755 flutterPlatformViewsController->RegisterViewFactory(
2756 factory,
@"MockFlutterPlatformView",
2758 XCTestExpectation* waitForPlatformView =
2759 [
self expectationWithDescription:@"wait for platform view to be created"];
2761 [waitForPlatformView fulfill];
2764 flutterPlatformViewsController->OnMethodCall(
2766 methodCallWithMethodName:
@"create"
2767 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
2769 [
self waitForExpectations:@[ waitForPlatformView ] timeout:30];
2772 flutterPlatformViewsController->BeginFrame(
SkISize::Make(300, 300));
2775 auto embeddedViewParams =
2776 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(300, 300), stack);
2777 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
2780 fml::MakeRefCounted<fml::RasterThreadMerger>(thread_task_runner_platform->GetTaskQueueId(),
2781 thread_task_runner_other->GetTaskQueueId());
2782 XCTAssertEqual(flutterPlatformViewsController->PostPrerollAction(raster_thread_merger),
2784 XCTAssertFalse(raster_thread_merger->
IsMerged());
2786 flutterPlatformViewsController->EndFrame(
true, raster_thread_merger);
2787 XCTAssertTrue(raster_thread_merger->
IsMerged());
2795- (
int)alphaOfPoint:(CGPoint)point onView:(UIView*)view {
2796 unsigned char pixel[4] = {0};
2798 CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
2801 CGContextRef context = CGBitmapContextCreate(
2802 pixel, 1, 1, 8, 4, colorSpace, kCGBitmapAlphaInfoMask & kCGImageAlphaPremultipliedLast);
2803 CGContextTranslateCTM(context, -point.x, -point.y);
2804 [view.layer renderInContext:context];
2806 CGContextRelease(context);
2807 CGColorSpaceRelease(colorSpace);
2814 UIWindow*
window = [[UIWindow alloc] init];
2815 UITextField* textField = [[UITextField alloc] init];
2816 [window addSubview:textField];
2818 [textField becomeFirstResponder];
2819 XCTAssertTrue(textField.isFirstResponder);
2820 XCTAssertTrue(textField.flt_hasFirstResponderInViewHierarchySubtree);
2821 [textField resignFirstResponder];
2822 XCTAssertFalse(textField.isFirstResponder);
2823 XCTAssertFalse(textField.flt_hasFirstResponderInViewHierarchySubtree);
2828 UIWindow*
window = [[UIWindow alloc] init];
2829 UIView* view = [[UIView alloc] init];
2830 UIView* childView = [[UIView alloc] init];
2831 UITextField* textField = [[UITextField alloc] init];
2832 [window addSubview:view];
2833 [view addSubview:childView];
2834 [childView addSubview:textField];
2836 [textField becomeFirstResponder];
2837 XCTAssertTrue(textField.isFirstResponder);
2838 XCTAssertTrue(view.flt_hasFirstResponderInViewHierarchySubtree);
2839 [textField resignFirstResponder];
2840 XCTAssertFalse(textField.isFirstResponder);
2841 XCTAssertFalse(view.flt_hasFirstResponderInViewHierarchySubtree);
2850 CGRect newRect = CGRectMake(0, 0, 10, 10);
2854 NSSet* set1 = [NSSet setWithObjects:view1, view2, nil];
2855 NSSet* set2 = [NSSet setWithObjects:view3, view4, nil];
2856 XCTAssertEqualObjects(set1, set2);
2857 XCTAssertTrue(CGRectEqualToRect(view3.frame, newRect));
2858 XCTAssertTrue(CGRectEqualToRect(view4.frame, newRect));
2866 XCTAssertNotEqual(view1, view3);
2867 XCTAssertNotEqual(view2, view3);
2871 __weak UIView* weakView;
2876 XCTAssertNotNil(weakView);
2878 XCTAssertNil(weakView);
2882 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
2883 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
2888 thread_task_runner);
2889 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
2890 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
2892 mock_delegate.settings_.enable_impeller
2895 flutterPlatformViewsController,
2898 std::make_shared<fml::SyncSwitch>());
2902 flutterPlatformViewsController->RegisterViewFactory(
2903 factory,
@"MockFlutterPlatformView",
2907 flutterPlatformViewsController->OnMethodCall(
2909 methodCallWithMethodName:
@"create"
2910 arguments:@{
@"id" : @1,
@"viewType" :
@"MockFlutterPlatformView"}],
2914 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
2915 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
2926 auto embeddedViewParams1 = std::make_unique<flutter::EmbeddedViewParams>(
2929 flutterPlatformViewsController->PrerollCompositeEmbeddedView(1, std::move(embeddedViewParams1));
2930 flutterPlatformViewsController->CompositeEmbeddedView(1);
2932 UIView* maskView1 = childClippingView1.maskView;
2933 XCTAssertNotNil(maskView1);
2936 flutterPlatformViewsController->BeginFrame(
SkISize::Make(100, 100));
2938 auto embeddedViewParams2 = std::make_unique<flutter::EmbeddedViewParams>(
2940 auto embeddedViewParams3 = std::make_unique<flutter::EmbeddedViewParams>(
2942 flutterPlatformViewsController->PrerollCompositeEmbeddedView(1, std::move(embeddedViewParams3));
2943 flutterPlatformViewsController->CompositeEmbeddedView(1);
2947 flutterPlatformViewsController->OnMethodCall(
2949 methodCallWithMethodName:
@"create"
2950 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
2953 auto embeddedViewParams4 = std::make_unique<flutter::EmbeddedViewParams>(
2955 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams4));
2956 flutterPlatformViewsController->CompositeEmbeddedView(2);
2959 UIView* maskView2 = childClippingView2.maskView;
2960 XCTAssertEqual(maskView1, maskView2);
2961 XCTAssertNotNil(childClippingView2.maskView);
2962 XCTAssertNil(childClippingView1.maskView);
2966 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
2967 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
2972 thread_task_runner);
2973 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
2974 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
2976 mock_delegate.settings_.enable_impeller
2979 flutterPlatformViewsController,
2982 std::make_shared<fml::SyncSwitch>());
2986 flutterPlatformViewsController->RegisterViewFactory(
2987 factory,
@"MockFlutterPlatformView",
2992 flutterPlatformViewsController->OnMethodCall(
2994 methodCallWithMethodName:
@"create"
2995 arguments:@{
@"id" : @1,
@"viewType" :
@"MockFlutterPlatformView"}],
3000 flutterPlatformViewsController->OnMethodCall(
3002 methodCallWithMethodName:
@"create"
3003 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
3008 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
3009 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
3020 auto embeddedViewParams1 = std::make_unique<flutter::EmbeddedViewParams>(
3025 auto embeddedViewParams2 = std::make_unique<flutter::EmbeddedViewParams>(
3028 flutterPlatformViewsController->PrerollCompositeEmbeddedView(1, std::move(embeddedViewParams1));
3029 flutterPlatformViewsController->CompositeEmbeddedView(1);
3030 UIView* childClippingView1 = view1.superview.superview;
3032 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams2));
3033 flutterPlatformViewsController->CompositeEmbeddedView(2);
3034 UIView* childClippingView2 = view2.superview.superview;
3035 UIView* maskView1 = childClippingView1.maskView;
3036 UIView* maskView2 = childClippingView2.maskView;
3037 XCTAssertNotEqual(maskView1, maskView2);
3041 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
3042 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
3047 thread_task_runner);
3048 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
3049 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
3051 mock_delegate.settings_.enable_impeller
3054 flutterPlatformViewsController,
3057 std::make_shared<fml::SyncSwitch>());
3061 flutterPlatformViewsController->RegisterViewFactory(
3062 factory,
@"MockFlutterPlatformView",
3067 flutterPlatformViewsController->OnMethodCall(
3069 methodCallWithMethodName:
@"create"
3070 arguments:@{
@"id" : @1,
@"viewType" :
@"MockFlutterPlatformView"}],
3074 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
3075 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
3086 auto embeddedViewParams1 = std::make_unique<flutter::EmbeddedViewParams>(
3091 auto embeddedViewParams2 = std::make_unique<flutter::EmbeddedViewParams>(
3094 flutterPlatformViewsController->PrerollCompositeEmbeddedView(1, std::move(embeddedViewParams1));
3095 flutterPlatformViewsController->CompositeEmbeddedView(1);
3098 UIView* maskView = childClippingView.maskView;
3099 XCTAssert([maskView.layer isKindOfClass:[CAShapeLayer
class]],
3100 @"Mask view must use CAShapeLayer as its backing layer.");
3108- (
BOOL)validateOneVisualEffectView:(UIView*)visualEffectView
3109 expectedFrame:(CGRect)
frame
3110 inputRadius:(CGFloat)inputRadius {
3111 XCTAssertTrue(CGRectEqualToRect(visualEffectView.frame,
frame));
3112 for (UIView* view in visualEffectView.subviews) {
3113 if (![NSStringFromClass([view
class]) hasSuffix:
@"BackdropView"]) {
3116 XCTAssertEqual(view.layer.filters.count, 1u);
3117 NSObject* filter = view.layer.filters.firstObject;
3119 XCTAssertEqualObjects([filter valueForKey:
@"name"],
@"gaussianBlur");
3121 NSObject* inputRadiusInFilter = [filter valueForKey:@"inputRadius"];
3122 XCTAssertTrue([inputRadiusInFilter isKindOfClass:[NSNumber
class]] &&
3131 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
3132 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
3137 thread_task_runner);
3138 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
3139 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
3141 mock_delegate.settings_.enable_impeller
3144 flutterPlatformViewsController,
3147 std::make_shared<fml::SyncSwitch>());
3149 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)];
3150 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
3154 flutterPlatformViewsController->RegisterViewFactory(
3155 factory,
@"MockFlutterPlatformView",
3160 flutterPlatformViewsController->OnMethodCall(
3162 methodCallWithMethodName:
@"create"
3163 arguments:@{
@"id" : @0,
@"viewType" :
@"MockFlutterPlatformView"}],
3165 flutterPlatformViewsController->OnMethodCall(
3167 methodCallWithMethodName:
@"create"
3168 arguments:@{
@"id" : @1,
@"viewType" :
@"MockFlutterPlatformView"}],
3174 flutterPlatformViewsController->BeginFrame(
SkISize::Make(300, 300));
3177 auto embeddedViewParams0 =
3178 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(300, 300), stack);
3179 flutterPlatformViewsController->PrerollCompositeEmbeddedView(0, std::move(embeddedViewParams0));
3180 flutterPlatformViewsController->CompositeEmbeddedView(0);
3182 auto embeddedViewParams1 =
3183 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(300, 300), stack);
3184 flutterPlatformViewsController->PrerollCompositeEmbeddedView(1, std::move(embeddedViewParams1));
3185 flutterPlatformViewsController->CompositeEmbeddedView(1);
3186 XCTAssertEqual(flutterPlatformViewsController->EmbeddedViewCount(), 2UL);
3188 XCTestExpectation*
expectation = [
self expectationWithDescription:@"dispose call ended."];
3190 [expectation fulfill];
3193 flutterPlatformViewsController->OnMethodCall(
3194 [
FlutterMethodCall methodCallWithMethodName:
@"dispose" arguments:@0], disposeResult);
3195 [
self waitForExpectationsWithTimeout:30 handler:nil];
3200 auto mock_surface = std::make_unique<flutter::SurfaceFrame>(
3201 std::move(mock_sk_surface), framebuffer_info,
3205 flutterPlatformViewsController->SubmitFrame(
nullptr,
nullptr, std::move(
mock_surface)));
3208 XCTAssertEqual(flutterPlatformViewsController->EmbeddedViewCount(), 2UL);
3209 XCTAssertNotNil(flutterPlatformViewsController->GetPlatformViewByID(0));
3210 XCTAssertNotNil(flutterPlatformViewsController->GetPlatformViewByID(1));
3216 flutterPlatformViewsController->BeginFrame(
SkISize::Make(300, 300));
3219 auto embeddedViewParams1 =
3220 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(300, 300), stack);
3221 flutterPlatformViewsController->PrerollCompositeEmbeddedView(1, std::move(embeddedViewParams1));
3222 flutterPlatformViewsController->CompositeEmbeddedView(1);
3227 auto mock_surface = std::make_unique<flutter::SurfaceFrame>(
3228 std::move(mock_sk_surface), framebuffer_info,
3232 flutterPlatformViewsController->SubmitFrame(
nullptr,
nullptr, std::move(
mock_surface)));
3235 XCTAssertEqual(flutterPlatformViewsController->EmbeddedViewCount(), 1UL);
3236 XCTAssertNil(flutterPlatformViewsController->GetPlatformViewByID(0));
3237 XCTAssertNotNil(flutterPlatformViewsController->GetPlatformViewByID(1));
3241 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
3242 auto thread_task_runner =
CreateNewThread(
"FlutterPlatformViewsTest");
3247 thread_task_runner);
3248 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
3249 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
3251 mock_delegate.settings_.enable_impeller
3254 flutterPlatformViewsController,
3257 std::make_shared<fml::SyncSwitch>());
3261 flutterPlatformViewsController->RegisterViewFactory(
3262 factory,
@"MockFlutterPlatformView",
3266 flutterPlatformViewsController->OnMethodCall(
3268 methodCallWithMethodName:
@"create"
3269 arguments:@{
@"id" : @2,
@"viewType" :
@"MockFlutterPlatformView"}],
3271 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)];
3272 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
3283 finalMatrix.
setConcat(screenScaleMatrix, translateMatrix);
3285 auto embeddedViewParams =
3286 std::make_unique<flutter::EmbeddedViewParams>(finalMatrix,
SkSize::Make(300, 300), stack);
3288 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
3289 flutterPlatformViewsController->CompositeEmbeddedView(2);
3295 auto mock_surface = std::make_unique<flutter::SurfaceFrame>(
3296 std::move(mock_sk_surface), framebuffer_info,
3300 flutterPlatformViewsController->SubmitFrame(
nullptr,
nullptr, std::move(
mock_surface));
3302 UIView* someView = [[UIView alloc] init];
3303 [mockFlutterView addSubview:someView];
3305 flutterPlatformViewsController->Reset();
3306 XCTAssertEqual(mockFlutterView.subviews.count, 1u);
3307 XCTAssertEqual(mockFlutterView.subviews.firstObject, someView);
3312 NSObject* container = [[NSObject alloc] init];
3313 [touchInteceptorView setFlutterAccessibilityContainer:container];
3314 XCTAssertEqualObjects([touchInteceptorView accessibilityContainer], container);
void(^ FlutterResult)(id _Nullable result)
@ FlutterPlatformViewGestureRecognizersBlockingPolicyEager
for(const auto glyph :glyphs)
static SkMatrix Scale(SkScalar sx, SkScalar sy)
static SkMatrix Translate(SkScalar dx, SkScalar dy)
static SkMatrix Concat(const SkMatrix &a, const SkMatrix &b)
SkMatrix & setRotate(SkScalar degrees, SkScalar px, SkScalar py)
SkMatrix & setConcat(const SkMatrix &a, const SkMatrix &b)
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
AssetResolverType
Identifies the type of AssetResolver an instance is.
Developer-facing API for rendering anything within the engine.
A Mapping like NonOwnedMapping, but uses Free as its release proc.
RasterThreadStatus DecrementLease()
FlutterSemanticsFlag flags
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
NSMutableArray * backdropFilterSubviews()
void applyBlurBackdropFilters:(NSArray< PlatformViewFilter * > *filters)
FlutterClippingMaskView * getMaskViewWithFrame:(CGRect frame)
void insertViewToPoolIfNeeded:(FlutterClippingMaskView *maskView)
static MockSurface mock_surface
fml::RefPtr< fml::TaskRunner > CreateNewThread(const std::string &name)
sk_sp< SkBlender > blender SkRect rect
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
BOOL BlurRadiusEqualToBlurRadius(CGFloat radius1, CGFloat radius2)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
DEF_SWITCHES_START aot vmservice shared library name
static void LoadDartDeferredLibrary(JNIEnv *env, jobject obj, jlong shell_holder, jint jLoadingUnitId, jobjectArray jSearchPaths)
std::function< void()> closure
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo MakeN32Premul(int width, int height)
static constexpr SkRect MakeEmpty()
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
static constexpr SkSize Make(SkScalar w, SkScalar h)