public void TestGetDocumentMetaInfo_on_doc1() { string pdf_filename = MiscTestHelpers.GetNormalizedPathToAnyTestDataTestFile(@"fixtures/1.Doc-Many.Metadata.Formats/0001-LDA-paper/2004.04.PNAS.ef997ae1b01762b57b75d8c22fb8cec87406.pdf"); ASSERT.FileExists(pdf_filename); PDFDocumentMuPDFMetaInfo info = MuPDFRenderer.GetDocumentMetaInfo(pdf_filename, null, ProcessPriorityClass.Normal); ASSERT.AreEqual <int>(8, info.PageCount); ASSERT.AreEqual <bool>(false, info.DocumentIsCorrupted); ASSERT.IsLessOrEqual(10000, info.raw_multipurp_text.Length); TestJSONoutputIsCorrectForPDFdoc1(info.raw_decoded_json); object json_doc = JsonConvert.DeserializeObject(info.raw_multipurp_text); string json_text = JsonConvert.SerializeObject(json_doc, Formatting.Indented).Replace("\r\n", "\n"); // Perform comparison via ApprovalTests->BeyondCompare (that's what I use for *decades* now) //ApprovalTests.Approvals.VerifyJson(json_out); --> becomes the code below: ApprovalTests.Approvals.Verify( new QiqqaApprover(json_text, pdf_filename), ApprovalTests.Approvals.GetReporter() ); info.ClearRawContent(); ASSERT.IsNull(info.raw_multipurp_text); ASSERT.IsNull(info.raw_decoded_json); }
public void TestMuPDF_multipurp_JSON_formatted_snippet1_parses_okay() { string json_filename = MiscTestHelpers.GetNormalizedPathToAnyTestDataTestFile(@"fixtures/mutool/multipurp/json-snippets/pdf-info1-formatted.json"); ASSERT.FileExists(json_filename); string json = File.ReadAllText(json_filename); ASSERT.IsNotNull(json); List <MultiPurpDocumentInfoObject> infos_list = JsonConvert.DeserializeObject <List <MultiPurpDocumentInfoObject> >(json); TestJSONoutputIsCorrectForPDFdoc1(infos_list); }
public void Test_PDF_metadata_extraction_via_multipurp_chunk0070_qpdf(string filepath) { string pdf_filename = MiscTestHelpers.GetNormalizedPathToAnyTestDataTestFile($"fixtures/PDF/{ filepath.Replace("./", "") }"); ASSERT.FileExists(pdf_filename); PDFDocumentMuPDFMetaInfo info = MuPDFRenderer.GetDocumentMetaInfo(pdf_filename, null, ProcessPriorityClass.Normal); string json_text = ProduceJSONtext4Comparison(info); // Perform comparison via ApprovalTests->BeyondCompare (that's what I use for *decades* now) //ApprovalTests.Approvals.VerifyJson(json_out); --> becomes the code below: ApprovalTests.Approvals.Verify( new QiqqaApprover(json_text, pdf_filename), ApprovalTests.Approvals.GetReporter() ); }