mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-24 04:02:50 +08:00
Fix @ being used in figlet font
This commit is contained in:
parent
fd8d271a10
commit
999c59909b
@ -35,7 +35,7 @@ internal static class FigletFontParser
|
|||||||
throw new InvalidOperationException("Unknown index for FIGlet character");
|
throw new InvalidOperationException("Unknown index for FIGlet character");
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer.Add(line.Replace(header.Hardblank, ' ').ReplaceExact("@", string.Empty));
|
buffer.Add(line.Replace(header.Hardblank, ' ').TrimEnd('@'));
|
||||||
|
|
||||||
if (line.EndsWith("@@", StringComparison.Ordinal))
|
if (line.EndsWith("@@", StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
|
1239
test/Spectre.Console.Tests/Data/poison.flf
Normal file
1239
test/Spectre.Console.Tests/Data/poison.flf
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
@@@@@@@ @@@@@@ @@@@@@@ @@@@@@@ @@@ @@@ @@@ @@@ @@@ @@@ @@@@@@ @@@@@@ @@@ @@@ @@@@@@@@ @@@@@@@ @@@@@@@@
|
||||||
|
@@@@@@@@ @@@@@@@@ @@@@@@@ @@@@@@@@ @@@ @@@ @@@ @@@ @@@ @@@ @@@@@@@@ @@@@@@@ @@@ @@@ @@@@@@@@ @@@@@@@@ @@@@@@@@
|
||||||
|
@@! @@@ @@! @@@ @@! @@! @@@ @@! @@! !@@ @@! @@! @@! @@! @@@ !@@ @@! @@@ @@! @@! @@@ @@!
|
||||||
|
!@! @!@ !@! @!@ !@! !@! @!@ !@! !@! @!! !@! !@! !@! !@! @!@ !@! !@! @!@ !@! !@! @!@ !@!
|
||||||
|
@!@@!@! @!@!@!@! @!! @!@!!@! !!@ @!@@!@! @!! !!@ @!@ @!@!@!@! !!@@!! @!@!@!@! @!!!:! @!@!!@! @!!!:!
|
||||||
|
!!@!!! !!!@!!!! !!! !!@!@! !!! !!@!!! !@! !!! !@! !!!@!!!! !!@!!! !!!@!!!! !!!!!: !!@!@! !!!!!:
|
||||||
|
!!: !!: !!! !!: !!: :!! !!: !!: :!! !!: !!: !!: !!: !!! !:! !!: !!! !!: !!: :!! !!:
|
||||||
|
:!: :!: !:! :!: :!: !:! :!: :!: !:! :!: :!: :!: :!: !:! !:! :!: !:! :!: :!: !:! :!:
|
||||||
|
:: :: ::: :: :: ::: :: :: ::: :::: :: ::: :: ::: :::: :: :: ::: :: :::: :: ::: :: ::::
|
||||||
|
: : : : : : : : : : ::: :: : : : : : : :: : : : : : : :: :: : : : : :: ::
|
||||||
|
|
@ -9,6 +9,8 @@
|
|||||||
<AdditionalFiles Include="..\..\src\stylecop.json" Link="Properties/stylecop.json" />
|
<AdditionalFiles Include="..\..\src\stylecop.json" Link="Properties/stylecop.json" />
|
||||||
<None Remove="Data\starwars.flf" />
|
<None Remove="Data\starwars.flf" />
|
||||||
<EmbeddedResource Include="Data\starwars.flf" />
|
<EmbeddedResource Include="Data\starwars.flf" />
|
||||||
|
<None Remove="Data\poison.flf" />
|
||||||
|
<EmbeddedResource Include="Data\poison.flf" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -4,20 +4,23 @@ namespace Spectre.Console.Tests.Unit;
|
|||||||
[ExpectationPath("Widgets/Figlet")]
|
[ExpectationPath("Widgets/Figlet")]
|
||||||
public sealed class FigletTests
|
public sealed class FigletTests
|
||||||
{
|
{
|
||||||
[Fact]
|
[Theory]
|
||||||
|
[InlineData("starwars.flf")]
|
||||||
|
[InlineData("poison.flf")]
|
||||||
[Expectation("Load_Stream")]
|
[Expectation("Load_Stream")]
|
||||||
public async Task Should_Load_Font_From_Stream()
|
public async Task Should_Load_Font_From_Stream(string fontfile)
|
||||||
{
|
{
|
||||||
// Given
|
// Given
|
||||||
var console = new TestConsole().Width(180);
|
var console = new TestConsole().Width(180);
|
||||||
var font = FigletFont.Load(EmbeddedResourceReader.LoadResourceStream("Spectre.Console.Tests/Data/starwars.flf"));
|
var font = FigletFont.Load(EmbeddedResourceReader.LoadResourceStream($"Spectre.Console.Tests/Data/{fontfile}"));
|
||||||
var text = new FigletText(font, "Patrik was here");
|
var text = new FigletText(font, "Patrik was here");
|
||||||
|
|
||||||
// When
|
// When
|
||||||
console.Write(text);
|
console.Write(text);
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
await Verifier.Verify(console.Output);
|
await Verifier.Verify(console.Output)
|
||||||
|
.UseParameters(fontfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user