@@ -958,6 +958,130 @@ void main() {
958958
959959 });
960960 });
961+
962+ group ('LookupBoundary.debugIsHidingAncestorWidgetOfExactType' , () {
963+ testWidgets ('is hiding' , (WidgetTester tester) async {
964+ bool ? isHidden;
965+ await tester.pumpWidget (Container (
966+ color: Colors .blue,
967+ child: LookupBoundary (
968+ child: Builder (
969+ builder: (BuildContext context) {
970+ isHidden = LookupBoundary .debugIsHidingAncestorWidgetOfExactType <Container >(context);
971+ return Container ();
972+ },
973+ ),
974+ ),
975+ ));
976+ expect (isHidden, isTrue);
977+ });
978+
979+ testWidgets ('is not hiding entity within boundary' , (WidgetTester tester) async {
980+ bool ? isHidden;
981+ await tester.pumpWidget (Container (
982+ color: Colors .blue,
983+ child: LookupBoundary (
984+ child: Container (
985+ color: Colors .red,
986+ child: Builder (
987+ builder: (BuildContext context) {
988+ isHidden = LookupBoundary .debugIsHidingAncestorWidgetOfExactType <Container >(context);
989+ return Container ();
990+ },
991+ ),
992+ ),
993+ ),
994+ ));
995+ expect (isHidden, isFalse);
996+ });
997+
998+ testWidgets ('is not hiding if no boundary exists' , (WidgetTester tester) async {
999+ bool ? isHidden;
1000+ await tester.pumpWidget (Container (
1001+ color: Colors .blue,
1002+ child: Builder (
1003+ builder: (BuildContext context) {
1004+ isHidden = LookupBoundary .debugIsHidingAncestorWidgetOfExactType <Container >(context);
1005+ return Container ();
1006+ },
1007+ ),
1008+ ));
1009+ expect (isHidden, isFalse);
1010+ });
1011+
1012+ testWidgets ('is not hiding if no boundary and no entity exists' , (WidgetTester tester) async {
1013+ bool ? isHidden;
1014+ await tester.pumpWidget (Builder (
1015+ builder: (BuildContext context) {
1016+ isHidden = LookupBoundary .debugIsHidingAncestorWidgetOfExactType <Container >(context);
1017+ return Container ();
1018+ },
1019+ ));
1020+ expect (isHidden, isFalse);
1021+ });
1022+ });
1023+
1024+ group ('LookupBoundary.debugIsHidingAncestorRenderObjectOfType' , () {
1025+ testWidgets ('is hiding' , (WidgetTester tester) async {
1026+ bool ? isHidden;
1027+ await tester.pumpWidget (Padding (
1028+ padding: EdgeInsets .zero,
1029+ child: LookupBoundary (
1030+ child: Builder (
1031+ builder: (BuildContext context) {
1032+ isHidden = LookupBoundary .debugIsHidingAncestorRenderObjectOfType <RenderPadding >(context);
1033+ return Container ();
1034+ },
1035+ ),
1036+ ),
1037+ ));
1038+ expect (isHidden, isTrue);
1039+ });
1040+
1041+ testWidgets ('is not hiding entity within boundary' , (WidgetTester tester) async {
1042+ bool ? isHidden;
1043+ await tester.pumpWidget (Padding (
1044+ padding: EdgeInsets .zero,
1045+ child: LookupBoundary (
1046+ child: Padding (
1047+ padding: EdgeInsets .zero,
1048+ child: Builder (
1049+ builder: (BuildContext context) {
1050+ isHidden = LookupBoundary .debugIsHidingAncestorRenderObjectOfType <RenderPadding >(context);
1051+ return Container ();
1052+ },
1053+ ),
1054+ ),
1055+ ),
1056+ ));
1057+ expect (isHidden, isFalse);
1058+ });
1059+
1060+ testWidgets ('is not hiding if no boundary exists' , (WidgetTester tester) async {
1061+ bool ? isHidden;
1062+ await tester.pumpWidget (Padding (
1063+ padding: EdgeInsets .zero,
1064+ child: Builder (
1065+ builder: (BuildContext context) {
1066+ isHidden = LookupBoundary .debugIsHidingAncestorRenderObjectOfType <RenderPadding >(context);
1067+ return Container ();
1068+ },
1069+ ),
1070+ ));
1071+ expect (isHidden, isFalse);
1072+ });
1073+
1074+ testWidgets ('is not hiding if no boundary and no entity exists' , (WidgetTester tester) async {
1075+ bool ? isHidden;
1076+ await tester.pumpWidget (Builder (
1077+ builder: (BuildContext context) {
1078+ isHidden = LookupBoundary .debugIsHidingAncestorRenderObjectOfType <RenderPadding >(context);
1079+ return Container ();
1080+ },
1081+ ));
1082+ expect (isHidden, isFalse);
1083+ });
1084+ });
9611085}
9621086
9631087class MyStatefulContainer extends StatefulWidget {
0 commit comments