- 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.
37 lines
1.0 KiB
C#
37 lines
1.0 KiB
C#
using MmdPdf.Services;
|
|
using PdfSharpCore.Drawing;
|
|
using PdfSharpCore.Pdf;
|
|
using Xunit;
|
|
|
|
namespace MmdPdf.Tests;
|
|
|
|
public sealed class PdfScrubTests
|
|
{
|
|
[Fact]
|
|
public void ScrubDegenerateCropBoxes_RemovesCropOutsideMediaBox()
|
|
{
|
|
using var doc = new PdfDocument();
|
|
var page = doc.AddPage();
|
|
page.MediaBox = new PdfRectangle(new XPoint(0, 0), new XPoint(1191, 842));
|
|
page.CropBox = new PdfRectangle(new XPoint(0, 0), new XPoint(842, 1191));
|
|
page.Rotate = 90;
|
|
|
|
PdfScrub.ScrubDegenerateCropBoxes(doc);
|
|
|
|
Assert.Null(page.Elements["/CropBox"]);
|
|
}
|
|
|
|
[Fact]
|
|
public void ScrubDegenerateCropBoxes_PreservesValidInsetCrop()
|
|
{
|
|
using var doc = new PdfDocument();
|
|
var page = doc.AddPage();
|
|
page.MediaBox = new PdfRectangle(new XPoint(0, 0), new XPoint(612, 792));
|
|
page.CropBox = new PdfRectangle(new XPoint(18, 24), new XPoint(594, 768));
|
|
|
|
PdfScrub.ScrubDegenerateCropBoxes(doc);
|
|
|
|
Assert.NotNull(page.Elements["/CropBox"]);
|
|
}
|
|
}
|