Exemplo n.º 1
0
        public void CreateAndRemoveOverlayWindow()
        {
            var app    = new TestApp();
            var window = app.CreateWindow() as IWindow;

            app.LoadPage(new ContentPage());
            var windowOverlay = new WindowOverlay(window) as IWindowOverlay;

            // If not processed by a window, should be false.
            Assert.False(windowOverlay.IsNativeViewInitialized);

            // First time inserted, should be true.
            Assert.True(window.AddOverlay(windowOverlay));

            // Should now be initialized.
            Assert.True(windowOverlay.IsNativeViewInitialized);

            Assert.True(window.Overlays.Count > 0);

            // Can't insert same window overlay again, should be false.
            Assert.False(window.AddOverlay(windowOverlay));

            // Should remove from collection, should be true.
            Assert.True(window.RemoveOverlay(windowOverlay));

            // Not in collection, should be false.
            Assert.False(window.RemoveOverlay(windowOverlay));

            // Window was uninitialized, should be false.
            Assert.False(windowOverlay.IsNativeViewInitialized);

            // Second time inserted, should be true.
            Assert.True(window.AddOverlay(windowOverlay));

            // Should now be initialized again.
            Assert.True(windowOverlay.IsNativeViewInitialized);
        }