Beispiel #1
0
        public void TestShouldAnchor()
        {
            var panel = new PanelTests();

            // default state
            Assert.True(panel.ShouldAnchor(Orientation.Horizontal));
            Assert.True(panel.ShouldAnchor(Orientation.Vertical));
            Assert.True(panel.ShouldAnchor(Orientation.InDepth));

            // horizontally
            panel.ActivateAnchoring(Orientation.Horizontal, false);

            Assert.False(panel.ShouldAnchor(Orientation.Horizontal));
            Assert.True(panel.ShouldAnchor(Orientation.Vertical));
            Assert.True(panel.ShouldAnchor(Orientation.InDepth));

            panel.ActivateAnchoring(Orientation.Horizontal, true);

            Assert.True(panel.ShouldAnchor(Orientation.Horizontal));
            Assert.True(panel.ShouldAnchor(Orientation.Vertical));
            Assert.True(panel.ShouldAnchor(Orientation.InDepth));

            // vertically
            panel.ActivateAnchoring(Orientation.Vertical, false);

            Assert.True(panel.ShouldAnchor(Orientation.Horizontal));
            Assert.False(panel.ShouldAnchor(Orientation.Vertical));
            Assert.True(panel.ShouldAnchor(Orientation.InDepth));

            panel.ActivateAnchoring(Orientation.Vertical, true);

            Assert.True(panel.ShouldAnchor(Orientation.Horizontal));
            Assert.True(panel.ShouldAnchor(Orientation.Vertical));
            Assert.True(panel.ShouldAnchor(Orientation.InDepth));

            // in depth
            panel.ActivateAnchoring(Orientation.InDepth, false);

            Assert.True(panel.ShouldAnchor(Orientation.Horizontal));
            Assert.True(panel.ShouldAnchor(Orientation.Vertical));
            Assert.False(panel.ShouldAnchor(Orientation.InDepth));

            panel.ActivateAnchoring(Orientation.InDepth, true);

            Assert.True(panel.ShouldAnchor(Orientation.Horizontal));
            Assert.True(panel.ShouldAnchor(Orientation.Vertical));
            Assert.True(panel.ShouldAnchor(Orientation.InDepth));

            // combination
            panel.ActivateAnchoring(Orientation.Horizontal, false);
            panel.ActivateAnchoring(Orientation.Vertical, false);
            panel.ActivateAnchoring(Orientation.InDepth, false);

            Assert.False(panel.ShouldAnchor(Orientation.Horizontal));
            Assert.False(panel.ShouldAnchor(Orientation.Vertical));
            Assert.False(panel.ShouldAnchor(Orientation.InDepth));

            panel.ActivateAnchoring(Orientation.Horizontal, true);
            panel.ActivateAnchoring(Orientation.Vertical, true);
            panel.ActivateAnchoring(Orientation.InDepth, true);

            Assert.True(panel.ShouldAnchor(Orientation.Horizontal));
            Assert.True(panel.ShouldAnchor(Orientation.Vertical));
            Assert.True(panel.ShouldAnchor(Orientation.InDepth));
        }