- 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.
53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
using MmdPdf.Services;
|
|
using Xunit;
|
|
|
|
namespace MmdPdf.Tests
|
|
{
|
|
public class SearchServiceTests
|
|
{
|
|
private readonly SearchService _svc = new();
|
|
|
|
[Fact]
|
|
public void Search_EmptyQuery_ReturnsEmpty()
|
|
{
|
|
var result = _svc.Search("irrelevant.pdf", "");
|
|
Assert.Empty(result.ResultPages);
|
|
Assert.Equal(0, result.TotalHits);
|
|
}
|
|
|
|
[Fact]
|
|
public void Search_WhitespaceQuery_ReturnsEmpty()
|
|
{
|
|
var result = _svc.Search("irrelevant.pdf", " ");
|
|
Assert.Empty(result.ResultPages);
|
|
Assert.Equal(0, result.TotalHits);
|
|
}
|
|
|
|
[Fact]
|
|
public void Search_EmptyFilePath_ReturnsEmpty()
|
|
{
|
|
var result = _svc.Search("", "hello");
|
|
Assert.Empty(result.ResultPages);
|
|
Assert.Equal(0, result.TotalHits);
|
|
}
|
|
|
|
[Fact]
|
|
public void Search_MissingFile_ReturnsEmpty()
|
|
{
|
|
// Should not throw; non-existent file produces no results.
|
|
var result = _svc.Search(@"C:\does\not\exist.pdf", "hello");
|
|
Assert.Empty(result.ResultPages);
|
|
Assert.Equal(0, result.TotalHits);
|
|
}
|
|
|
|
[Fact]
|
|
public void SearchResult_PageRects_EmptyByDefault()
|
|
{
|
|
var result = new SearchResult();
|
|
Assert.Empty(result.PageRects);
|
|
Assert.Empty(result.ResultPages);
|
|
Assert.Equal(0, result.TotalHits);
|
|
}
|
|
}
|
|
}
|