Skip to content

Commit 2db6f49

Browse files
chearonzbjornson
authored andcommitted
add exif browser tests
incorrect now, correct after we merge #2296
1 parent ba89686 commit 2db6f49

12 files changed

+39
-0
lines changed

test/fixtures/exif-orientation-f1.jpg

3 KB
Loading

test/fixtures/exif-orientation-f2.jpg

3 KB
Loading

test/fixtures/exif-orientation-f3.jpg

3 KB
Loading

test/fixtures/exif-orientation-f4.jpg

3 KB
Loading

test/fixtures/exif-orientation-f5.jpg

3 KB
Loading

test/fixtures/exif-orientation-f6.jpg

3 KB
Loading

test/fixtures/exif-orientation-f7.jpg

3 KB
Loading

test/fixtures/exif-orientation-f8.jpg

3 KB
Loading

test/fixtures/exif-orientation-fi.jpg

3 KB
Loading

test/fixtures/exif-orientation-fm.jpg

3.02 KB
Loading

test/fixtures/exif-orientation-fn.jpg

2.97 KB
Loading

test/public/tests.js

+39
Original file line numberDiff line numberDiff line change
@@ -2752,3 +2752,42 @@ tests['transformed drawimage'] = function (ctx) {
27522752
ctx.transform(1.2, 1, 1.8, 1.3, 0, 0)
27532753
ctx.drawImage(ctx.canvas, 0, 0)
27542754
}
2755+
2756+
// https://github.com/noell/jpg-exif-test-images
2757+
for (let n = 1; n <= 8; n++) {
2758+
tests[`exif orientation ${n}`] = function (ctx, done) {
2759+
const img = new Image()
2760+
img.onload = function () {
2761+
ctx.drawImage(img, 0, 0)
2762+
done()
2763+
}
2764+
img.src = imageSrc(`exif-orientation-f${n}.jpg`)
2765+
}
2766+
}
2767+
2768+
tests['invalid exif orientation 9'] = function (ctx, done) {
2769+
const img = new Image()
2770+
img.onload = function () {
2771+
ctx.drawImage(img, 0, 0)
2772+
done()
2773+
}
2774+
img.src = imageSrc(`exif-orientation-fi.jpg`)
2775+
}
2776+
2777+
tests['two exif orientations, value 1 and value 2'] = function (ctx, done) {
2778+
const img = new Image()
2779+
img.onload = function () {
2780+
ctx.drawImage(img, 0, 0)
2781+
done()
2782+
}
2783+
img.src = imageSrc(`exif-orientation-fm.jpg`)
2784+
}
2785+
2786+
tests['no exif orientation'] = function (ctx, done) {
2787+
const img = new Image()
2788+
img.onload = function () {
2789+
ctx.drawImage(img, 0, 0)
2790+
done()
2791+
}
2792+
img.src = imageSrc(`exif-orientation-fn.jpg`)
2793+
}

0 commit comments

Comments
 (0)