mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 00:42:51 +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");
|
||||
}
|
||||
|
||||
buffer.Add(line.Replace(header.Hardblank, ' ').ReplaceExact("@", string.Empty));
|
||||
buffer.Add(line.Replace(header.Hardblank, ' ').TrimEnd('@'));
|
||||
|
||||
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" />
|
||||
<None Remove="Data\starwars.flf" />
|
||||
<EmbeddedResource Include="Data\starwars.flf" />
|
||||
<None Remove="Data\poison.flf" />
|
||||
<EmbeddedResource Include="Data\poison.flf" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -4,20 +4,23 @@ namespace Spectre.Console.Tests.Unit;
|
||||
[ExpectationPath("Widgets/Figlet")]
|
||||
public sealed class FigletTests
|
||||
{
|
||||
[Fact]
|
||||
[Theory]
|
||||
[InlineData("starwars.flf")]
|
||||
[InlineData("poison.flf")]
|
||||
[Expectation("Load_Stream")]
|
||||
public async Task Should_Load_Font_From_Stream()
|
||||
public async Task Should_Load_Font_From_Stream(string fontfile)
|
||||
{
|
||||
// Given
|
||||
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");
|
||||
|
||||
// When
|
||||
console.Write(text);
|
||||
|
||||
// Then
|
||||
await Verifier.Verify(console.Output);
|
||||
await Verifier.Verify(console.Output)
|
||||
.UseParameters(fontfile);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
Loading…
x
Reference in New Issue
Block a user