[FileExplorerAddOns]Improves handling of Gcode Thumbnails (#27947)

* Improves handling of Gcode Thumbnails

* Remove Peek support

* Moves GcodeHelper to PreviewHandlerCommon

* Reverts minor change

* Skip unknown data on GcodeHelper.GetBestThumbnail

* Replaces QOI.Core with QoiImage

* Fixes spellchecker

* Reverts changes to NOTICE.md

* Minor QoiImage improvements

* Use custom QoiPixel struct

* Add MIT notice for the QOI reference code

* Fix spellcheck for the MIT notice

* Update NOTICE.md

tweaked notice a bit
This commit is contained in:
Pedro Lamas
2023-09-19 15:33:55 +01:00
committed by GitHub
parent cc454701b8
commit 4ba1d83cf5
22 changed files with 103394 additions and 55303 deletions

View File

@@ -2,28 +2,24 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using Common.ComInterlop;
using Microsoft.PowerToys.STATestExtension;
using Microsoft.PowerToys.ThumbnailHandler.Gcode;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
namespace GcodeThumbnailProviderUnitTests
{
[STATestClass]
public class GcodeThumbnailProviderTests
{
[TestMethod]
public void GetThumbnailValidStreamGcode()
[DataTestMethod]
[DataRow("HelperFiles/sample.gcode")]
[DataRow("HelperFiles/sample_JPG.gcode")]
[DataRow("HelperFiles/sample_QOI.gcode")]
public void GetThumbnailValidStreamGcode(string filePath)
{
// Act
var filePath = "HelperFiles/sample.gcode";
GcodeThumbnailProvider provider = new GcodeThumbnailProvider(filePath);
Bitmap bitmap = provider.GetThumbnail(256);

View File

@@ -23,6 +23,8 @@
<ItemGroup>
<None Remove="HelperFiles\sample.gcode" />
<None Remove="HelperFiles\sample_JPG.gcode" />
<None Remove="HelperFiles\sample_QOI.gcode" />
</ItemGroup>
<ItemGroup>
@@ -44,5 +46,11 @@
<Content Include="HelperFiles\sample.gcode">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="HelperFiles\sample_JPG.gcode">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="HelperFiles\sample_QOI.gcode">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>