mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
[FileExplorer]Add QoiThumbnailProvider and QoiPreviewHandler (#29735)
* [FileExplorer]QoiThumbnailProvider * Corrects code documentation * Adds QoiPreviewHandler * Corrects GUIDs * Ensure returned thumbnail image is 32bit ARGB * Updates following review comments * More updates following review comments * Updates following PR comments * Fix dark theme background in QoiPreviewHandler * Updates attribution text
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// 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.Drawing;
|
||||
using Microsoft.PowerToys.STATestExtension;
|
||||
using Microsoft.PowerToys.ThumbnailHandler.Qoi;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace QoiThumbnailProviderUnitTests
|
||||
{
|
||||
[STATestClass]
|
||||
public class QoiThumbnailProviderTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void GetThumbnailValidStreamQoi()
|
||||
{
|
||||
// Act
|
||||
var filePath = "HelperFiles/sample.qoi";
|
||||
|
||||
QoiThumbnailProvider provider = new QoiThumbnailProvider(filePath);
|
||||
|
||||
Bitmap bitmap = provider.GetThumbnail(256);
|
||||
|
||||
Assert.IsTrue(bitmap != null);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetThumbnailInValidSizeQoi()
|
||||
{
|
||||
// Act
|
||||
var filePath = "HelperFiles/sample.qoi";
|
||||
|
||||
QoiThumbnailProvider provider = new QoiThumbnailProvider(filePath);
|
||||
|
||||
Bitmap bitmap = provider.GetThumbnail(0);
|
||||
|
||||
Assert.IsTrue(bitmap == null);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetThumbnailToBigQoi()
|
||||
{
|
||||
// Act
|
||||
var filePath = "HelperFiles/sample.qoi";
|
||||
|
||||
QoiThumbnailProvider provider = new QoiThumbnailProvider(filePath);
|
||||
|
||||
Bitmap bitmap = provider.GetThumbnail(10001);
|
||||
|
||||
Assert.IsTrue(bitmap == null);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CheckNoQoiNullStringShouldReturnNullBitmap()
|
||||
{
|
||||
Bitmap thumbnail = QoiThumbnailProvider.GetThumbnail(null, 256);
|
||||
Assert.IsTrue(thumbnail == null);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user