Пример #1
0
        public void DisplayableChars_SetPreferredTextHeight_RightNumberOfChars(float width, float height, float TextSize, float charSize, int expectedNumber)
        {
            var textStub = new GraphicalTextStub { SingleCharWidth = charSize };
            var box = CreateTextBox(width, height, textStub);
            box.PreferredTextHeight = TextSize;

            int displayedChars = box.DisplayableChars();
            
            Assert.AreEqual(expectedNumber, displayedChars);
        }
Пример #2
0
        public void GetPrefredWidth_SetText_PrefredWidthEqualsTextLenght(float width, float height, String text, float expectedWidth)
        {
            var textStub = new GraphicalTextStub { SingleCharWidth = 1 };
            var box = CreateTextBox(width, height, textStub);

            box.Text = text;
            box.Draw();
            Assert.AreEqual(expectedWidth, box.PreferredWidth, 10e-5);
        }
Пример #3
0
 public void GetPreferredHeight_CreateWithTextSize_PreferredHeightEqualsTextSize(float width, float height, float textSize)
 {
     var textStub = new GraphicalTextStub { CharHeight = textSize };
     var box = CreateTextBox(width, height, textStub);
     box.Draw();
     Assert.AreEqual(textSize, box.PreferredHeight);
 }
Пример #4
0
        private TextBox CreateTextBox(float width, float height, GraphicalTextStub stub)
        {
            var box = new TextBox(stub);
            box.Width = width;
            box.Height = height;

            return box;
        }