Repository navigation
Run the font tests as layers in layer mode - #95
Merged
Merged
Conversation
Layer mode only made layers of files a test opens, so most font tests, which build their PDFs in memory, never ran on a layer. EmbedderTest::OpenDocumentFromMemory() and embedpdf_test::LoadMemDocumentForTest() take in-memory documents through the same path, and the font, ActualText and last-resort tests use them. New layer tests cover a font written, saved and reopened over its base, and a write to a font's widths. A display program only a changed font dictionary read is now forgotten, so its hash finds nothing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #93. Layer mode (
EPDF_EMBEDDER_LAYER_MODE=1) only made layers of files a test opens withOpenDocument(). Most font tests build their PDFs in memory or start fromCreateEmptyDocument(), so they never ran on a layer with the read-only check and the layer DCHECKs on.What changes
EmbedderTest::OpenDocumentFromMemory()opens bytes the wayOpenDocument()opens a file;embedpdf_test::LoadMemDocumentForTest()withScopedTestDocumentdoes the same for a document a test keeps itself, and reports what it left in the layer when it closes;EmptyPdf()replacesCreateEmptyDocument()for tests that write into a new document;LayerFixture::SaveDelta()saves a layer's changes forReopen().APlainDocumentIsWalkedWholeEachTimestays plain on purpose);/ActualTexttests;AFontWrittenOnALayerReadsTheSameReopened: a font written on a layer, saved, then reopened from its delta lists, serves and resolves the same, and reading it copies nothing into the layer.AWriteToAFontsWidthsGivesItANewDisplayProgram: a write to an existing font's/Widthsshows a new display program in a list during the write; an abort brings the old one back and a commit keeps the new one.CPDF_DocumentFonts::Forget: a display program that only a changed font dictionary read stayed fetchable by its old hash. It is now dropped, so the hash finds nothing.ExpectDisplayProgramDrawsTheKeptFontread the font dictionary throughGetMutableRoot(), which copied the catalog into the layer. It now reads const, as the runtime's read path does.testing/embedpdf_layer_mode_writers.txt, includingEPDFFormEmbedderTest.NewFieldAppearanceIsAFormXObjectfrom Read, write and draw with a document's own fonts #93.layer-moderule now says how an in-memory test document gets into layer mode.Testing (macOS arm64, debug)
/ActualTextand last-resort tests pass on plain documents.run_layer_mode.pyover the 128 font-related tests: all pass, and every read-only font test leaves 0 objects in its layer.run_layer_mode.pyover 1740 tests: no new layer-only failures.testing/embedpdf_layer_mode_expectations.txt.EPDFSignatureEmbedderTest.SignEncryptedDocument, which is local-only: its fixture is untracked, so the test skips on CI.embedpdf/main.pdfium_unittests: 1312 pass.check-fork-tags.py --strictandcheck-c-api.pypass.The Linux Docker suites and layer mode run in CI.