Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
DeltaEngine.Rendering2D.Fonts.Tests TextWrapperTests
Namespace: DeltaEngine.Rendering2D.Fonts.Tests
Assembly: DeltaEngine.Rendering2D.Fonts.Tests (in DeltaEngine.Rendering2D.Fonts.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The TextWrapperTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
![]() | TextWrapperTests | Initializes a new instance of the TextWrapperTests class |
Methods
Name | Description | |
---|---|---|
![]() | AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) |
![]() | ClipTextHeight | |
![]() | ClipTextWidth | |
![]() | EmptyText | |
![]() | FontDoesNotFitInTooSmallArea | |
![]() | GetLines | |
![]() | GetLinesWithNoSpaceLetters | |
![]() | Init | |
![]() | InitializeResolver | (Inherited from TestWithMocksOrVisually.) |
![]() | RegisterMock T | (Inherited from TestWithMocksOrVisually.) |
![]() | Resolve T | (Inherited from TestWithMocksOrVisually.) |
![]() | RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) |
![]() | RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) |
Properties
Name | Description | |
---|---|---|
![]() | IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test] public void EmptyText() { var lines = textWrapper.SplitTextIntoLines("", new Size(100, fontDescription.PixelLineHeight), true); Assert.AreEqual(0, lines.Count); }
[Test] public void FontDoesNotFitInTooSmallArea() { var lines = textWrapper.SplitTextIntoLines(ThreeLineText, new Size(70, fontDescription.PixelLineHeight / 2.0f), true); Assert.AreEqual(0, lines.Count); }
[Test] public void GetLines() { var lines = textWrapper.SplitTextIntoLines(ThreeLineText, new Size(70, fontDescription.PixelLineHeight * 3), true); Assert.AreEqual(3, lines.Count); Assert.AreEqual(Spaces, new string(lines[0].ToArray())); Assert.AreEqual(Spaces, new string(lines[1].ToArray())); Assert.AreEqual(Spaces, new string(lines[2].ToArray())); }
[Test] public void GetLinesWithNoSpaceLetters() { var lines = textWrapper.SplitTextIntoLines("aaaa aaaaa aaa!", new Size(70, fontDescription.PixelLineHeight * 3), true); Assert.AreEqual(2, lines.Count); }
[Test] public void ClipTextHeight() { var lines = textWrapper.SplitTextIntoLines(ThreeLineText, new Size(60, fontDescription.PixelLineHeight * 2), true); Assert.AreEqual(2, lines.Count); Assert.AreEqual(Spaces, new string(lines[0].ToArray())); Assert.AreEqual(Spaces, new string(lines[1].ToArray())); }
[Test] public void ClipTextWidth() { var lines = textWrapper.SplitTextIntoLines(ThreeLineText, new Size(10, fontDescription.PixelLineHeight * 6), true); Assert.AreEqual(6, lines.Count); Assert.AreEqual(" ", new string(lines[0].ToArray())); Assert.AreEqual(" ", new string(lines[1].ToArray())); Assert.AreEqual(" ", new string(lines[2].ToArray())); Assert.AreEqual(" ", new string(lines[3].ToArray())); Assert.AreEqual(" ", new string(lines[4].ToArray())); Assert.AreEqual(" ", new string(lines[5].ToArray())); }
See Also