diff --git a/src/__snapshots__/text-not-captured.png b/src/__snapshots__/text-not-captured.png new file mode 100644 index 0000000..bea8ea7 Binary files /dev/null and b/src/__snapshots__/text-not-captured.png differ diff --git a/src/compare-pdf-to-snapshot.test.ts b/src/compare-pdf-to-snapshot.test.ts index dd4e4cb..6c505cd 100644 --- a/src/compare-pdf-to-snapshot.test.ts +++ b/src/compare-pdf-to-snapshot.test.ts @@ -20,6 +20,7 @@ const singlePageSmallPdfPath = join(pdfs, 'single-page-small.pdf') const singlePagePdfPath = join(pdfs, 'single-page.pdf') const barcodes1PdfPath = join(pdfs, 'barcodes-1.pdf') const twoPagePdfPath = join(pdfs, 'two-page.pdf') +const textNotCapturedPdfPath = join(pdfs, 'text-not-captured.pdf') // Tolerance for cross-platform font rendering differences // Snapshots are generated on Linux, so use strict tolerance there @@ -272,6 +273,19 @@ describe('comparePdfToSnapshot()', () => { }) }) + describe('text rendering', () => { + it('should capture text in snapshot', async () => { + const snapshotName = 'text-not-captured' + const snapshotPath = join(__dirname, SNAPSHOTS_DIR_NAME, `${snapshotName}.png`) + + await removeIfExists(snapshotPath) + + const isEqual = await comparePdfToSnapshot(textNotCapturedPdfPath, __dirname, snapshotName) + assert.strictEqual(isEqual, true) + assert.strictEqual(await fileExists(snapshotPath), true) + }) + }) + describe('github issue', () => { // TODO: Investigate why this test fails on Windows/macOS and fix the underlying issue it( diff --git a/src/test-data/pdfs/text-not-captured.pdf b/src/test-data/pdfs/text-not-captured.pdf new file mode 100644 index 0000000..4416489 Binary files /dev/null and b/src/test-data/pdfs/text-not-captured.pdf differ