Skip to content

Commit

Permalink
add exif browser tests
Browse files Browse the repository at this point in the history
incorrect now, correct after we merge #2296
  • Loading branch information
chearon authored and zbjornson committed Sep 26, 2024
1 parent ba89686 commit 2db6f49
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 0 deletions.
Binary file added test/fixtures/exif-orientation-f1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/fixtures/exif-orientation-f2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/fixtures/exif-orientation-f3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/fixtures/exif-orientation-f4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/fixtures/exif-orientation-f5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/fixtures/exif-orientation-f6.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/fixtures/exif-orientation-f7.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/fixtures/exif-orientation-f8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/fixtures/exif-orientation-fi.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/fixtures/exif-orientation-fm.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/fixtures/exif-orientation-fn.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions test/public/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2752,3 +2752,42 @@ tests['transformed drawimage'] = function (ctx) {
ctx.transform(1.2, 1, 1.8, 1.3, 0, 0)
ctx.drawImage(ctx.canvas, 0, 0)
}

// https://github.com/noell/jpg-exif-test-images
for (let n = 1; n <= 8; n++) {
tests[`exif orientation ${n}`] = function (ctx, done) {
const img = new Image()
img.onload = function () {
ctx.drawImage(img, 0, 0)
done()
}
img.src = imageSrc(`exif-orientation-f${n}.jpg`)
}
}

tests['invalid exif orientation 9'] = function (ctx, done) {
const img = new Image()
img.onload = function () {
ctx.drawImage(img, 0, 0)
done()
}
img.src = imageSrc(`exif-orientation-fi.jpg`)
}

tests['two exif orientations, value 1 and value 2'] = function (ctx, done) {
const img = new Image()
img.onload = function () {
ctx.drawImage(img, 0, 0)
done()
}
img.src = imageSrc(`exif-orientation-fm.jpg`)
}

tests['no exif orientation'] = function (ctx, done) {
const img = new Image()
img.onload = function () {
ctx.drawImage(img, 0, 0)
done()
}
img.src = imageSrc(`exif-orientation-fn.jpg`)
}

0 comments on commit 2db6f49

Please sign in to comment.