766 {
767 flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
770 thread_task_runner,
771 thread_task_runner,
772 thread_task_runner,
773 thread_task_runner);
774 auto flutterPlatformViewsController = std::make_shared<flutter::FlutterPlatformViewsController>();
775 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
776 mock_delegate,
777 mock_delegate.settings_.enable_impeller
780 flutterPlatformViewsController,
781 runners,
782 nil,
783 std::make_shared<fml::SyncSwitch>());
784
787 flutterPlatformViewsController->RegisterViewFactory(
788 factory, @"MockFlutterPlatformView",
791 };
792 flutterPlatformViewsController->OnMethodCall(
794 methodCallWithMethodName:@"create"
795 arguments:@{@"id" : @2, @"viewType" : @"MockFlutterPlatformView"}],
797
799
800 UIView* mockFlutterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
801 flutterPlatformViewsController->SetFlutterView(mockFlutterView);
802
804
805 CGFloat screenScale = [UIScreen mainScreen].scale;
808
810 for (
int i = 0;
i < 5;
i++) {
812 }
813
814 auto embeddedViewParams =
815 std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
SkSize::Make(10, 10), stack);
816
817 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
818 flutterPlatformViewsController->CompositeEmbeddedView(2);
821 [mockFlutterView addSubview:childClippingView];
822
823 [mockFlutterView setNeedsLayout];
824 [mockFlutterView layoutIfNeeded];
825
826 NSMutableArray* originalVisualEffectViews = [[NSMutableArray alloc]
init];
827 for (UIView* subview in childClippingView.subviews) {
828 if (![subview isKindOfClass:[UIVisualEffectView class]]) {
829 continue;
830 }
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];
836 }
837 }
838
839
840
842
844
845 for (
int i = 0;
i < 5;
i++) {
847 auto filter2 =
849
852 continue;
853 }
854
856 }
857
858 embeddedViewParams = std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
860
861 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
862 flutterPlatformViewsController->CompositeEmbeddedView(2);
863 [mockFlutterView setNeedsLayout];
864 [mockFlutterView layoutIfNeeded];
865
866 NSMutableArray* newVisualEffectViews = [[NSMutableArray alloc] init];
867 for (UIView* subview in childClippingView.subviews) {
868 if (![subview isKindOfClass:[UIVisualEffectView class]]) {
869 continue;
870 }
871 XCTAssertLessThan(newVisualEffectViews.count, 5u);
872 CGFloat expectInputRadius = 5;
873 if (newVisualEffectViews.count == 3) {
874 expectInputRadius = 2;
875 }
876 if ([self validateOneVisualEffectView:subview
877 expectedFrame:CGRectMake(0, 0, 10, 10)
878 inputRadius:(CGFloat)expectInputRadius]) {
879 [newVisualEffectViews addObject:subview];
880 }
881 }
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];
887
888 XCTAssertEqual(originalView, newView);
889 OCMReject([mockNewView removeFromSuperview]);
890 [mockNewView stopMocking];
891 }
892 [newVisualEffectViews removeAllObjects];
893
894
895
896 for (
int i = 0;
i < 5;
i++) {
898 }
899
900 for (
int i = 0;
i < 5;
i++) {
902 auto filter2 =
906 continue;
907 }
908
910 }
911
912 embeddedViewParams = std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
914
915 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
916 flutterPlatformViewsController->CompositeEmbeddedView(2);
917 [mockFlutterView setNeedsLayout];
918 [mockFlutterView layoutIfNeeded];
919
920 for (UIView* subview in childClippingView.subviews) {
921 if (![subview isKindOfClass:[UIVisualEffectView class]]) {
922 continue;
923 }
924 XCTAssertLessThan(newVisualEffectViews.count, 5u);
925 CGFloat expectInputRadius = 5;
926 if (newVisualEffectViews.count == 0) {
927 expectInputRadius = 2;
928 }
929 if ([self validateOneVisualEffectView:subview
930 expectedFrame:CGRectMake(0, 0, 10, 10)
931 inputRadius:(CGFloat)expectInputRadius]) {
932 [newVisualEffectViews addObject:subview];
933 }
934 }
935 for (NSUInteger
i = 0;
i < newVisualEffectViews.count;
i++) {
936 UIView* newView = newVisualEffectViews[i];
937 id mockNewView = OCMPartialMock(newView);
938 UIView* originalView = originalVisualEffectViews[i];
939
940 XCTAssertEqual(originalView, newView);
941 OCMReject([mockNewView removeFromSuperview]);
942 [mockNewView stopMocking];
943 }
944 [newVisualEffectViews removeAllObjects];
945
946
947
948 for (
int i = 0;
i < 5;
i++) {
950 }
951
952 for (
int i = 0;
i < 5;
i++) {
954 auto filter2 =
958 continue;
959 }
960
962 }
963
964 embeddedViewParams = std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
966
967 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
968 flutterPlatformViewsController->CompositeEmbeddedView(2);
969 [mockFlutterView setNeedsLayout];
970 [mockFlutterView layoutIfNeeded];
971
972 for (UIView* subview in childClippingView.subviews) {
973 if (![subview isKindOfClass:[UIVisualEffectView class]]) {
974 continue;
975 }
976 XCTAssertLessThan(newVisualEffectViews.count, 5u);
977 CGFloat expectInputRadius = 5;
978 if (newVisualEffectViews.count == 4) {
979 expectInputRadius = 2;
980 }
981 if ([self validateOneVisualEffectView:subview
982 expectedFrame:CGRectMake(0, 0, 10, 10)
983 inputRadius:(CGFloat)expectInputRadius]) {
984 [newVisualEffectViews addObject:subview];
985 }
986 }
987 XCTAssertEqual(newVisualEffectViews.count, 5u);
988
989 for (NSUInteger
i = 0;
i < newVisualEffectViews.count;
i++) {
990 UIView* newView = newVisualEffectViews[i];
991 id mockNewView = OCMPartialMock(newView);
992 UIView* originalView = originalVisualEffectViews[i];
993
994 XCTAssertEqual(originalView, newView);
995 OCMReject([mockNewView removeFromSuperview]);
996 [mockNewView stopMocking];
997 }
998 [newVisualEffectViews removeAllObjects];
999
1000
1001
1002 for (
int i = 0;
i < 5;
i++) {
1004 }
1005
1006 for (
int i = 0;
i < 5;
i++) {
1008
1010 }
1011
1012 embeddedViewParams = std::make_unique<flutter::EmbeddedViewParams>(screenScaleMatrix,
1014
1015 flutterPlatformViewsController->PrerollCompositeEmbeddedView(2, std::move(embeddedViewParams));
1016 flutterPlatformViewsController->CompositeEmbeddedView(2);
1017 [mockFlutterView setNeedsLayout];
1018 [mockFlutterView layoutIfNeeded];
1019
1020 for (UIView* subview in childClippingView.subviews) {
1021 if (![subview isKindOfClass:[UIVisualEffectView class]]) {
1022 continue;
1023 }
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];
1029 }
1030 }
1031 XCTAssertEqual(newVisualEffectViews.count, 5u);
1032
1033 for (NSUInteger
i = 0;
i < newVisualEffectViews.count;
i++) {
1034 UIView* newView = newVisualEffectViews[i];
1035 id mockNewView = OCMPartialMock(newView);
1036 UIView* originalView = originalVisualEffectViews[i];
1037
1038 XCTAssertEqual(originalView, newView);
1039 OCMReject([mockNewView removeFromSuperview]);
1040 [mockNewView stopMocking];
1041 }
1042 [newVisualEffectViews removeAllObjects];
1043}