コード例 #1
0
        public async Task SplitContainerCollectionOperations(DocumentViewContainerMode mode)
        {
            var controller = new ContentVisibleEventWithContainerTestController();

            controller.Mode = mode;

            await controller.Initialize(new ModelDescriptor());

            var doc = await documentManager.OpenDocument(controller);

            var view = await controller.GetDocumentView();

            Assert.IsTrue(controller.View1.ContentVisible);
            Assert.IsTrue(controller.View2.ContentVisible);
            Assert.IsTrue(controller.View3.ContentVisible);

            var newView = new DocumentViewContent(() => new DummyControl());

            Assert.IsFalse(newView.ContentVisible);

            controller.Container.Views [1] = newView;
            Assert.IsTrue(newView.ContentVisible);
            Assert.IsFalse(controller.View2.ContentVisible);

            controller.Container.Views.RemoveAt(1);
            Assert.IsFalse(newView.ContentVisible);
            Assert.IsTrue(controller.View1.ContentVisible);
            Assert.IsTrue(controller.View3.ContentVisible);

            controller.Container.Views.Clear();
            Assert.IsFalse(controller.View1.ContentVisible);
            Assert.IsFalse(controller.View3.ContentVisible);
        }
コード例 #2
0
        public async Task SwitchModeInternally()
        {
            // Same as SwitchMode, but the switch is done in the UI, not through the API

            var controller = new ContentVisibleEventWithContainerTestController();

            controller.Mode = DocumentViewContainerMode.Tabs;

            await controller.Initialize(new ModelDescriptor());

            var doc = await documentManager.OpenDocument(controller);

            var window     = doc.GetWindow();
            var containter = (MockShellDocumentViewContainer)window.RootView;

            Assert.IsFalse(controller.View1.ContentVisible);
            Assert.IsTrue(controller.View2.ContentVisible);
            Assert.IsFalse(controller.View3.ContentVisible);

            Assert.AreEqual(0, controller.View1_VisibleChangeEvents);
            Assert.AreEqual(1, controller.View2_VisibleChangeEvents);
            Assert.AreEqual(0, controller.View3_VisibleChangeEvents);

            containter.CurrentMode = DocumentViewContainerMode.HorizontalSplit;

            Assert.IsTrue(controller.View1.ContentVisible);
            Assert.IsTrue(controller.View2.ContentVisible);
            Assert.IsTrue(controller.View3.ContentVisible);

            Assert.AreEqual(1, controller.View1_VisibleChangeEvents);
            Assert.AreEqual(1, controller.View2_VisibleChangeEvents);
            Assert.AreEqual(1, controller.View3_VisibleChangeEvents);

            containter.CurrentMode = DocumentViewContainerMode.VerticalSplit;

            Assert.IsTrue(controller.View1.ContentVisible);
            Assert.IsTrue(controller.View2.ContentVisible);
            Assert.IsTrue(controller.View3.ContentVisible);

            Assert.AreEqual(1, controller.View1_VisibleChangeEvents);
            Assert.AreEqual(1, controller.View2_VisibleChangeEvents);
            Assert.AreEqual(1, controller.View3_VisibleChangeEvents);

            containter.CurrentMode = DocumentViewContainerMode.Tabs;

            Assert.IsFalse(controller.View1.ContentVisible);
            Assert.IsTrue(controller.View2.ContentVisible);
            Assert.IsFalse(controller.View3.ContentVisible);

            Assert.AreEqual(2, controller.View1_VisibleChangeEvents);
            Assert.AreEqual(1, controller.View2_VisibleChangeEvents);
            Assert.AreEqual(2, controller.View3_VisibleChangeEvents);

            await doc.Close(true);
        }
