- Services/PdfRedactText.cs: strip text whose origin falls inside a CoverAnnotation from the page content stream at save time, hooked into PdfBurn.DrawAnnotationsIntoDoc. Fixes edited values staying recoverable by text extraction. - Themes/MMD.xaml replaces all thirteen themes; picker and accent strip removed; no dark mode. - Rename KillerPDF -> MMD PDF across code, resources, packaging and locale strings; new icon. - Remove the upstream author credit and the in-app install button.
39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
using System.Windows;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using MmdPdf.Services;
|
|
using Xunit;
|
|
|
|
namespace MmdPdf.Tests;
|
|
|
|
public sealed class PerspectiveWarpTests
|
|
{
|
|
[Fact]
|
|
public void IdentityCornersPreserveDimensionsAndCornerPixels()
|
|
{
|
|
byte[] pixels =
|
|
{
|
|
1,2,3,255, 4,5,6,255,
|
|
7,8,9,255, 10,11,12,255,
|
|
};
|
|
var source = BitmapSource.Create(2, 2, 96, 96, PixelFormats.Bgra32, null, pixels, 8);
|
|
Point[] corners = { new(0,0), new(1,0), new(1,1), new(0,1) };
|
|
|
|
var result = PerspectiveWarp.Apply(source, corners);
|
|
byte[] actual = new byte[16];
|
|
result.CopyPixels(actual, 8, 0);
|
|
|
|
Assert.Equal(2, result.PixelWidth);
|
|
Assert.Equal(2, result.PixelHeight);
|
|
Assert.Equal(pixels, actual);
|
|
}
|
|
|
|
[Fact]
|
|
public void RejectsCollapsedQuadrilateral()
|
|
{
|
|
var source = BitmapSource.Create(2, 2, 96, 96, PixelFormats.Bgra32, null, new byte[16], 8);
|
|
Point[] corners = { new(0,0), new(0,0), new(0,0), new(0,0) };
|
|
Assert.Throws<System.InvalidOperationException>(() => PerspectiveWarp.Apply(source, corners));
|
|
}
|
|
}
|