77using Microsoft . Maui . Platform ;
88using Xunit ;
99using System . Collections . Generic ;
10+ using ContentView = Microsoft . Maui . Controls . ContentView ;
11+ using Microsoft . Maui . Controls . Handlers . Items ;
1012#if ANDROID || IOS || MACCATALYST
1113using ShellHandler = Microsoft . Maui . Controls . Handlers . Compatibility . ShellRenderer ;
1214#endif
@@ -23,31 +25,18 @@ void SetupBuilder()
2325 {
2426 EnsureHandlerCreated ( builder =>
2527 {
28+ builder . SetupShellHandlers ( ) ;
29+
2630 builder . ConfigureMauiHandlers ( handlers =>
2731 {
28- handlers . AddHandler ( typeof ( Controls . Shell ) , typeof ( ShellHandler ) ) ;
2932#if IOS || MACCATALYST
3033 handlers . AddHandler ( typeof ( Controls . NavigationPage ) , typeof ( Controls . Handlers . Compatibility . NavigationRenderer ) ) ;
3134#else
3235 handlers . AddHandler ( typeof ( Controls . NavigationPage ) , typeof ( NavigationViewHandler ) ) ;
3336#endif
34- handlers . AddHandler < Layout , LayoutHandler > ( ) ;
35- handlers . AddHandler < Image , ImageHandler > ( ) ;
36- handlers . AddHandler < Label , LabelHandler > ( ) ;
37- handlers . AddHandler < Page , PageHandler > ( ) ;
38- handlers . AddHandler < Toolbar , ToolbarHandler > ( ) ;
39- handlers . AddHandler < MenuBar , MenuBarHandler > ( ) ;
40- handlers . AddHandler < MenuBarItem , MenuBarItemHandler > ( ) ;
41- handlers . AddHandler < MenuFlyoutItem , MenuFlyoutItemHandler > ( ) ;
42- handlers . AddHandler < MenuFlyoutSubItem , MenuFlyoutSubItemHandler > ( ) ;
43- handlers . AddHandler < Button , ButtonHandler > ( ) ;
44- handlers . AddHandler < ScrollView , ScrollViewHandler > ( ) ;
4537 handlers . AddHandler < NestingView , NestingViewHandler > ( ) ;
46- #if WINDOWS
47- handlers . AddHandler < ShellItem , ShellItemHandler > ( ) ;
48- handlers . AddHandler < ShellSection , ShellSectionHandler > ( ) ;
49- handlers . AddHandler < ShellContent , ShellContentHandler > ( ) ;
50- #endif
38+ handlers . AddHandler < ContentView , ContentViewHandler > ( ) ;
39+ handlers . AddHandler < CollectionView , CollectionViewHandler > ( ) ;
5140 } ) ;
5241 } ) ;
5342 }
@@ -203,5 +192,19 @@ await CreateHandlerAndAddToWindow<NestingViewHandler>(view, (handler) =>
203192 Assert . Null ( foundTreeElement ) ;
204193 } ) ;
205194 }
195+
196+ [ Theory ]
197+ [ ClassData ( typeof ( FindVisualTreeElementInsideTestCases ) ) ]
198+ public async Task FindPlatformViewInsideView ( FindVisualTreeElementInsideTestCase testCase )
199+ {
200+ SetupBuilder ( ) ;
201+
202+ await CreateHandlerAndAddToWindow ( testCase . VisualElement , ( ) =>
203+ {
204+ var platformView = testCase . ViewToLocate . ToPlatform ( ) ;
205+ var foundTreeElement = platformView . GetVisualTreeElement ( ) ;
206+ Assert . Equal ( testCase . ViewToLocate , foundTreeElement ) ;
207+ } ) ;
208+ }
206209 }
207210}
0 commit comments