コード例 #3
0
        public async Task SwitchMode()
        {
            var controller = new ContentVisibleEventWithContainerTestController();

            controller.Mode = DocumentViewContainerMode.Tabs;

            await controller.Initialize(new ModelDescriptor());

            var doc = await documentManager.OpenDocument(controller);

            var view = await controller.GetDocumentView();

            Assert.IsFalse(controller.View1.ContentVisible);
            Assert.IsTrue(controller.View2.ContentVisible);
            Assert.IsFalse(controller.View3.ContentVisible);

            Assert.AreEqual(0, controller.View1_VisibleChangeEvents);
            Assert.AreEqual(1, controller.View2_VisibleChangeEvents);
            Assert.AreEqual(0, controller.View3_VisibleChangeEvents);

            controller.Container.CurrentMode = DocumentViewContainerMode.HorizontalSplit;

            Assert.IsTrue(controller.View1.ContentVisible);
            Assert.IsTrue(controller.View2.ContentVisible);
            Assert.IsTrue(controller.View3.ContentVisible);

            Assert.AreEqual(1, controller.View1_VisibleChangeEvents);
            Assert.AreEqual(1, controller.View2_VisibleChangeEvents);
            Assert.AreEqual(1, controller.View3_VisibleChangeEvents);

            controller.Container.CurrentMode = DocumentViewContainerMode.VerticalSplit;

            Assert.IsTrue(controller.View1.ContentVisible);
            Assert.IsTrue(controller.View2.ContentVisible);
            Assert.IsTrue(controller.View3.ContentVisible);

            Assert.AreEqual(1, controller.View1_VisibleChangeEvents);
            Assert.AreEqual(1, controller.View2_VisibleChangeEvents);
            Assert.AreEqual(1, controller.View3_VisibleChangeEvents);

            controller.Container.CurrentMode = DocumentViewContainerMode.Tabs;

            Assert.IsFalse(controller.View1.ContentVisible);
            Assert.IsTrue(controller.View2.ContentVisible);
            Assert.IsFalse(controller.View3.ContentVisible);

            Assert.AreEqual(2, controller.View1_VisibleChangeEvents);
            Assert.AreEqual(1, controller.View2_VisibleChangeEvents);
            Assert.AreEqual(2, controller.View3_VisibleChangeEvents);

            await doc.Close(true);
        }
コード例 #4
0
        public async Task WithTabs()
        {
            var controller = new ContentVisibleEventWithContainerTestController();

            controller.Mode = DocumentViewContainerMode.Tabs;

            await controller.Initialize(new ModelDescriptor());

            var doc = await documentManager.OpenDocument(controller);

            var view = await controller.GetDocumentView();

            Assert.IsFalse(controller.View1.ContentVisible);
            Assert.IsTrue(controller.View2.ContentVisible);
            Assert.IsFalse(controller.View3.ContentVisible);

            Assert.AreEqual(0, controller.View1_VisibleChangeEvents);
            Assert.AreEqual(1, controller.View2_VisibleChangeEvents);
            Assert.AreEqual(0, controller.View3_VisibleChangeEvents);

            controller.View3.SetActive();

            Assert.IsFalse(controller.View1.ContentVisible);
            Assert.IsFalse(controller.View2.ContentVisible);
            Assert.IsTrue(controller.View3.ContentVisible);

            Assert.AreEqual(0, controller.View1_VisibleChangeEvents);
            Assert.AreEqual(2, controller.View2_VisibleChangeEvents);
            Assert.AreEqual(1, controller.View3_VisibleChangeEvents);

            controller.View1.SetActive();

            Assert.IsTrue(controller.View1.ContentVisible);
            Assert.IsFalse(controller.View2.ContentVisible);
            Assert.IsFalse(controller.View3.ContentVisible);

            Assert.AreEqual(1, controller.View1_VisibleChangeEvents);
            Assert.AreEqual(2, controller.View2_VisibleChangeEvents);
            Assert.AreEqual(2, controller.View3_VisibleChangeEvents);

            var extraView = new DocumentViewContent(() => new DummyControl());

            controller.Container.Views.Add(extraView);
            Assert.IsFalse(extraView.ContentVisible);

            var doc2 = await documentManager.OpenDocument(new ContentVisibleEventWithContainerTestController());

            doc2.Select();

            Assert.IsFalse(controller.View1.ContentVisible);
            Assert.IsFalse(controller.View2.ContentVisible);
            Assert.IsFalse(controller.View3.ContentVisible);

            Assert.AreEqual(2, controller.View1_VisibleChangeEvents);
            Assert.AreEqual(2, controller.View2_VisibleChangeEvents);
            Assert.AreEqual(2, controller.View3_VisibleChangeEvents);

            await doc.Close(true);

            await doc2.Close(true);
        }