From c7bc7f86b8ef186ff57aece5746e107b936ab129 Mon Sep 17 00:00:00 2001 From: BDisp Date: Sun, 5 May 2024 00:03:21 +0100 Subject: [PATCH] Adding all possible text directions variants and improving scenario. --- Terminal.Gui/Text/TextFormatter.cs | 49 +- .../Scenarios/TextAlignmentsAndDirection.cs | 68 +- UnitTests/Text/TextFormatterTests.cs | 1628 ++++++++++++++++- 3 files changed, 1721 insertions(+), 24 deletions(-) diff --git a/Terminal.Gui/Text/TextFormatter.cs b/Terminal.Gui/Text/TextFormatter.cs index ba2182f77..5d60ba89a 100644 --- a/Terminal.Gui/Text/TextFormatter.cs +++ b/Terminal.Gui/Text/TextFormatter.cs @@ -321,7 +321,7 @@ public class TextFormatter int x, y; // Horizontal Alignment - if (Alignment == TextAlignment.Right || (Alignment == TextAlignment.Justified && !IsLeftToRight (Direction))) + if (Alignment is TextAlignment.Right) { if (isVertical) { @@ -336,7 +336,7 @@ public class TextFormatter CursorPosition = screen.Width - runesWidth + (_hotKeyPos > -1 ? _hotKeyPos : 0); } } - else if (Alignment is TextAlignment.Left or TextAlignment.Justified) + else if (Alignment is TextAlignment.Left) { if (isVertical) { @@ -352,7 +352,30 @@ public class TextFormatter CursorPosition = _hotKeyPos > -1 ? _hotKeyPos : 0; } - else if (Alignment == TextAlignment.Centered) + else if (Alignment is TextAlignment.Justified) + { + if (isVertical) + { + int runesWidth = GetColumnsRequiredForVerticalText (linesFormatted, 0, linesFormatted.Count, TabWidth); + int prevLineWidth = line > 0 ? GetColumnsRequiredForVerticalText (linesFormatted, line - 1, 1, TabWidth) : 0; + int firstLineWidth = GetColumnsRequiredForVerticalText (linesFormatted, 0, 1, TabWidth); + int lastLineWidth = GetColumnsRequiredForVerticalText (linesFormatted, linesFormatted.Count - 1, 1, TabWidth); + var interval = (int)Math.Round ((double)(screen.Width + firstLineWidth + lastLineWidth) / linesFormatted.Count); + + x = line == 0 + ? screen.Left + : line < linesFormatted.Count - 1 + ? screen.Width - runesWidth <= lastLineWidth ? screen.Left + prevLineWidth : screen.Left + line * interval + : screen.Right - lastLineWidth; + } + else + { + x = screen.Left; + } + + CursorPosition = _hotKeyPos > -1 ? _hotKeyPos : 0; + } + else if (Alignment is TextAlignment.Centered) { if (isVertical) { @@ -376,7 +399,7 @@ public class TextFormatter } // Vertical Alignment - if (VerticalAlignment == VerticalTextAlignment.Bottom || (VerticalAlignment == VerticalTextAlignment.Justified && !IsTopToBottom (Direction))) + if (VerticalAlignment is VerticalTextAlignment.Bottom) { if (isVertical) { @@ -387,7 +410,7 @@ public class TextFormatter y = screen.Bottom - linesFormatted.Count + line; } } - else if (VerticalAlignment is VerticalTextAlignment.Top or VerticalTextAlignment.Justified) + else if (VerticalAlignment is VerticalTextAlignment.Top) { if (isVertical) { @@ -398,7 +421,21 @@ public class TextFormatter y = screen.Top + line; } } - else if (VerticalAlignment == VerticalTextAlignment.Middle) + else if (VerticalAlignment is VerticalTextAlignment.Justified) + { + if (isVertical) + { + y = screen.Top; + } + else + { + var interval = (int)Math.Round ((double)(screen.Height + 2) / linesFormatted.Count); + + y = line == 0 ? screen.Top : + line < linesFormatted.Count - 1 ? screen.Height - interval <= 1 ? screen.Top + 1 : screen.Top + line * interval : screen.Bottom - 1; + } + } + else if (VerticalAlignment is VerticalTextAlignment.Middle) { if (isVertical) { diff --git a/UICatalog/Scenarios/TextAlignmentsAndDirection.cs b/UICatalog/Scenarios/TextAlignmentsAndDirection.cs index e70d4300f..1f70f7d7a 100644 --- a/UICatalog/Scenarios/TextAlignmentsAndDirection.cs +++ b/UICatalog/Scenarios/TextAlignmentsAndDirection.cs @@ -462,16 +462,34 @@ public class TextAlignmentsAndDirections : Scenario Text = "Justify" }; + app.Add (justifyCheckbox); + + // JUSTIFY OPTIONS + + var justifyOptions = new RadioGroup + { + X = Pos.Left (justifyCheckbox) + 1, + Y = Pos.Y (justifyCheckbox) + 1, + Width = Dim.Fill (11), + RadioLabels = ["Current direction", "Opposite direction", "Justify Both"], + Enabled = false + }; + justifyCheckbox.Toggled += (s, e) => ToggleJustify (e.OldValue is { } && (bool)e.OldValue); - app.Add (justifyCheckbox); + justifyOptions.SelectedItemChanged += (s, e) => + { + ToggleJustify (false, true); + }; + + app.Add (justifyOptions); // WRAP CHECKBOX var wrapCheckbox = new CheckBox { X = Pos.Right (container) + 1, - Y = Pos.Y (justifyCheckbox) + 1, + Y = Pos.Bottom (justifyOptions), Width = Dim.Fill (10), Height = 1, Text = "Word Wrap", @@ -564,10 +582,15 @@ public class TextAlignmentsAndDirections : Scenario Application.Run (app); app.Dispose (); - void ToggleJustify (bool oldValue) + void ToggleJustify (bool oldValue, bool wasJustOptions = false) { if (oldValue == true) { + if (!wasJustOptions) + { + justifyOptions.Enabled = false; + } + foreach (Label t in mtxts) { t.TextAlignment = (TextAlignment)((dynamic)t.Data).h; @@ -578,15 +601,46 @@ public class TextAlignmentsAndDirections : Scenario { foreach (Label t in mtxts) { + if (!wasJustOptions) + { + justifyOptions.Enabled = true; + } + if (TextFormatter.IsVerticalDirection (t.TextDirection)) { - t.VerticalTextAlignment = VerticalTextAlignment.Justified; - t.TextAlignment = ((dynamic)t.Data).h; + switch (justifyOptions.SelectedItem) + { + case 0: + t.VerticalTextAlignment = VerticalTextAlignment.Justified; + t.TextAlignment = ((dynamic)t.Data).h; + break; + case 1: + t.VerticalTextAlignment = (VerticalTextAlignment)((dynamic)t.Data).v; + t.TextAlignment = TextAlignment.Justified; + break; + case 2: + t.VerticalTextAlignment = VerticalTextAlignment.Justified; + t.TextAlignment = TextAlignment.Justified; + break; + } } else { - t.TextAlignment = TextAlignment.Justified; - t.VerticalTextAlignment = ((dynamic)t.Data).v; + switch (justifyOptions.SelectedItem) + { + case 0: + t.TextAlignment = TextAlignment.Justified; + t.VerticalTextAlignment = ((dynamic)t.Data).v; + break; + case 1: + t.TextAlignment = (TextAlignment)((dynamic)t.Data).h; + t.VerticalTextAlignment = VerticalTextAlignment.Justified; + break; + case 2: + t.TextAlignment = TextAlignment.Justified; + t.VerticalTextAlignment = VerticalTextAlignment.Justified; + break; + } } } } diff --git a/UnitTests/Text/TextFormatterTests.cs b/UnitTests/Text/TextFormatterTests.cs index 9188562d0..fda92ad8e 100644 --- a/UnitTests/Text/TextFormatterTests.cs +++ b/UnitTests/Text/TextFormatterTests.cs @@ -4083,6 +4083,7 @@ B")] [SetupFakeDriver] [Theory] + // Horizontal with VerticalTextAlignment.Top // LeftRight_TopBottom [InlineData ("0 2 4", TextAlignment.Left, VerticalTextAlignment.Top, TextDirection.LeftRight_TopBottom, @" 0 2 4** @@ -4351,6 +4352,814 @@ B")] ******* *******")] + // Horizontal with VerticalTextAlignment.Bottom + // LeftRight_TopBottom + [InlineData ("0 2 4", TextAlignment.Left, VerticalTextAlignment.Bottom, TextDirection.LeftRight_TopBottom, @" +******* +******* +******* +******* +******* +******* +0 2 4**")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Bottom, TextDirection.LeftRight_TopBottom, @" +******* +******* +******* +******* +******* +******* +**0 2 4")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Bottom, TextDirection.LeftRight_TopBottom, @" +******* +******* +******* +******* +******* +******* +*0 2 4*")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Bottom, TextDirection.LeftRight_TopBottom, @" +******* +******* +******* +******* +******* +******* +0 2 4")] + + [InlineData ("0 你 4", TextAlignment.Left, VerticalTextAlignment.Bottom, TextDirection.LeftRight_TopBottom, @" +******* +******* +******* +******* +******* +******* +0 你 4*")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Bottom, TextDirection.LeftRight_TopBottom, @" +******* +******* +******* +******* +******* +******* +*0 你 4")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Bottom, TextDirection.LeftRight_TopBottom, @" +******* +******* +******* +******* +******* +******* +0 你 4*")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Bottom, TextDirection.LeftRight_TopBottom, @" +******* +******* +******* +******* +******* +******* +0 你 4")] + + // LeftRight_BottomTop + [InlineData ("0 2 4", TextAlignment.Left, VerticalTextAlignment.Bottom, TextDirection.LeftRight_BottomTop, @" +******* +******* +******* +******* +******* +******* +0 2 4**")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Bottom, TextDirection.LeftRight_BottomTop, @" +******* +******* +******* +******* +******* +******* +**0 2 4")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Bottom, TextDirection.LeftRight_BottomTop, @" +******* +******* +******* +******* +******* +******* +*0 2 4*")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Bottom, TextDirection.LeftRight_BottomTop, @" +******* +******* +******* +******* +******* +******* +0 2 4")] + + [InlineData ("0 你 4", TextAlignment.Left, VerticalTextAlignment.Bottom, TextDirection.LeftRight_BottomTop, @" +******* +******* +******* +******* +******* +******* +0 你 4*")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Bottom, TextDirection.LeftRight_BottomTop, @" +******* +******* +******* +******* +******* +******* +*0 你 4")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Bottom, TextDirection.LeftRight_BottomTop, @" +******* +******* +******* +******* +******* +******* +0 你 4*")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Bottom, TextDirection.LeftRight_BottomTop, @" +******* +******* +******* +******* +******* +******* +0 你 4")] + + // RightLeft_TopBottom + [InlineData ("0 2 4", TextAlignment.Left, VerticalTextAlignment.Bottom, TextDirection.RightLeft_TopBottom, @" +******* +******* +******* +******* +******* +******* +4 2 0**")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Bottom, TextDirection.RightLeft_TopBottom, @" +******* +******* +******* +******* +******* +******* +**4 2 0")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Bottom, TextDirection.RightLeft_TopBottom, @" +******* +******* +******* +******* +******* +******* +*4 2 0*")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Bottom, TextDirection.RightLeft_TopBottom, @" +******* +******* +******* +******* +******* +******* +4 2 0")] + + [InlineData ("0 你 4", TextAlignment.Left, VerticalTextAlignment.Bottom, TextDirection.RightLeft_TopBottom, @" +******* +******* +******* +******* +******* +******* +4 你 0*")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Bottom, TextDirection.RightLeft_TopBottom, @" +******* +******* +******* +******* +******* +******* +*4 你 0")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Bottom, TextDirection.RightLeft_TopBottom, @" +******* +******* +******* +******* +******* +******* +4 你 0*")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Bottom, TextDirection.RightLeft_TopBottom, @" +******* +******* +******* +******* +******* +******* +4 你 0")] + + // RightLeft_BottomTop + [InlineData ("0 2 4", TextAlignment.Left, VerticalTextAlignment.Bottom, TextDirection.RightLeft_BottomTop, @" +******* +******* +******* +******* +******* +******* +4 2 0**")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Bottom, TextDirection.RightLeft_BottomTop, @" +******* +******* +******* +******* +******* +******* +**4 2 0")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Bottom, TextDirection.RightLeft_BottomTop, @" +******* +******* +******* +******* +******* +******* +*4 2 0*")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Bottom, TextDirection.RightLeft_BottomTop, @" +******* +******* +******* +******* +******* +******* +4 2 0")] + + [InlineData ("0 你 4", TextAlignment.Left, VerticalTextAlignment.Bottom, TextDirection.RightLeft_BottomTop, @" +******* +******* +******* +******* +******* +******* +4 你 0*")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Bottom, TextDirection.RightLeft_BottomTop, @" +******* +******* +******* +******* +******* +******* +*4 你 0")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Bottom, TextDirection.RightLeft_BottomTop, @" +******* +******* +******* +******* +******* +******* +4 你 0*")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Bottom, TextDirection.RightLeft_BottomTop, @" +******* +******* +******* +******* +******* +******* +4 你 0")] + + // Horizontal with VerticalTextAlignment.Middle + // LeftRight_TopBottom + [InlineData ("0 2 4", TextAlignment.Left, VerticalTextAlignment.Middle, TextDirection.LeftRight_TopBottom, @" +******* +******* +******* +0 2 4** +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Middle, TextDirection.LeftRight_TopBottom, @" +******* +******* +******* +**0 2 4 +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Middle, TextDirection.LeftRight_TopBottom, @" +******* +******* +******* +*0 2 4* +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Middle, TextDirection.LeftRight_TopBottom, @" +******* +******* +******* +0 2 4 +******* +******* +*******")] + + [InlineData ("0 你 4", TextAlignment.Left, VerticalTextAlignment.Middle, TextDirection.LeftRight_TopBottom, @" +******* +******* +******* +0 你 4* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Middle, TextDirection.LeftRight_TopBottom, @" +******* +******* +******* +*0 你 4 +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Middle, TextDirection.LeftRight_TopBottom, @" +******* +******* +******* +0 你 4* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Middle, TextDirection.LeftRight_TopBottom, @" +******* +******* +******* +0 你 4 +******* +******* +*******")] + + // LeftRight_BottomTop + [InlineData ("0 2 4", TextAlignment.Left, VerticalTextAlignment.Middle, TextDirection.LeftRight_BottomTop, @" +******* +******* +******* +0 2 4** +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Middle, TextDirection.LeftRight_BottomTop, @" +******* +******* +******* +**0 2 4 +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Middle, TextDirection.LeftRight_BottomTop, @" +******* +******* +******* +*0 2 4* +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Middle, TextDirection.LeftRight_BottomTop, @" +******* +******* +******* +0 2 4 +******* +******* +*******")] + + [InlineData ("0 你 4", TextAlignment.Left, VerticalTextAlignment.Middle, TextDirection.LeftRight_BottomTop, @" +******* +******* +******* +0 你 4* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Middle, TextDirection.LeftRight_BottomTop, @" +******* +******* +******* +*0 你 4 +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Middle, TextDirection.LeftRight_BottomTop, @" +******* +******* +******* +0 你 4* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Middle, TextDirection.LeftRight_BottomTop, @" +******* +******* +******* +0 你 4 +******* +******* +*******")] + + // RightLeft_TopBottom + [InlineData ("0 2 4", TextAlignment.Left, VerticalTextAlignment.Middle, TextDirection.RightLeft_TopBottom, @" +******* +******* +******* +4 2 0** +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Middle, TextDirection.RightLeft_TopBottom, @" +******* +******* +******* +**4 2 0 +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Middle, TextDirection.RightLeft_TopBottom, @" +******* +******* +******* +*4 2 0* +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Middle, TextDirection.RightLeft_TopBottom, @" +******* +******* +******* +4 2 0 +******* +******* +*******")] + + [InlineData ("0 你 4", TextAlignment.Left, VerticalTextAlignment.Middle, TextDirection.RightLeft_TopBottom, @" +******* +******* +******* +4 你 0* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Middle, TextDirection.RightLeft_TopBottom, @" +******* +******* +******* +*4 你 0 +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Middle, TextDirection.RightLeft_TopBottom, @" +******* +******* +******* +4 你 0* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Middle, TextDirection.RightLeft_TopBottom, @" +******* +******* +******* +4 你 0 +******* +******* +*******")] + + // RightLeft_BottomTop + [InlineData ("0 2 4", TextAlignment.Left, VerticalTextAlignment.Middle, TextDirection.RightLeft_BottomTop, @" +******* +******* +******* +4 2 0** +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Middle, TextDirection.RightLeft_BottomTop, @" +******* +******* +******* +**4 2 0 +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Middle, TextDirection.RightLeft_BottomTop, @" +******* +******* +******* +*4 2 0* +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Middle, TextDirection.RightLeft_BottomTop, @" +******* +******* +******* +4 2 0 +******* +******* +*******")] + + [InlineData ("0 你 4", TextAlignment.Left, VerticalTextAlignment.Middle, TextDirection.RightLeft_BottomTop, @" +******* +******* +******* +4 你 0* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Middle, TextDirection.RightLeft_BottomTop, @" +******* +******* +******* +*4 你 0 +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Middle, TextDirection.RightLeft_BottomTop, @" +******* +******* +******* +4 你 0* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Middle, TextDirection.RightLeft_BottomTop, @" +******* +******* +******* +4 你 0 +******* +******* +*******")] + + // Horizontal with VerticalTextAlignment.Justified + // LeftRight_TopBottom + [InlineData ("0 2 4", TextAlignment.Left, VerticalTextAlignment.Justified, TextDirection.LeftRight_TopBottom, @" +0 2 4** +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Justified, TextDirection.LeftRight_TopBottom, @" +**0 2 4 +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Justified, TextDirection.LeftRight_TopBottom, @" +*0 2 4* +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Justified, TextDirection.LeftRight_TopBottom, @" +0 2 4 +******* +******* +******* +******* +******* +*******")] + + [InlineData ("0 你 4", TextAlignment.Left, VerticalTextAlignment.Justified, TextDirection.LeftRight_TopBottom, @" +0 你 4* +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Justified, TextDirection.LeftRight_TopBottom, @" +*0 你 4 +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Justified, TextDirection.LeftRight_TopBottom, @" +0 你 4* +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Justified, TextDirection.LeftRight_TopBottom, @" +0 你 4 +******* +******* +******* +******* +******* +*******")] + + // LeftRight_BottomTop + [InlineData ("0 2 4", TextAlignment.Left, VerticalTextAlignment.Justified, TextDirection.LeftRight_BottomTop, @" +0 2 4** +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Justified, TextDirection.LeftRight_BottomTop, @" +**0 2 4 +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Justified, TextDirection.LeftRight_BottomTop, @" +*0 2 4* +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Justified, TextDirection.LeftRight_BottomTop, @" +0 2 4 +******* +******* +******* +******* +******* +*******")] + + [InlineData ("0 你 4", TextAlignment.Left, VerticalTextAlignment.Justified, TextDirection.LeftRight_BottomTop, @" +0 你 4* +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Justified, TextDirection.LeftRight_BottomTop, @" +*0 你 4 +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Justified, TextDirection.LeftRight_BottomTop, @" +0 你 4* +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Justified, TextDirection.LeftRight_BottomTop, @" +0 你 4 +******* +******* +******* +******* +******* +*******")] + + // RightLeft_TopBottom + [InlineData ("0 2 4", TextAlignment.Left, VerticalTextAlignment.Justified, TextDirection.RightLeft_TopBottom, @" +4 2 0** +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Justified, TextDirection.RightLeft_TopBottom, @" +**4 2 0 +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Justified, TextDirection.RightLeft_TopBottom, @" +*4 2 0* +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Justified, TextDirection.RightLeft_TopBottom, @" +4 2 0 +******* +******* +******* +******* +******* +*******")] + + [InlineData ("0 你 4", TextAlignment.Left, VerticalTextAlignment.Justified, TextDirection.RightLeft_TopBottom, @" +4 你 0* +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Justified, TextDirection.RightLeft_TopBottom, @" +*4 你 0 +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Justified, TextDirection.RightLeft_TopBottom, @" +4 你 0* +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Justified, TextDirection.RightLeft_TopBottom, @" +4 你 0 +******* +******* +******* +******* +******* +*******")] + + // RightLeft_BottomTop + [InlineData ("0 2 4", TextAlignment.Left, VerticalTextAlignment.Justified, TextDirection.RightLeft_BottomTop, @" +4 2 0** +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Justified, TextDirection.RightLeft_BottomTop, @" +**4 2 0 +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Justified, TextDirection.RightLeft_BottomTop, @" +*4 2 0* +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Justified, TextDirection.RightLeft_BottomTop, @" +4 2 0 +******* +******* +******* +******* +******* +*******")] + + [InlineData ("0 你 4", TextAlignment.Left, VerticalTextAlignment.Justified, TextDirection.RightLeft_BottomTop, @" +4 你 0* +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Justified, TextDirection.RightLeft_BottomTop, @" +*4 你 0 +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Justified, TextDirection.RightLeft_BottomTop, @" +4 你 0* +******* +******* +******* +******* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Justified, TextDirection.RightLeft_BottomTop, @" +4 你 0 +******* +******* +******* +******* +******* +*******")] + + // Vertical with TextAlignment.Left // TopBottom_LeftRight [InlineData ("0 2 4", TextAlignment.Left, VerticalTextAlignment.Top, TextDirection.TopBottom_LeftRight, @" 0****** @@ -4485,17 +5294,6 @@ B")] ****** 4******")] - // Right - // TODO: Add more tests for Right alignment - [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Middle, TextDirection.TopBottom_RightLeft, @" -******* -*****0* -***** * -*****你 -***** * -*****4* -*******")] - // BottomTop_LeftRight [InlineData ("0 2 4", TextAlignment.Left, VerticalTextAlignment.Top, TextDirection.BottomTop_LeftRight, @" 4****** @@ -4629,6 +5427,814 @@ B")] ****** ****** 0******")] + + // Vertical with TextAlignment.Right + // TopBottom_LeftRight + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Top, TextDirection.TopBottom_LeftRight, @" +******0 +****** +******2 +****** +******4 +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Bottom, TextDirection.TopBottom_LeftRight, @" +******* +******* +******0 +****** +******2 +****** +******4")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Middle, TextDirection.TopBottom_LeftRight, @" +******* +******0 +****** +******2 +****** +******4 +*******")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Justified, TextDirection.TopBottom_LeftRight, @" +******0 +****** +****** +******2 +****** +****** +******4")] + + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Top, TextDirection.TopBottom_LeftRight, @" +*****0* +***** * +*****你 +***** * +*****4* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Bottom, TextDirection.TopBottom_LeftRight, @" +******* +******* +*****0* +***** * +*****你 +***** * +*****4*")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Middle, TextDirection.TopBottom_LeftRight, @" +******* +*****0* +***** * +*****你 +***** * +*****4* +*******")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Justified, TextDirection.TopBottom_LeftRight, @" +*****0* +***** * +***** * +*****你 +***** * +***** * +*****4*")] + + // TopBottom_RightLeft + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Top, TextDirection.TopBottom_RightLeft, @" +******0 +****** +******2 +****** +******4 +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Bottom, TextDirection.TopBottom_RightLeft, @" +******* +******* +******0 +****** +******2 +****** +******4")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Middle, TextDirection.TopBottom_RightLeft, @" +******* +******0 +****** +******2 +****** +******4 +*******")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Justified, TextDirection.TopBottom_RightLeft, @" +******0 +****** +****** +******2 +****** +****** +******4")] + + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Top, TextDirection.TopBottom_RightLeft, @" +*****0* +***** * +*****你 +***** * +*****4* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Bottom, TextDirection.TopBottom_RightLeft, @" +******* +******* +*****0* +***** * +*****你 +***** * +*****4*")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Middle, TextDirection.TopBottom_RightLeft, @" +******* +*****0* +***** * +*****你 +***** * +*****4* +*******")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Justified, TextDirection.TopBottom_RightLeft, @" +*****0* +***** * +***** * +*****你 +***** * +***** * +*****4*")] + + // BottomTop_LeftRight + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Top, TextDirection.BottomTop_LeftRight, @" +******4 +****** +******2 +****** +******0 +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Bottom, TextDirection.BottomTop_LeftRight, @" +******* +******* +******4 +****** +******2 +****** +******0")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Middle, TextDirection.BottomTop_LeftRight, @" +******* +******4 +****** +******2 +****** +******0 +*******")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Justified, TextDirection.BottomTop_LeftRight, @" +******4 +****** +****** +******2 +****** +****** +******0")] + + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Top, TextDirection.BottomTop_LeftRight, @" +*****4* +***** * +*****你 +***** * +*****0* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Bottom, TextDirection.BottomTop_LeftRight, @" +******* +******* +*****4* +***** * +*****你 +***** * +*****0*")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Middle, TextDirection.BottomTop_LeftRight, @" +******* +*****4* +***** * +*****你 +***** * +*****0* +*******")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Justified, TextDirection.BottomTop_LeftRight, @" +*****4* +***** * +***** * +*****你 +***** * +***** * +*****0*")] + + // BottomTop_RightLeft + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Top, TextDirection.BottomTop_RightLeft, @" +******4 +****** +******2 +****** +******0 +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Bottom, TextDirection.BottomTop_RightLeft, @" +******* +******* +******4 +****** +******2 +****** +******0")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Middle, TextDirection.BottomTop_RightLeft, @" +******* +******4 +****** +******2 +****** +******0 +*******")] + [InlineData ("0 2 4", TextAlignment.Right, VerticalTextAlignment.Justified, TextDirection.BottomTop_RightLeft, @" +******4 +****** +****** +******2 +****** +****** +******0")] + + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Top, TextDirection.BottomTop_RightLeft, @" +*****4* +***** * +*****你 +***** * +*****0* +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Bottom, TextDirection.BottomTop_RightLeft, @" +******* +******* +*****4* +***** * +*****你 +***** * +*****0*")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Middle, TextDirection.BottomTop_RightLeft, @" +******* +*****4* +***** * +*****你 +***** * +*****0* +*******")] + [InlineData ("0 你 4", TextAlignment.Right, VerticalTextAlignment.Justified, TextDirection.BottomTop_RightLeft, @" +*****4* +***** * +***** * +*****你 +***** * +***** * +*****0*")] + + // Vertical with TextAlignment.Centered + // TopBottom_LeftRight + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Top, TextDirection.TopBottom_LeftRight, @" +***0*** +*** *** +***2*** +*** *** +***4*** +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Bottom, TextDirection.TopBottom_LeftRight, @" +******* +******* +***0*** +*** *** +***2*** +*** *** +***4***")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Middle, TextDirection.TopBottom_LeftRight, @" +******* +***0*** +*** *** +***2*** +*** *** +***4*** +*******")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Justified, TextDirection.TopBottom_LeftRight, @" +***0*** +*** *** +*** *** +***2*** +*** *** +*** *** +***4***")] + + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Top, TextDirection.TopBottom_LeftRight, @" +**0**** +** **** +**你*** +** **** +**4**** +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Bottom, TextDirection.TopBottom_LeftRight, @" +******* +******* +**0**** +** **** +**你*** +** **** +**4****")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Middle, TextDirection.TopBottom_LeftRight, @" +******* +**0**** +** **** +**你*** +** **** +**4**** +*******")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Justified, TextDirection.TopBottom_LeftRight, @" +**0**** +** **** +** **** +**你*** +** **** +** **** +**4****")] + + // TopBottom_RightLeft + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Top, TextDirection.TopBottom_RightLeft, @" +***0*** +*** *** +***2*** +*** *** +***4*** +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Bottom, TextDirection.TopBottom_RightLeft, @" +******* +******* +***0*** +*** *** +***2*** +*** *** +***4***")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Middle, TextDirection.TopBottom_RightLeft, @" +******* +***0*** +*** *** +***2*** +*** *** +***4*** +*******")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Justified, TextDirection.TopBottom_RightLeft, @" +***0*** +*** *** +*** *** +***2*** +*** *** +*** *** +***4***")] + + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Top, TextDirection.TopBottom_RightLeft, @" +**0**** +** **** +**你*** +** **** +**4**** +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Bottom, TextDirection.TopBottom_RightLeft, @" +******* +******* +**0**** +** **** +**你*** +** **** +**4****")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Middle, TextDirection.TopBottom_RightLeft, @" +******* +**0**** +** **** +**你*** +** **** +**4**** +*******")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Justified, TextDirection.TopBottom_RightLeft, @" +**0**** +** **** +** **** +**你*** +** **** +** **** +**4****")] + + // BottomTop_LeftRight + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Top, TextDirection.BottomTop_LeftRight, @" +***4*** +*** *** +***2*** +*** *** +***0*** +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Bottom, TextDirection.BottomTop_LeftRight, @" +******* +******* +***4*** +*** *** +***2*** +*** *** +***0***")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Middle, TextDirection.BottomTop_LeftRight, @" +******* +***4*** +*** *** +***2*** +*** *** +***0*** +*******")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Justified, TextDirection.BottomTop_LeftRight, @" +***4*** +*** *** +*** *** +***2*** +*** *** +*** *** +***0***")] + + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Top, TextDirection.BottomTop_LeftRight, @" +**4**** +** **** +**你*** +** **** +**0**** +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Bottom, TextDirection.BottomTop_LeftRight, @" +******* +******* +**4**** +** **** +**你*** +** **** +**0****")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Middle, TextDirection.BottomTop_LeftRight, @" +******* +**4**** +** **** +**你*** +** **** +**0**** +*******")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Justified, TextDirection.BottomTop_LeftRight, @" +**4**** +** **** +** **** +**你*** +** **** +** **** +**0****")] + + // BottomTop_RightLeft + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Top, TextDirection.BottomTop_RightLeft, @" +***4*** +*** *** +***2*** +*** *** +***0*** +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Bottom, TextDirection.BottomTop_RightLeft, @" +******* +******* +***4*** +*** *** +***2*** +*** *** +***0***")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Middle, TextDirection.BottomTop_RightLeft, @" +******* +***4*** +*** *** +***2*** +*** *** +***0*** +*******")] + [InlineData ("0 2 4", TextAlignment.Centered, VerticalTextAlignment.Justified, TextDirection.BottomTop_RightLeft, @" +***4*** +*** *** +*** *** +***2*** +*** *** +*** *** +***0***")] + + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Top, TextDirection.BottomTop_RightLeft, @" +**4**** +** **** +**你*** +** **** +**0**** +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Bottom, TextDirection.BottomTop_RightLeft, @" +******* +******* +**4**** +** **** +**你*** +** **** +**0****")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Middle, TextDirection.BottomTop_RightLeft, @" +******* +**4**** +** **** +**你*** +** **** +**0**** +*******")] + [InlineData ("0 你 4", TextAlignment.Centered, VerticalTextAlignment.Justified, TextDirection.BottomTop_RightLeft, @" +**4**** +** **** +** **** +**你*** +** **** +** **** +**0****")] + + // Vertical with TextAlignment.Justified + // TopBottom_LeftRight + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Top, TextDirection.TopBottom_LeftRight, @" +0****** + ****** +2****** + ****** +4****** +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Bottom, TextDirection.TopBottom_LeftRight, @" +******* +******* +0****** + ****** +2****** + ****** +4******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Middle, TextDirection.TopBottom_LeftRight, @" +******* +0****** + ****** +2****** + ****** +4****** +*******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Justified, TextDirection.TopBottom_LeftRight, @" +0****** + ****** + ****** +2****** + ****** + ****** +4******")] + + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Top, TextDirection.TopBottom_LeftRight, @" +0****** + ****** +你***** + ****** +4****** +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Bottom, TextDirection.TopBottom_LeftRight, @" +******* +******* +0****** + ****** +你***** + ****** +4******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Middle, TextDirection.TopBottom_LeftRight, @" +******* +0****** + ****** +你***** + ****** +4****** +*******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Justified, TextDirection.TopBottom_LeftRight, @" +0****** + ****** + ****** +你***** + ****** + ****** +4******")] + + // TopBottom_RightLeft + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Top, TextDirection.TopBottom_RightLeft, @" +0****** + ****** +2****** + ****** +4****** +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Bottom, TextDirection.TopBottom_RightLeft, @" +******* +******* +0****** + ****** +2****** + ****** +4******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Middle, TextDirection.TopBottom_RightLeft, @" +******* +0****** + ****** +2****** + ****** +4****** +*******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Justified, TextDirection.TopBottom_RightLeft, @" +0****** + ****** + ****** +2****** + ****** + ****** +4******")] + + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Top, TextDirection.TopBottom_RightLeft, @" +0****** + ****** +你***** + ****** +4****** +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Bottom, TextDirection.TopBottom_RightLeft, @" +******* +******* +0****** + ****** +你***** + ****** +4******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Middle, TextDirection.TopBottom_RightLeft, @" +******* +0****** + ****** +你***** + ****** +4****** +*******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Justified, TextDirection.TopBottom_RightLeft, @" +0****** + ****** + ****** +你***** + ****** + ****** +4******")] + + // BottomTop_LeftRight + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Top, TextDirection.BottomTop_LeftRight, @" +4****** + ****** +2****** + ****** +0****** +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Bottom, TextDirection.BottomTop_LeftRight, @" +******* +******* +4****** + ****** +2****** + ****** +0******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Middle, TextDirection.BottomTop_LeftRight, @" +******* +4****** + ****** +2****** + ****** +0****** +*******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Justified, TextDirection.BottomTop_LeftRight, @" +4****** + ****** + ****** +2****** + ****** + ****** +0******")] + + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Top, TextDirection.BottomTop_LeftRight, @" +4****** + ****** +你***** + ****** +0****** +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Bottom, TextDirection.BottomTop_LeftRight, @" +******* +******* +4****** + ****** +你***** + ****** +0******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Middle, TextDirection.BottomTop_LeftRight, @" +******* +4****** + ****** +你***** + ****** +0****** +*******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Justified, TextDirection.BottomTop_LeftRight, @" +4****** + ****** + ****** +你***** + ****** + ****** +0******")] + + // BottomTop_RightLeft + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Top, TextDirection.BottomTop_RightLeft, @" +4****** + ****** +2****** + ****** +0****** +******* +*******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Bottom, TextDirection.BottomTop_RightLeft, @" +******* +******* +4****** + ****** +2****** + ****** +0******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Middle, TextDirection.BottomTop_RightLeft, @" +******* +4****** + ****** +2****** + ****** +0****** +*******")] + [InlineData ("0 2 4", TextAlignment.Justified, VerticalTextAlignment.Justified, TextDirection.BottomTop_RightLeft, @" +4****** + ****** + ****** +2****** + ****** + ****** +0******")] + + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Top, TextDirection.BottomTop_RightLeft, @" +4****** + ****** +你***** + ****** +0****** +******* +*******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Bottom, TextDirection.BottomTop_RightLeft, @" +******* +******* +4****** + ****** +你***** + ****** +0******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Middle, TextDirection.BottomTop_RightLeft, @" +******* +4****** + ****** +你***** + ****** +0****** +*******")] + [InlineData ("0 你 4", TextAlignment.Justified, VerticalTextAlignment.Justified, TextDirection.BottomTop_RightLeft, @" +4****** + ****** + ****** +你***** + ****** + ****** +0******")] + public void Draw_Text_Alignment (string text, TextAlignment horizontalTextAlignment, VerticalTextAlignment verticalTextAlignment, TextDirection textDirection, string expectedText) { TextFormatter tf = new ()