예제 #1
0
        public void SetUp()
        {
            Mock <BlockControl> control = new Mock <BlockControl>();

            control.Object.Padding = "1 2 3 4";

            controlLayout = new ControlLayout
            {
                Control = control.Object
            };

            controlLayout.Calculate();
        }
예제 #2
0
        public void HorizontalAlignment_is_null__call_ActualFullWidth__returns_AvailableWidth()
        {
            Mock <BlockControl> control = new Mock <BlockControl>();

            ControlLayout controlLayout = new ControlLayout
            {
                Control        = control.Object,
                AvailableWidth = 100
            };

            controlLayout.Calculate();

            int actual = controlLayout.ActualFullWidth;

            Assert.That(actual, Is.EqualTo(100));
        }
        public void HorizontalAlignment_is_null__returns_AvailableWidth_without_Margins_and_Paddings()
        {
            Mock <BlockControl> control = new Mock <BlockControl>();

            control.Object.Margin  = 10;
            control.Object.Padding = 7;

            ControlLayout controlLayout = new ControlLayout
            {
                Control        = control.Object,
                AvailableWidth = 100
            };

            controlLayout.Calculate();

            int actual = controlLayout.ActualClientWidth;

            Assert.That(actual, Is.EqualTo(66));
        }
        public void HorizontalAlignment_is_Stretch__call_ActualWidth__returns_AvailableWidth_without_Margins()
        {
            Mock <BlockControl> control = new Mock <BlockControl>();

            control.Object.HorizontalAlignment = HorizontalAlignment.Stretch;
            control.Object.Margin = 10;

            ControlLayout controlLayout = new ControlLayout
            {
                Control        = control.Object,
                AvailableWidth = 102
            };

            controlLayout.Calculate();

            int actual = controlLayout.ActualWidth;

            Assert.That(actual, Is.EqualTo(82));
        }
예제 #5
0
        public void HorizontalAlignment_is_null_DesiredContentWidth_is_less_than_available_space__returns_ContentDesiredWidth()
        {
            Mock <BlockControl> control = new Mock <BlockControl>();

            control.Object.Margin  = 10;
            control.Object.Padding = 7;

            ControlLayout controlLayout = new ControlLayout
            {
                Control             = control.Object,
                AvailableWidth      = 100,
                DesiredContentWidth = 20
            };

            controlLayout.Calculate();

            int actual = controlLayout.ActualContentWidth;

            Assert.That(actual, Is.EqualTo(20));
        }
예제 #6
0
        public void HorizontalAlignment_is_Stretch_DesiredContentWidth_is_not_specified__returns_AvailableWidth_without_Margins_and_Paddings()
        {
            Mock <BlockControl> control = new Mock <BlockControl>();

            control.Object.HorizontalAlignment = HorizontalAlignment.Stretch;
            control.Object.Margin  = 10;
            control.Object.Padding = 7;

            ControlLayout controlLayout = new ControlLayout
            {
                Control        = control.Object,
                AvailableWidth = 102
            };

            controlLayout.Calculate();

            int actual = controlLayout.ActualContentWidth;

            Assert.That(actual, Is.EqualTo(68));
        }