Skip to content

Commit

Permalink
add macos references
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Jul 23, 2022
1 parent 2e3e488 commit b8fca6a
Show file tree
Hide file tree
Showing 50 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
"scripts": {
"build": "node tasks/prepare-binaries.js",
"test": "npm run test:smoke && npm run test:js",
"test:smoke": "./bin/asciidoctor-pdf --version",
"test:smoke": "./bin/asciidoctor-web-pdf --version",
"test:js": "mocha test/**_test.js",
"lint": "standard lib/**.js test/**.js tasks/**js",
"publish": "node tasks/publish.js",
"test:update-reference": "docker build -f test/Dockerfile -t asciidoctor-web-pdf/test . && docker run --name asciidoctorwebpdftest asciidoctor-web-pdf/test:latest && docker cp asciidoctorwebpdftest:/app/test/output ./test/reference/"
"test:update-linux-reference": "docker build -f test/Dockerfile -t asciidoctor-web-pdf/test . && docker run --name asciidoctorwebpdftest asciidoctor-web-pdf/test:latest && docker cp asciidoctorwebpdftest:/app/test/output ./test/reference/linux/"
},
"repository": {
"type": "git",
Expand Down
6 changes: 4 additions & 2 deletions test/helper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const ospath = require('path')
const fs = require('fs')
const os = require('os')
const childProcess = require('child_process')
const PNG = require('pngjs').PNG
const pixelmatch = require('pixelmatch')
Expand All @@ -23,11 +24,12 @@ function computeImageDifferences (referenceBuffer, actualBuffer, diffFilename) {
}

function toVisuallyMatch (referenceFilename, actualPath) {
const platform = os.platform() === 'darwin' ? 'macos' : 'linux'
let referencePath
if (ospath.isAbsolute(referenceFilename)) {
referencePath = referenceFilename
} else {
referencePath = ospath.join(__dirname, 'reference', referenceFilename)
referencePath = ospath.join(__dirname, 'reference', platform, referenceFilename)
}

if (!fs.existsSync(actualPath)) {
Expand All @@ -45,7 +47,7 @@ function toVisuallyMatch (referenceFilename, actualPath) {
let pixels = 0
const tmpFiles = [actualPath]

const currentFilenameRegexp = new RegExp(`${actualBasename}-(?:actual|reference)-([0-9]+).png`)
const currentFilenameRegexp = new RegExp(`${actualBasename}-(?:actual|reference)-(\\d+).png`)
const files = fs.readdirSync(imagesOutputDir)
const indexes = new Set(files
.filter((name) => name.match(currentFilenameRegexp))
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added test/reference/macos/document-with-counters.pdf
Binary file not shown.
Binary file added test/reference/macos/document-with-left-toc.pdf
Binary file not shown.
Binary file not shown.
Binary file added test/reference/macos/document-with-stem.pdf
Binary file not shown.
Binary file added test/reference/macos/list.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added test/reference/macos/repeat-table-elements.pdf
Binary file not shown.
Binary file not shown.

0 comments on commit b8fca6a

Please sign in to comment.