Option Strict On
Option Explicit On

Imports Nexamas.UI.Controls
Imports SkiaSharp

Namespace Nexamas.UI.Components

    Partial Public NotInheritable Class MASSplitView

#Region "Friend host adoption proof"

        Friend Function CreateHostAdoptionProofSnapshot() As MASRouteShellHostAdoptionSnapshot
            Return MASRouteShellHostAdoptionPolicy.CreateSplitViewAdoption(
                CreateShellIntegrationBoundarySnapshot(),
                CreateLayoutSnapshot(),
                CreateHostedPaneContentSnapshot(),
                CreateKeyboardSplitterSnapshot())
        End Function

        Friend Function HasHostAdoptionProofForTests() As Boolean
            ResetPaneLayout()
            Dim left As MASControlBase = MASButton.Create("Split host left")
            Dim content As MASControlBase = MASButton.Create("Split host content")
            If Not HostPaneContent("left", left) Then Return False
            If Not HostPaneContent("content", content) Then Return False
            PlaceSplitViewHostedContent("left", New SKRect(0.0F, 0.0F, 180.0F, 280.0F), 1.0F, True)
            PlaceSplitViewHostedContent("content", New SKRect(188.0F, 0.0F, 520.0F, 280.0F), 1.0F, True)
            If Not ApplyKeyboardSplitterCommand(MASSplitViewKeyboardSplitterCommand.FocusLeftDivider) Then Return False
            If Not ApplyKeyboardSplitterCommand(MASSplitViewKeyboardSplitterCommand.MovePositiveSmall) Then Return False
            Dim snapshot As MASRouteShellHostAdoptionSnapshot = CreateHostAdoptionProofSnapshot()
            Dim passed As Boolean = MASRouteShellHostAdoptionPolicy.IsSafeHostAdoption(snapshot,
                                                                                       "splitview",
                                                                                       "SplitView.HostAdoptionProof",
                                                                                       MASRouteShellBoundaryKind.SplitViewShellIntegrationBoundary) AndAlso
                                    snapshot.HasInteractionSnapshot AndAlso
                                    snapshot.CapturesFocusIntent AndAlso
                                    snapshot.CapturesAnnouncementIntent AndAlso
                                    snapshot.KeepsNativeShellExternal
            Dim removed As Boolean = UnhostPaneContent("left", disposeChild:=True)
            removed = UnhostPaneContent("content", disposeChild:=True) AndAlso removed
            Return passed AndAlso removed
        End Function

#End Region

    End Class

End Namespace
