Example #1
0
        public void View_measures_whitespace()
        {
            var view = new ContentView("   One Two  ");

            Size measuredSize = view.Measure(_renderer, new Size(6, 2));

            measuredSize.Should().BeEquivalentTo(new Size(6, 2));
        }
        public void Measure_creates_formatted_span()
        {
            var view = new ContentView <int>(421);

            Size measuredSize = view.Measure(_renderer, new Size(10, 1));

            measuredSize.Width.Should().Be(3);
            measuredSize.Height.Should().Be(1);
        }
Example #3
0
        public void Empty_size_to_content_grid_do_not_take_up_space()
        {
            var grid = new GridView();

            grid.SetColumns(ColumnDefinition.SizeToContent(), ColumnDefinition.SizeToContent());
            grid.SetRows(RowDefinition.SizeToContent(), RowDefinition.SizeToContent());

            var  console      = new TestConsole();
            var  renderer     = new ConsoleRenderer(console);
            Size measuredSize = grid.Measure(renderer, new Size(10, 10));

            measuredSize.Width.Should().Be(0);
            measuredSize.Height.Should().Be(0);
        }
Example #4
0
        public void Empty_fixed_sized_grid_returns_fixed_region()
        {
            var grid = new GridView();

            grid.SetColumns(ColumnDefinition.Fixed(7), ColumnDefinition.Star(3));
            grid.SetRows(RowDefinition.Fixed(3), RowDefinition.Star(7));

            var  console      = new TestConsole();
            var  renderer     = new ConsoleRenderer(console);
            Size measuredSize = grid.Measure(renderer, new Size(10, 10));

            measuredSize.Width.Should().Be(10);
            measuredSize.Height.Should().Be(10);
        }