@@ -2752,3 +2752,42 @@ tests['transformed drawimage'] = function (ctx) {
2752
2752
ctx . transform ( 1.2 , 1 , 1.8 , 1.3 , 0 , 0 )
2753
2753
ctx . drawImage ( ctx . canvas , 0 , 0 )
2754
2754
}
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