PDF Metadata Support (#3552)
Co-authored-by: Matthias Neeracher <microtherion@gmail.com>
This commit is contained in:
parent
56108eb373
commit
f76de42b28
24 changed files with 1949 additions and 57 deletions
|
|
@ -81,4 +81,47 @@ public class BookServiceTests
|
|||
Assert.Equal("Accel World", comicInfo.Series);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ShouldHaveComicInfoForPdf()
|
||||
{
|
||||
var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/BookService");
|
||||
var document = Path.Join(testDirectory, "test.pdf");
|
||||
var comicInfo = _bookService.GetComicInfo(document);
|
||||
Assert.NotNull(comicInfo);
|
||||
Assert.Equal("Variations Chromatiques de concert", comicInfo.Title);
|
||||
Assert.Equal("Georges Bizet \\(1838-1875\\)", comicInfo.Writer);
|
||||
}
|
||||
|
||||
// TODO: Get the file from microtherion
|
||||
// [Fact]
|
||||
// public void ShouldUsePdfInfoDict()
|
||||
// {
|
||||
// var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/ScannerService/Library/Books/PDFs");
|
||||
// var document = Path.Join(testDirectory, "Rollo at Work SP01.pdf");
|
||||
// var comicInfo = _bookService.GetComicInfo(document);
|
||||
// Assert.NotNull(comicInfo);
|
||||
// Assert.Equal("Rollo at Work", comicInfo.Title);
|
||||
// Assert.Equal("Jacob Abbott", comicInfo.Writer);
|
||||
// Assert.Equal(2008, comicInfo.Year);
|
||||
// }
|
||||
|
||||
[Fact]
|
||||
public void ShouldHandleIndirectPdfObjects()
|
||||
{
|
||||
var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/BookService");
|
||||
var document = Path.Join(testDirectory, "indirect.pdf");
|
||||
var comicInfo = _bookService.GetComicInfo(document);
|
||||
Assert.NotNull(comicInfo);
|
||||
Assert.Equal(2018, comicInfo.Year);
|
||||
Assert.Equal(8, comicInfo.Month);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FailGracefullyWithEncryptedPdf()
|
||||
{
|
||||
var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/BookService");
|
||||
var document = Path.Join(testDirectory, "encrypted.pdf");
|
||||
var comicInfo = _bookService.GetComicInfo(document);
|
||||
Assert.Null(comicInfo);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue