Fixes #2025 - API Docs are now generated via Github Action - View Source Works (#2027)

* Fixes #1991 - Broken link in README

* Force push to main to update api docs after fixing #1874

* Fixes #1745 - Github action to generate API docs

* Try 2 - Fixes #1745 - Github action to generate API docs

* Try 3 - Fixes #1745 - Github action to generate API docs

* Try 4 - Fixes #1745 - Github action to generate API docs

* Try 4 - Fixes #1745 - Github action to generate API docs

* Try 6 - Fixes #1745 - Github action to generate API docs

* Removed docs folder because gh-pages branch is now used

* Ignore ./docs folder

* Fix readme for docfx

* Revert "merge"

This reverts commit 870a241d5d, reversing
changes made to 48089bb31c.
This commit is contained in:
Tig Kindel
2022-09-16 09:30:14 -07:00
committed by GitHub
parent 281a849c08
commit c6001c794b
349 changed files with 597 additions and 196993 deletions

View File

@@ -1093,11 +1093,11 @@ namespace Terminal.Gui.Core {
text = "A sentence has words.";
// should fit
maxWidth = text.RuneCount + 1;
expectedClippedWidth = Math.Max (text.RuneCount, maxWidth);
expectedClippedWidth = Math.Min (text.RuneCount, maxWidth);
justifiedText = TextFormatter.ClipAndJustify (text, maxWidth, align);
Assert.Equal (expectedClippedWidth, justifiedText.RuneCount);
//Assert.Equal (expectedClippedWidth, justifiedText.RuneCount);
Assert.True (expectedClippedWidth <= maxWidth);
Assert.Throws<ArgumentOutOfRangeException> (() => ustring.Make (text.ToRunes () [0..expectedClippedWidth]));
Assert.Equal (ustring.Make (text.ToRunes () [0..expectedClippedWidth]), justifiedText);
// Should fit.
maxWidth = text.RuneCount + 0;
@@ -1205,6 +1205,7 @@ namespace Terminal.Gui.Core {
Assert.Equal (ustring.Make (text.ToRunes () [0..expectedClippedWidth]), justifiedText);
// see Justify_ tests below
}
[Fact]
@@ -1309,7 +1310,7 @@ namespace Terminal.Gui.Core {
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "012++456+89";
justifiedText = text.Replace (" ", "+");
forceToWidth = text.RuneCount + 1;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
@@ -1321,7 +1322,7 @@ namespace Terminal.Gui.Core {
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "012+++456++89";
justifiedText = text.Replace (" ", "++");
forceToWidth = text.RuneCount + 3;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
@@ -1333,7 +1334,7 @@ namespace Terminal.Gui.Core {
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "012++++456+++89";
justifiedText = text.Replace (" ", "+++");
forceToWidth = text.RuneCount + 5;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
@@ -1351,7 +1352,7 @@ namespace Terminal.Gui.Core {
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "012+++++++++++++456++++++++++++89";
justifiedText = text.Replace (" ", "++++++++++++");
forceToWidth = text.RuneCount + 23;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
@@ -1367,13 +1368,13 @@ namespace Terminal.Gui.Core {
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "012++456+89+end";
justifiedText = text.Replace (" ", "+");
forceToWidth = text.RuneCount + 1;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "012++456++89+end";
justifiedText = text.Replace (" ", "+");
forceToWidth = text.RuneCount + 2;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
@@ -1385,13 +1386,13 @@ namespace Terminal.Gui.Core {
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "012+++456++89++end";
justifiedText = text.Replace (" ", "++");
forceToWidth = text.RuneCount + 4;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "012+++456+++89++end";
justifiedText = text.Replace (" ", "++");
forceToWidth = text.RuneCount + 5;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
@@ -1403,13 +1404,13 @@ namespace Terminal.Gui.Core {
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "012++++++++456++++++++89+++++++end";
justifiedText = text.Replace (" ", "+++++++");
forceToWidth = text.RuneCount + 20;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "012+++++++++456+++++++++89++++++++end";
justifiedText = text.Replace (" ", "++++++++");
forceToWidth = text.RuneCount + 23;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
@@ -1426,7 +1427,7 @@ namespace Terminal.Gui.Core {
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "пÑÐ++вÐ+Ñ";
justifiedText = text.Replace (" ", "+");
forceToWidth = text.RuneCount + 1;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
@@ -1438,7 +1439,7 @@ namespace Terminal.Gui.Core {
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "пÑÐ+++вÐ++Ñ";
justifiedText = text.Replace (" ", "++");
forceToWidth = text.RuneCount + 3;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
@@ -1450,7 +1451,7 @@ namespace Terminal.Gui.Core {
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "пÑÐ++++вÐ+++Ñ";
justifiedText = text.Replace (" ", "+++");
forceToWidth = text.RuneCount + 5;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
@@ -1468,7 +1469,7 @@ namespace Terminal.Gui.Core {
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "пÑÐ+++++++++++++вÐ++++++++++++Ñ";
justifiedText = text.Replace (" ", "++++++++++++");
forceToWidth = text.RuneCount + 23;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
@@ -1485,13 +1486,13 @@ namespace Terminal.Gui.Core {
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "Ð++ÑÐ+вÐ+Ñ";
justifiedText = text.Replace (" ", "+");
forceToWidth = text.RuneCount + 1;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "Ð++ÑÐ++вÐ+Ñ";
justifiedText = text.Replace (" ", "+");
forceToWidth = text.RuneCount + 2;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
@@ -1503,13 +1504,13 @@ namespace Terminal.Gui.Core {
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "Ð+++ÑÐ++вÐ++Ñ";
justifiedText = text.Replace (" ", "++");
forceToWidth = text.RuneCount + 4;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "Ð+++ÑÐ+++вÐ++Ñ";
justifiedText = text.Replace (" ", "++");
forceToWidth = text.RuneCount + 5;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
@@ -1521,13 +1522,13 @@ namespace Terminal.Gui.Core {
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "Ð++++++++ÑÐ++++++++вÐ+++++++Ñ";
justifiedText = text.Replace (" ", "+++++++");
forceToWidth = text.RuneCount + 20;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
Assert.True (Math.Abs (forceToWidth - justifiedText.ConsoleWidth) < text.Count (" "));
justifiedText = "Ð+++++++++ÑÐ+++++++++вÐ++++++++Ñ";
justifiedText = text.Replace (" ", "++++++++");
forceToWidth = text.RuneCount + 23;
Assert.Equal (justifiedText.ToString (), TextFormatter.Justify (text, forceToWidth, fillChar).ToString ());
Assert.True (Math.Abs (forceToWidth - justifiedText.RuneCount) < text.Count (" "));
@@ -2933,38 +2934,6 @@ namespace Terminal.Gui.Core {
Assert.Null (exception);
}
[Fact, AutoInitShutdown]
public void Format_Justified_Always_Returns_Text_Width_Equal_To_Passed_Width_Horizontal ()
{
ustring text = "Hello world, how are you today? Pretty neat!";
Assert.Equal (44, text.RuneCount);
for (int i = 44; i < 80; i++) {
var fmtText = TextFormatter.Format (text, i, TextAlignment.Justified, false, true) [0];
Assert.Equal (i, fmtText.RuneCount);
var c = (char)fmtText [^1];
Assert.Equal ('!', c);
}
}
[Fact, AutoInitShutdown]
public void Format_Justified_Always_Returns_Text_Width_Equal_To_Passed_Width_Vertical ()
{
ustring text = "Hello world, how are you today? Pretty neat!";
Assert.Equal (44, text.RuneCount);
for (int i = 44; i < 80; i++) {
var fmtText = TextFormatter.Format (text, i, TextAlignment.Justified, false, true, 0, TextDirection.TopBottom_LeftRight) [0];
Assert.Equal (i, fmtText.RuneCount);
var c = (char)fmtText [^1];
Assert.Equal ('!', c);
}
}
[Fact]
public void Draw_Horizontal_Throws_IndexOutOfRangeException_With_Negative_Bounds ()
{
@@ -3365,48 +3334,6 @@ e
Assert.Equal (new Rect (0, 0, 13, height + 2), pos);
}
[Fact, AutoInitShutdown]
public void Draw_Fill_Remaining ()
{
var view = new View ("This view needs to be cleared before rewritten.");
var tf1 = new TextFormatter ();
tf1.Text = "This TextFormatter (tf1) without fill will not be cleared on rewritten.";
var tf1Size = tf1.Size;
var tf2 = new TextFormatter ();
tf2.Text = "This TextFormatter (tf2) with fill will be cleared on rewritten.";
var tf2Size = tf2.Size;
Application.Top.Add (view);
Application.Begin (Application.Top);
tf1.Draw (new Rect (new Point (0, 1), tf1Size), view.GetNormalColor (), view.ColorScheme.HotNormal, default, false);
tf2.Draw (new Rect (new Point (0, 2), tf2Size), view.GetNormalColor (), view.ColorScheme.HotNormal);
GraphViewTests.AssertDriverContentsWithFrameAre (@"
This view needs to be cleared before rewritten.
This TextFormatter (tf1) without fill will not be cleared on rewritten.
This TextFormatter (tf2) with fill will be cleared on rewritten.
", output);
view.Text = "This view is rewritten.";
view.Redraw (view.Bounds);
tf1.Text = "This TextFormatter (tf1) is rewritten.";
tf1.Draw (new Rect (new Point (0, 1), tf1Size), view.GetNormalColor (), view.ColorScheme.HotNormal, default, false);
tf2.Text = "This TextFormatter (tf2) is rewritten.";
tf2.Draw (new Rect (new Point (0, 2), tf2Size), view.GetNormalColor (), view.ColorScheme.HotNormal);
GraphViewTests.AssertDriverContentsWithFrameAre (@"
This view is rewritten.
This TextFormatter (tf1) is rewritten.will not be cleared on rewritten.
This TextFormatter (tf2) is rewritten.
", output);
}
[Fact]
public void GetTextWidth_Simple_And_Wide_Runes ()
{
@@ -4085,57 +4012,5 @@ This TextFormatter (tf2) is rewritten.
Assert.Equal ("Line2", formated [1]);
Assert.Equal ("Line3", formated [^1]);
}
[Fact]
public void SplitNewLine_Ending_Without_NewLine_Probably_CRLF ()
{
var text = $"First Line 界{Environment.NewLine}Second Line 界{Environment.NewLine}Third Line 界";
var splited = TextFormatter.SplitNewLine (text);
Assert.Equal ("First Line 界", splited [0]);
Assert.Equal ("Second Line 界", splited [1]);
Assert.Equal ("Third Line 界", splited [^1]);
}
[Fact]
public void SplitNewLine_Ending_With_NewLine_Probably_CRLF ()
{
var text = $"First Line 界{Environment.NewLine}Second Line 界{Environment.NewLine}Third Line 界{Environment.NewLine}";
var splited = TextFormatter.SplitNewLine (text);
Assert.Equal ("First Line 界", splited [0]);
Assert.Equal ("Second Line 界", splited [1]);
Assert.Equal ("Third Line 界", splited [2]);
Assert.Equal ("", splited [^1]);
}
[Fact]
public void SplitNewLine_Ending_Without_NewLine_Only_LF ()
{
var text = $"First Line 界\nSecond Line 界\nThird Line 界";
var splited = TextFormatter.SplitNewLine (text);
Assert.Equal ("First Line 界", splited [0]);
Assert.Equal ("Second Line 界", splited [1]);
Assert.Equal ("Third Line 界", splited [^1]);
}
[Fact]
public void SplitNewLine_Ending_With_NewLine_Only_LF ()
{
var text = $"First Line 界\nSecond Line 界\nThird Line 界\n";
var splited = TextFormatter.SplitNewLine (text);
Assert.Equal ("First Line 界", splited [0]);
Assert.Equal ("Second Line 界", splited [1]);
Assert.Equal ("Third Line 界", splited [2]);
Assert.Equal ("", splited [^1]);
}
[Fact]
public void MaxWidthLine_With_And_Without_Newlines ()
{
var text = "Single Line 界";
Assert.Equal (14, TextFormatter.MaxWidthLine (text));
text = $"First Line 界\nSecond Line 界\nThird Line 界\n";
Assert.Equal (14, TextFormatter.MaxWidthLine (text));
}
}
}