mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[SVGPreview]Handle comments properly (#28863)
* [SVGPreview] Handle comments properly * f: spelling * f: add tolerance to the bitmap eq test * f: remove bitmap eq testing, since it doesn't work on CI for some reason * f: parsing issue
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- Generator: Adobe Illustrator 27.5.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<!-- Generator: Adobe Illustrator 27.5.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg viewBox="0 0 100 100"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="50"
|
||||
cy="50"
|
||||
fill="rgba(0, 0, 255, 1)"
|
||||
r="50">
|
||||
<script>alert("valid-message")</script>
|
||||
</circle>
|
||||
</svg>
|
||||
|
||||
<!-- Generator: Adobe Illustrator 27.5.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
After Width: | Height: | Size: 552 B |
@@ -4,14 +4,12 @@
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Text;
|
||||
using Common.ComInterlop;
|
||||
using Microsoft.PowerToys.STATestExtension;
|
||||
using Microsoft.PowerToys.ThumbnailHandler.Svg;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
|
||||
namespace SvgThumbnailProviderUnitTests
|
||||
{
|
||||
@@ -211,5 +209,17 @@ namespace SvgThumbnailProviderUnitTests
|
||||
|
||||
Assert.IsTrue(bitmap != null);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SvgCommentsAreHandledCorrectly()
|
||||
{
|
||||
var filePath = "HelperFiles/WithComments.svg";
|
||||
|
||||
SvgThumbnailProvider svgThumbnailProvider = new SvgThumbnailProvider(filePath);
|
||||
|
||||
Bitmap bitmap = svgThumbnailProvider.GetThumbnail(8);
|
||||
|
||||
Assert.IsTrue(bitmap != null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,15 +38,19 @@
|
||||
<ProjectReference Include="..\SvgThumbnailProvider\SvgThumbnailProvider.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\STATestClassAttribute.cs" Link="STATestClassAttribute.cs" />
|
||||
<Compile Include="..\STATestMethodAttribute.cs" Link="STATestMethodAttribute.cs" />
|
||||
<Compile Include="..\STATestClassAttribute.cs"
|
||||
Link="STATestClassAttribute.cs" />
|
||||
<Compile Include="..\STATestMethodAttribute.cs"
|
||||
Link="STATestMethodAttribute.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="HelperFiles\file1.svg">
|
||||
<Content Include="HelperFiles\*.svg">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="HelperFiles\file2.svg">
|
||||
<Content Include="HelperFiles\*.bmp">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user