Changeset 52269 for trunk/tests/phpunit/tests/image/meta.php
- Timestamp:
- 11/29/2021 07:34:51 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/image/meta.php
r52010 r52269 33 33 $out = wp_read_image_metadata( DIR_TESTDATA . '/images/2004-07-22-DSC_0008.jpg' ); 34 34 35 $this->assertEquals( 6.3, $out['aperture'] );36 $this->assertSame( '', $out['credit'] );37 $this->assertSame( 'NIKON D70', $out['camera'] );38 $this->assertSame( '', $out['caption'] );39 $this->assertEquals( strtotime( '2004-07-22 17:14:59' ), $out['created_timestamp'] );40 $this->assertSame( '', $out['copyright'] );41 $this->assertEquals( 27, $out['focal_length'] );42 $this->assertEquals( 400, $out['iso'] );43 $this->assertEquals( 1 / 40, $out['shutter_speed'] );44 $this->assertSame( '', $out['title'] );35 $this->assertEquals( 6.3, $out['aperture'], 'Aperture value not equivalent' ); 36 $this->assertSame( '', $out['credit'], 'Credit value not the same' ); 37 $this->assertSame( 'NIKON D70', $out['camera'], 'Camera value not the same' ); 38 $this->assertSame( '', $out['caption'], 'Caption value not the same' ); 39 $this->assertEquals( strtotime( '2004-07-22 17:14:59' ), $out['created_timestamp'], 'Timestamp value not equivalent' ); 40 $this->assertSame( '', $out['copyright'], 'Copyright value not the same' ); 41 $this->assertEquals( 27, $out['focal_length'], 'Focal length value not equivalent' ); 42 $this->assertEquals( 400, $out['iso'], 'Iso value not equivalent' ); 43 $this->assertEquals( 1 / 40, $out['shutter_speed'], 'Shutter speed value not equivalent' ); 44 $this->assertSame( '', $out['title'], 'Title value not the same' ); 45 45 } 46 46 … … 49 49 $out = wp_read_image_metadata( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG' ); 50 50 51 $this->assertSame( '0', $out['aperture'] );52 $this->assertSame( '', $out['credit'] );53 $this->assertSame( 'NIKON D70', $out['camera'] );54 $this->assertSame( '', $out['caption'] );55 $this->assertEquals( strtotime( '2007-06-17 21:18:00' ), $out['created_timestamp'] );56 $this->assertSame( '', $out['copyright'] );57 $this->assertEquals( 0, $out['focal_length'] );58 $this->assertEquals( 0, $out['iso'] ); // Interesting - a Nikon bug?59 $this->assertEquals( 1 / 500, $out['shutter_speed'] );60 $this->assertSame( '', $out['title'] );51 $this->assertSame( '0', $out['aperture'], 'Aperture value not the same' ); 52 $this->assertSame( '', $out['credit'], 'Credit value not the same' ); 53 $this->assertSame( 'NIKON D70', $out['camera'], 'Camera value not the same' ); 54 $this->assertSame( '', $out['caption'], 'Caption value not the same' ); 55 $this->assertEquals( strtotime( '2007-06-17 21:18:00' ), $out['created_timestamp'], 'Timestamp value not equivalent' ); 56 $this->assertSame( '', $out['copyright'], 'Copyright value not the same' ); 57 $this->assertEquals( 0, $out['focal_length'], 'Focal length value not equivalent' ); 58 $this->assertEquals( 0, $out['iso'], 'Iso value not equivalent' ); // Interesting - a Nikon bug? 59 $this->assertEquals( 1 / 500, $out['shutter_speed'], 'Shutter speed value not equivalent' ); 60 $this->assertSame( '', $out['title'], 'Title value not the same' ); 61 61 // $this->assertSame( array( 'Flowers' ), $out['keywords'] ); 62 62 } … … 66 66 $out = wp_read_image_metadata( DIR_TESTDATA . '/images/2004-07-22-DSC_0007.jpg' ); 67 67 68 $this->assertEquals( 6.3, $out['aperture'] );69 $this->assertSame( 'IPTC Creator', $out['credit'] );70 $this->assertSame( 'NIKON D70', $out['camera'] );71 $this->assertSame( 'IPTC Caption', $out['caption'] );72 $this->assertEquals( strtotime( '2004-07-22 17:14:35' ), $out['created_timestamp'] );73 $this->assertSame( 'IPTC Copyright', $out['copyright'] );74 $this->assertEquals( 18, $out['focal_length'] );75 $this->assertEquals( 200, $out['iso'] );76 $this->assertEquals( 1 / 25, $out['shutter_speed'] );77 $this->assertSame( 'IPTC Headline', $out['title'] );68 $this->assertEquals( 6.3, $out['aperture'], 'Aperture value not equivalent' ); 69 $this->assertSame( 'IPTC Creator', $out['credit'], 'Credit value not the same' ); 70 $this->assertSame( 'NIKON D70', $out['camera'], 'Camera value not the same' ); 71 $this->assertSame( 'IPTC Caption', $out['caption'], 'Caption value not the same' ); 72 $this->assertEquals( strtotime( '2004-07-22 17:14:35' ), $out['created_timestamp'], 'Timestamp value not equivalent' ); 73 $this->assertSame( 'IPTC Copyright', $out['copyright'], 'Copyright value not the same' ); 74 $this->assertEquals( 18, $out['focal_length'], 'Focal length value not equivalent' ); 75 $this->assertEquals( 200, $out['iso'], 'Iso value not equivalent' ); 76 $this->assertEquals( 1 / 25, $out['shutter_speed'], 'Shutter speed value not equivalent' ); 77 $this->assertSame( 'IPTC Headline', $out['title'], 'Title value not the same' ); 78 78 } 79 79 … … 82 82 $out = wp_read_image_metadata( DIR_TESTDATA . '/images/a2-small.jpg' ); 83 83 84 $this->assertEquals( 4.5, $out['aperture'] ); 85 $this->assertSame( '', $out['credit'] ); 86 $this->assertSame( 'FinePix S5600', $out['camera'] ); 87 $this->assertSame( '', $out['caption'] ); 88 $this->assertEquals( strtotime( '2007-09-03 10:17:03' ), $out['created_timestamp'] ); 89 $this->assertSame( '', $out['copyright'] ); 90 $this->assertEquals( 6.3, $out['focal_length'] ); 91 $this->assertEquals( 64, $out['iso'] ); 92 $this->assertEquals( 1 / 320, $out['shutter_speed'] ); 93 $this->assertSame( '', $out['title'] ); 94 84 $this->assertEquals( 4.5, $out['aperture'], 'Aperture value not equivalent' ); 85 $this->assertSame( '', $out['credit'], 'Credit value not the same' ); 86 $this->assertSame( 'FinePix S5600', $out['camera'], 'Camera value not the same' ); 87 $this->assertSame( '', $out['caption'], 'Caption value not the same' ); 88 $this->assertEquals( strtotime( '2007-09-03 10:17:03' ), $out['created_timestamp'], 'Timestamp value not equivalent' ); 89 $this->assertSame( '', $out['copyright'], 'Copyright value not the same' ); 90 $this->assertEquals( 6.3, $out['focal_length'], 'Focal length value not equivalent' ); 91 $this->assertEquals( 64, $out['iso'], 'Iso value not equivalent' ); 92 $this->assertEquals( 1 / 320, $out['shutter_speed'], 'Shutter speed value not equivalent' ); 93 $this->assertSame( '', $out['title'], 'Title value not the same' ); 95 94 } 96 95 … … 103 102 $out = wp_read_image_metadata( DIR_TESTDATA . '/images/waffles.jpg' ); 104 103 105 $this->assertEquals( 0, $out['aperture'] );106 $this->assertSame( '', $out['credit'] );107 $this->assertSame( '', $out['camera'] );108 $this->assertSame( '', $out['caption'] );109 $this->assertEquals( 0, $out['created_timestamp'] );110 $this->assertSame( '', $out['copyright'] );111 $this->assertEquals( 0, $out['focal_length'] );112 $this->assertEquals( 0, $out['iso'] );113 $this->assertEquals( 0, $out['shutter_speed'] );114 $this->assertSame( '', $out['title'] );104 $this->assertEquals( 0, $out['aperture'], 'Aperture value not equivalent' ); 105 $this->assertSame( '', $out['credit'], 'Credit value not the same' ); 106 $this->assertSame( '', $out['camera'], 'Camera value not the same' ); 107 $this->assertSame( '', $out['caption'], 'Caption value not the same' ); 108 $this->assertEquals( 0, $out['created_timestamp'], 'Timestamp value not equivalent' ); 109 $this->assertSame( '', $out['copyright'], 'Copyright value not the same' ); 110 $this->assertEquals( 0, $out['focal_length'], 'Focal length value not equivalent' ); 111 $this->assertEquals( 0, $out['iso'], 'Iso value not equivalent' ); 112 $this->assertEquals( 0, $out['shutter_speed'], 'Shutter speed value not equivalent' ); 113 $this->assertSame( '', $out['title'], 'Title value not the same' ); 115 114 } 116 115 … … 119 118 $out = wp_read_image_metadata( DIR_TESTDATA . '/images/canola.jpg' ); 120 119 121 $this->assertEquals( 0, $out['aperture'] );122 $this->assertSame( '', $out['credit'] );123 $this->assertSame( '', $out['camera'] );124 $this->assertSame( '', $out['caption'] );125 $this->assertEquals( 0, $out['created_timestamp'] );126 $this->assertSame( '', $out['copyright'] );127 $this->assertEquals( 0, $out['focal_length'] );128 $this->assertEquals( 0, $out['iso'] );129 $this->assertEquals( 0, $out['shutter_speed'] );130 $this->assertSame( '', $out['title'] );120 $this->assertEquals( 0, $out['aperture'], 'Aperture value not equivalent' ); 121 $this->assertSame( '', $out['credit'], 'Credit value not the same' ); 122 $this->assertSame( '', $out['camera'], 'Camera value not the same' ); 123 $this->assertSame( '', $out['caption'], 'Caption value not the same' ); 124 $this->assertEquals( 0, $out['created_timestamp'], 'Timestamp value not equivalent' ); 125 $this->assertSame( '', $out['copyright'], 'Copyright value not the same' ); 126 $this->assertEquals( 0, $out['focal_length'], 'Focal length value not equivalent' ); 127 $this->assertEquals( 0, $out['iso'], 'Iso value not equivalent' ); 128 $this->assertEquals( 0, $out['shutter_speed'], 'Shutter speed value not equivalent' ); 129 $this->assertSame( '', $out['title'], 'Title value not the same' ); 131 130 } 132 131 … … 156 155 $out = wp_read_image_metadata( DIR_TESTDATA . '/images/33772.jpg' ); 157 156 158 $this->assertSame( '8', $out['aperture'] );159 $this->assertSame( 'Photoshop Author', $out['credit'] );160 $this->assertSame( 'DMC-LX2', $out['camera'] );161 $this->assertSame( 'Photoshop Description', $out['caption'] );162 $this->assertEquals( 1306315327, $out['created_timestamp'] );163 $this->assertSame( 'Photoshop Copyrright Notice', $out['copyright'] );164 $this->assertSame( '6.3', $out['focal_length'] );165 $this->assertSame( '100', $out['iso'] );166 $this->assertSame( '0.0025', $out['shutter_speed'] );167 $this->assertSame( 'Photoshop Document Ttitle', $out['title'] );168 $this->assertEquals( 1, $out['orientation'] );169 $this->assertSame( array( 'beach', 'baywatch', 'LA', 'sunset' ), $out['keywords'] );157 $this->assertSame( '8', $out['aperture'], 'Aperture value not the same' ); 158 $this->assertSame( 'Photoshop Author', $out['credit'], 'Credit value not the same' ); 159 $this->assertSame( 'DMC-LX2', $out['camera'], 'Camera value not the same' ); 160 $this->assertSame( 'Photoshop Description', $out['caption'], 'Caption value not the same' ); 161 $this->assertEquals( 1306315327, $out['created_timestamp'], 'Timestamp value not equivalent' ); 162 $this->assertSame( 'Photoshop Copyrright Notice', $out['copyright'], 'Copyright value not the same' ); 163 $this->assertSame( '6.3', $out['focal_length'], 'Focal length value not the same' ); 164 $this->assertSame( '100', $out['iso'], 'Iso value not the same' ); 165 $this->assertSame( '0.0025', $out['shutter_speed'], 'Shutter speed value not the same' ); 166 $this->assertSame( 'Photoshop Document Ttitle', $out['title'], 'Title value not the same' ); 167 $this->assertEquals( 1, $out['orientation'], 'Orientation value not equivalent' ); 168 $this->assertSame( array( 'beach', 'baywatch', 'LA', 'sunset' ), $out['keywords'], 'Keywords not the same' ); 170 169 } 171 170 … … 240 239 ); 241 240 } 241 242 /** 243 * @ticket 54385 244 */ 245 public function test_exif_unexpected_data() { 246 // Unexpected Exif data: FNumber is "0/0", aperture should be 0. 247 $out = wp_read_image_metadata( DIR_TESTDATA . '/images/sugarloaf-mountain.jpg' ); 248 249 $this->assertEquals( 0, $out['aperture'], 'Aperture value not equivalent' ); 250 $this->assertSame( '', $out['credit'], 'Credit value not the same' ); 251 $this->assertSame( 'X-T1', $out['camera'], 'Camera value not the same' ); 252 $this->assertSame( '', $out['caption'], 'Caption value not the same' ); 253 $this->assertEquals( 0, $out['created_timestamp'], 'Timestamp value not equivalent' ); 254 $this->assertSame( '', $out['copyright'], 'Copyright value not the same' ); 255 $this->assertEquals( 50, $out['focal_length'], 'Focal length value not equivalent' ); 256 $this->assertEquals( 200, $out['iso'], 'Iso value not equivalent' ); 257 $this->assertEquals( 2, $out['shutter_speed'], 'Shutter speed value not equivalent' ); 258 $this->assertSame( 'Sugarloaf Panorama', $out['title'], 'Title value not the same' ); 259 } 242 260 }
Note: See TracChangeset
for help on using the changeset viewer.