Skip to content

Commit

Permalink
SVG improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Jan 30, 2024
1 parent 23d6f98 commit 91c6180
Show file tree
Hide file tree
Showing 10 changed files with 582 additions and 175 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageProjectUrl>https://github.com/squidex/squidex</PackageProjectUrl>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Version>6.3.6</Version>
<Version>6.3.7</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
Expand Down
26 changes: 26 additions & 0 deletions text/Squidex.Text.Tests/HtmlExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================

using System.Text;
using Xunit;

namespace Squidex.Text;
Expand Down Expand Up @@ -61,6 +62,31 @@ public void Should_not_convert_html_with_script_to_text()
Assert.Equal(string.Empty, text);
}

[Theory]
[InlineData("1 &lt; 2", "1 < 2")]
[InlineData("1 &xt; 2", "1 &xt; 2")]
[InlineData("1 &#60; 2", "1 < 2")]
[InlineData("1 &#x3C; 2", "1 < 2")]
[InlineData("1 &; 2", "1 &; 2")]
public void Should_convert_entity(string source, string expected)
{
var sb = new StringBuilder();

HtmlEntity.Decode(source, sb);

Assert.Equal(expected, sb.ToString());
}

[Fact]
public void Should_extract_metadata()
{
var svg = File.ReadAllText(Path.Combine("TestFiles", "SvgValid.svg"));

var metadata = svg.GetSvgMetadata();

Assert.Equal(new SvgMetadata("50", "30", "0 0 100 100"), metadata);
}

private static string BuildText(string text)
{
return text.Replace("\n", Environment.NewLine, StringComparison.Ordinal);
Expand Down
2 changes: 1 addition & 1 deletion text/Squidex.Text.Tests/TestFiles/SvgValid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 91c6180

Please sign in to comment.