Exemple #1
0
        public void NumberListTest()
        {
            var canvas   = new Canvas(20, 10, '#');
            var graphics = new Graphics(canvas);

            var widget = new OrderList("demo");

            widget.Items = new string[] {
                "One",
                "Two",
                "Six"
            };

            widget.Draw(graphics);

            Assert.Equal("1. One##############", canvas.Map[0]);
            Assert.Equal("2. Two##############", canvas.Map[1]);
            Assert.Equal("3. Six##############", canvas.Map[2]);
            Assert.Equal(3, canvas.Rows);

            canvas   = new Canvas(20, 10, '#');
            graphics = new Graphics(canvas);

            widget.TextAlign = Align.Center;
            widget.Draw(graphics);

            Assert.Equal("#######1. One#######", canvas.Map[0]);
            Assert.Equal("#######2. Two#######", canvas.Map[1]);
            Assert.Equal("#######3. Six#######", canvas.Map[2]);
            Assert.Equal(3, canvas.Rows);

            canvas   = new Canvas(20, 10, '#');
            graphics = new Graphics(canvas);

            widget.TextAlign = Align.Right;
            widget.Draw(graphics);

            Assert.Equal("##############1. One", canvas.Map[0]);
            Assert.Equal("##############2. Two", canvas.Map[1]);
            Assert.Equal("##############3. Six", canvas.Map[2]);
            Assert.Equal(3, canvas.Rows);
        }
Exemple #2
0
    private void Update()
    {
        //Componenet must be placed at Zero point.
        this.transform.position = Vector3.zero;

        //Position list to relative dock point.
        PositionListToDockPoint();

        //Find new children.
        GetChildren();

        //Clear missing children.
        ClearMissingChildren();

        //Update list's order style.
        FloatList.OrderStyle = this.OrderStyle;

        //Draw-Position the list holding our textures.
        FloatList.Draw(StartingPoint);
    }