Exemplo n.º 1
0
        public void TestMeasureEmptyString()
        {
            var l = new Label(LayoutTestStyle.Create());

            l.Padding = new Insets();
            l.Font    = LayoutTestStyle.CreateFont();
            l.Measure(Size.Auto);
            l.DesiredSize.Should().Be(new Size(0, 12));
        }
Exemplo n.º 2
0
        public void TestMeasureStringPadded()
        {
            var l = new Label(LayoutTestStyle.Create());

            l.Padding = new Insets(1, 2, 3, 4);
            l.Font    = LayoutTestStyle.CreateFont();
            l.Text    = "Test";
            l.Measure(Size.Auto);
            l.DesiredSize.Should().Be(new Size(50, 19));
        }
Exemplo n.º 3
0
        public void TestArrangeZero()
        {
            var l = new Label(LayoutTestStyle.Create());

            l.Padding   = new Insets(1, 2, 3, 4);
            l.Font      = LayoutTestStyle.CreateFont();
            l.Text      = "Test";
            l.Alignment = Alignment.Center;

            l.Arrange(new Rectangle(10, 20, 0, 0));
            l.LayoutRect.Should().Be(new Rectangle(10, 20, 6, 4));
        }
Exemplo n.º 4
0
        public void TestResolvedStyle()
        {
            var uiFont = LayoutTestStyle.CreateFont();

            var l = new Label(LayoutTestStyle.Create());

            l.Padding = new Insets();
            l.Font    = uiFont;
            l.Text    = "Test";
            l.Measure(Size.Auto);
            l.Font.Should().BeSameAs(uiFont);
        }
Exemplo n.º 5
0
        public void TestLineBreakingZero()
        {
            var l = new Label(LayoutTestStyle.Create());

            l.Padding   = new Insets(1, 2, 3, 4);
            l.Font      = LayoutTestStyle.CreateFont();
            l.Text      = "Test Test tst tasd asd asd asda sadsda sdads asad ad";
            l.Alignment = Alignment.Center;

            l.Arrange(new Rectangle(10, 20, 0, 0));
            l.LayoutRect.Should().Be(new Rectangle(10, 20, 6, 4));
            l.Content.LayoutRect.Should().Be(new Rectangle(12, -54, 0, 150));
        }