0640dc44f05ae3701a61bd9e32925e6b21501194
[yaffs-website] / test / image-tests / CanonPowershotS60Test.php
1 <?php
2
3 /*
4  * PEL: PHP Exif Library. A library with support for reading and
5  * writing all Exif headers in JPEG and TIFF images using PHP.
6  *
7  * Copyright (C) 2005, 2006 Martin Geisler.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program in the file COPYING; if not, write to the
21  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
22  * Boston, MA 02110-1301 USA
23  */
24
25 use lsolesen\pel\Pel;
26 use lsolesen\pel\PelJpeg;
27
28 class CanonPowershotS60Test extends \PHPUnit_Framework_TestCase
29 {
30     public function testRead()
31     {
32         Pel::clearExceptions();
33         Pel::setStrictParsing(false);
34         $jpeg = new PelJpeg(dirname(__FILE__) . '/canon-powershot-s60.jpg');
35
36         $exif = $jpeg->getExif();
37         $this->assertInstanceOf('lsolesen\pel\PelExif', $exif);
38
39         $tiff = $exif->getTiff();
40         $this->assertInstanceOf('lsolesen\pel\PelTiff', $tiff);
41
42         /* The first IFD. */
43         $ifd0 = $tiff->getIfd();
44         $this->assertInstanceOf('lsolesen\pel\PelIfd', $ifd0);
45
46         /* Start of IDF $ifd0. */
47         $this->assertEquals(count($ifd0->getEntries()), 8);
48
49         $entry = $ifd0->getEntry(271); // Make
50         $this->assertInstanceOf('lsolesen\pel\PelEntryAscii', $entry);
51         $this->assertEquals($entry->getValue(), 'Canon');
52         $this->assertEquals($entry->getText(), 'Canon');
53
54         $entry = $ifd0->getEntry(272); // Model
55         $this->assertInstanceOf('lsolesen\pel\PelEntryAscii', $entry);
56         $this->assertEquals($entry->getValue(), 'Canon PowerShot S60');
57         $this->assertEquals($entry->getText(), 'Canon PowerShot S60');
58
59         $entry = $ifd0->getEntry(274); // Orientation
60         $this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
61         $this->assertEquals($entry->getValue(), 1);
62         $this->assertEquals($entry->getText(), 'top - left');
63
64         $entry = $ifd0->getEntry(282); // XResolution
65         $this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
66         $this->assertEquals($entry->getValue(), array(
67             0 => 180,
68             1 => 1
69         ));
70         $this->assertEquals($entry->getText(), '180/1');
71
72         $entry = $ifd0->getEntry(283); // YResolution
73         $this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
74         $this->assertEquals($entry->getValue(), array(
75             0 => 180,
76             1 => 1
77         ));
78         $this->assertEquals($entry->getText(), '180/1');
79
80         $entry = $ifd0->getEntry(296); // ResolutionUnit
81         $this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
82         $this->assertEquals($entry->getValue(), 2);
83         $this->assertEquals($entry->getText(), 'Inch');
84
85         $entry = $ifd0->getEntry(306); // DateTime
86         $this->assertInstanceOf('lsolesen\pel\PelEntryTime', $entry);
87         $this->assertEquals($entry->getValue(), 1097316018);
88         $this->assertEquals($entry->getText(), '2004:10:09 10:00:18');
89
90         $entry = $ifd0->getEntry(531); // YCbCrPositioning
91         $this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
92         $this->assertEquals($entry->getValue(), 1);
93         $this->assertEquals($entry->getText(), 'centered');
94
95         /* Sub IFDs of $ifd0. */
96         $this->assertEquals(count($ifd0->getSubIfds()), 1);
97         $ifd0_0 = $ifd0->getSubIfd(2); // IFD Exif
98         $this->assertInstanceOf('lsolesen\pel\PelIfd', $ifd0_0);
99
100         /* Start of IDF $ifd0_0. */
101         $this->assertEquals(count($ifd0_0->getEntries()), 30);
102
103         $entry = $ifd0_0->getEntry(33434); // ExposureTime
104         $this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
105         $this->assertEquals($entry->getValue(), array(
106             0 => 1,
107             1 => 8
108         ));
109         $this->assertEquals($entry->getText(), '1/8 sec.');
110
111         $entry = $ifd0_0->getEntry(33437); // FNumber
112         $this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
113         $this->assertEquals($entry->getValue(), array(
114             0 => 53,
115             1 => 10
116         ));
117         $this->assertEquals($entry->getText(), 'f/5.3');
118
119         $entry = $ifd0_0->getEntry(36864); // ExifVersion
120         $this->assertInstanceOf('lsolesen\pel\PelEntryVersion', $entry);
121         $this->assertEquals($entry->getValue(), 2.2);
122         $this->assertEquals($entry->getText(), 'Exif Version 2.2');
123
124         $entry = $ifd0_0->getEntry(36867); // DateTimeOriginal
125         $this->assertInstanceOf('lsolesen\pel\PelEntryTime', $entry);
126         $this->assertEquals($entry->getValue(), 1097316018);
127         $this->assertEquals($entry->getText(), '2004:10:09 10:00:18');
128
129         $entry = $ifd0_0->getEntry(36868); // DateTimeDigitized
130         $this->assertInstanceOf('lsolesen\pel\PelEntryTime', $entry);
131         $this->assertEquals($entry->getValue(), 1097316018);
132         $this->assertEquals($entry->getText(), '2004:10:09 10:00:18');
133
134         $entry = $ifd0_0->getEntry(37121); // ComponentsConfiguration
135         $this->assertInstanceOf('lsolesen\pel\PelEntryUndefined', $entry);
136         $this->assertEquals($entry->getValue(), "\x01\x02\x03\0");
137         $this->assertEquals($entry->getText(), 'Y Cb Cr -');
138
139         $entry = $ifd0_0->getEntry(37122); // CompressedBitsPerPixel
140         $this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
141         $this->assertEquals($entry->getValue(), array(
142             0 => 2,
143             1 => 1
144         ));
145         $this->assertEquals($entry->getText(), '2/1');
146
147         $entry = $ifd0_0->getEntry(37377); // ShutterSpeedValue
148         $this->assertInstanceOf('lsolesen\pel\PelEntrySRational', $entry);
149         $this->assertEquals($entry->getValue(), array(
150             0 => 96,
151             1 => 32
152         ));
153         $this->assertEquals($entry->getText(), '96/32 sec. (APEX: 2)');
154
155         $entry = $ifd0_0->getEntry(37378); // ApertureValue
156         $this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
157         $this->assertEquals($entry->getValue(), array(
158             0 => 154,
159             1 => 32
160         ));
161         $this->assertEquals($entry->getText(), 'f/5.3');
162
163         $entry = $ifd0_0->getEntry(37380); // ExposureBiasValue
164         $this->assertInstanceOf('lsolesen\pel\PelEntrySRational', $entry);
165         $this->assertEquals($entry->getValue(), array(
166             0 => 0,
167             1 => 3
168         ));
169         $this->assertEquals($entry->getText(), '0.0');
170
171         $entry = $ifd0_0->getEntry(37381); // MaxApertureValue
172         $this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
173         $this->assertEquals($entry->getValue(), array(
174             0 => 154,
175             1 => 32
176         ));
177         $this->assertEquals($entry->getText(), '154/32');
178
179         $entry = $ifd0_0->getEntry(37383); // MeteringMode
180         $this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
181         $this->assertEquals($entry->getValue(), 5);
182         $this->assertEquals($entry->getText(), 'Pattern');
183
184         $entry = $ifd0_0->getEntry(37385); // Flash
185         $this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
186         $this->assertEquals($entry->getValue(), 16);
187         $this->assertEquals($entry->getText(), 'Flash did not fire, compulsory flash mode.');
188
189         $entry = $ifd0_0->getEntry(37386); // FocalLength
190         $this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
191         $this->assertEquals($entry->getValue(), array(
192             0 => 662,
193             1 => 32
194         ));
195         $this->assertEquals($entry->getText(), '20.7 mm');
196
197         $entry = $ifd0_0->getEntry(37500); // MakerNote
198         $this->assertInstanceOf('lsolesen\pel\PelEntryUndefined', $entry);
199         $expected = "\x11\0\x01\0\x03\0\x2e\0\0\0\x80\x04\0\0\x02\0\x03\0\x04\0\0\0\xdc\x04\0\0\x03\0\x03\0\x04\0\0\0\xe4\x04\0\0\x04\0\x03\0\x22\0\0\0\xec\x04\0\0\0\0\x03\0\x06\0\0\0\x30\x05\0\0\0\0\x03\0\x04\0\0\0\x3c\x05\0\0\x12\0\x03\0\x1c\0\0\0\x44\x05\0\0\x13\0\x03\0\x04\0\0\0\x7c\x05\0\0\x06\0\x02\0\x20\0\0\0\x84\x05\0\0\x07\0\x02\0\x18\0\0\0\xa4\x05\0\0\x08\0\x04\0\x01\0\0\0\x69\x42\x0f\0\x09\0\x02\0\x20\0\0\0\xbc\x05\0\0\x10\0\x04\0\x01\0\0\0\0\0\x39\x01\0\0\x03\0\x05\0\0\0\xdc\x05\0\0\x18\0\x01\0\0\x01\0\0\xe6\x05\0\0\x19\0\x03\0\x01\0\0\0\x01\0\0\0\x0d\0\x03\0\x24\0\0\0\xe6\x06\0\0\0\0\0\0\x5c\0\x02\0\0\0\x02\0\0\0\0\0\0\0\x04\0\0\0\x01\0\x02\0\0\0\0\0\0\0\0\0\0\0\x0f\0\x03\0\x01\0\x01\x40\0\0\xff\x7f\xff\xff\x96\x02\xba\0\x20\0\x9d\0\xc0\0\xff\xff\0\0\0\0\0\0\0\0\0\0\xff\xff\x35\0\x20\x0a\x20\x0a\0\0\0\0\0\0\0\0\xff\x7f\xff\x7f\0\0\0\0\x02\0\x96\x02\x22\x01\xd9\0\0\0\0\0\0\0\0\0\x44\0\x20\0\x80\0\x36\0\x9a\0\x60\0\0\0\0\0\0\0\0\0\x08\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01\0\x6a\0\0\0\x9d\0\x60\0\0\0\0\0\x01\0\xfa\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x09\0\x09\0\x80\x02\xe0\x01\x20\x0a\xd8\0\xd3\x01\x27\0\x2c\xfe\0\0\xd4\x01\x2c\xfe\0\0\xd4\x01\x2c\xfe\0\0\xd4\x01\xd6\xff\xd6\xff\xd6\xff\0\0\0\0\0\0\x2a\0\x2a\0\x2a\0\x20\0\x05\0\0\0\0\0\0\0\0\0\x49\x4d\x47\x3a\x50\x6f\x77\x65\x72\x53\x68\x6f\x74\x20\x53\x36\x30\x20\x4a\x50\x45\x47\0\0\0\0\0\0\0\0\0\0\x46\x69\x72\x6d\x77\x61\x72\x65\x20\x56\x65\x72\x73\x69\x6f\x6e\x20\x31\x2e\x30\x30\0\0\0\0\x51\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x0a\0\x02\0\x02\0\x80\x02\xe0\x01\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x48\0\x09\0\x7f\x02\x7c\x02\x7c\x02\x7d\x02\x7a\x02\x80\x02\x7c\x02\x81\x02\x7a\x02\x44\0\0\0\0\0\x58\xff\x02\0\0\0\x0a\0\xfe\xff\0\0\x0a\0\x74\0\xc7\0\x25\0\x01\0\xdc\x03\0\0\0\0\0\0\0\0\0\0\x2a\0\0\0\0\0\x80\0\xe0\0\x49\x49\x2a\0\xae\x03\0\0";
200         $this->assertEquals($entry->getValue(), $expected);
201         $this->assertEquals($entry->getText(), '904 bytes unknown MakerNote data');
202
203         $entry = $ifd0_0->getEntry(37510); // UserComment
204         $this->assertInstanceOf('lsolesen\pel\PelEntryUserComment', $entry);
205         $expected = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
206         $this->assertEquals($entry->getValue(), $expected);
207         $expected = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
208         $this->assertEquals($entry->getText(), $expected);
209
210         $entry = $ifd0_0->getEntry(40960); // FlashPixVersion
211         $this->assertInstanceOf('lsolesen\pel\PelEntryVersion', $entry);
212         $this->assertEquals($entry->getValue(), 1);
213         $this->assertEquals($entry->getText(), 'FlashPix Version 1.0');
214
215         $entry = $ifd0_0->getEntry(40961); // ColorSpace
216         $this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
217         $this->assertEquals($entry->getValue(), 1);
218         $this->assertEquals($entry->getText(), 'sRGB');
219
220         $entry = $ifd0_0->getEntry(40962); // PixelXDimension
221         $this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
222         $this->assertEquals($entry->getValue(), 640);
223         $this->assertEquals($entry->getText(), '640');
224
225         $entry = $ifd0_0->getEntry(40963); // PixelYDimension
226         $this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
227         $this->assertEquals($entry->getValue(), 480);
228         $this->assertEquals($entry->getText(), '480');
229
230         $entry = $ifd0_0->getEntry(41486); // FocalPlaneXResolution
231         $this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
232         $this->assertEquals($entry->getValue(), array(
233             0 => 640000,
234             1 => 283
235         ));
236         $this->assertEquals($entry->getText(), '640000/283');
237
238         $entry = $ifd0_0->getEntry(41487); // FocalPlaneYResolution
239         $this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
240         $this->assertEquals($entry->getValue(), array(
241             0 => 480000,
242             1 => 212
243         ));
244         $this->assertEquals($entry->getText(), '480000/212');
245
246         $entry = $ifd0_0->getEntry(41488); // FocalPlaneResolutionUnit
247         $this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
248         $this->assertEquals($entry->getValue(), 2);
249         $this->assertEquals($entry->getText(), 'Inch');
250
251         $entry = $ifd0_0->getEntry(41495); // SensingMethod
252         $this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
253         $this->assertEquals($entry->getValue(), 2);
254         $this->assertEquals($entry->getText(), 'One-chip color area sensor');
255
256         $entry = $ifd0_0->getEntry(41728); // FileSource
257         $this->assertInstanceOf('lsolesen\pel\PelEntryUndefined', $entry);
258         $this->assertEquals($entry->getValue(), "\x03");
259         $this->assertEquals($entry->getText(), 'DSC');
260
261         $entry = $ifd0_0->getEntry(41985); // CustomRendered
262         $this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
263         $this->assertEquals($entry->getValue(), 0);
264         $this->assertEquals($entry->getText(), 'Normal process');
265
266         $entry = $ifd0_0->getEntry(41986); // ExposureMode
267         $this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
268         $this->assertEquals($entry->getValue(), 0);
269         $this->assertEquals($entry->getText(), 'Auto exposure');
270
271         $entry = $ifd0_0->getEntry(41987); // WhiteBalance
272         $this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
273         $this->assertEquals($entry->getValue(), 0);
274         $this->assertEquals($entry->getText(), 'Auto white balance');
275
276         $entry = $ifd0_0->getEntry(41988); // DigitalZoomRatio
277         $this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
278         $this->assertEquals($entry->getValue(), array(
279             0 => 2592,
280             1 => 2592
281         ));
282         $this->assertEquals($entry->getText(), '2592/2592');
283
284         $entry = $ifd0_0->getEntry(41990); // SceneCaptureType
285         $this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
286         $this->assertEquals($entry->getValue(), 0);
287         $this->assertEquals($entry->getText(), 'Standard');
288
289         /* Sub IFDs of $ifd0_0. */
290         $this->assertEquals(count($ifd0_0->getSubIfds()), 1);
291         $ifd0_0_0 = $ifd0_0->getSubIfd(4); // IFD Interoperability
292         $this->assertInstanceOf('lsolesen\pel\PelIfd', $ifd0_0_0);
293
294         /* Start of IDF $ifd0_0_0. */
295         $this->assertEquals(count($ifd0_0_0->getEntries()), 4);
296
297         $entry = $ifd0_0_0->getEntry(1); // InteroperabilityIndex
298         $this->assertInstanceOf('lsolesen\pel\PelEntryAscii', $entry);
299         $this->assertEquals($entry->getValue(), 'R98');
300         $this->assertEquals($entry->getText(), 'R98');
301
302         $entry = $ifd0_0_0->getEntry(2); // InteroperabilityVersion
303         $this->assertInstanceOf('lsolesen\pel\PelEntryVersion', $entry);
304         $this->assertEquals($entry->getValue(), 1);
305         $this->assertEquals($entry->getText(), 'Interoperability Version 1.0');
306
307         $entry = $ifd0_0_0->getEntry(4097); // RelatedImageWidth
308         $this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
309         $this->assertEquals($entry->getValue(), 640);
310         $this->assertEquals($entry->getText(), '640');
311
312         $entry = $ifd0_0_0->getEntry(4098); // RelatedImageLength
313         $this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
314         $this->assertEquals($entry->getValue(), 480);
315         $this->assertEquals($entry->getText(), '480');
316
317         /* Sub IFDs of $ifd0_0_0. */
318         $this->assertEquals(count($ifd0_0_0->getSubIfds()), 0);
319
320         $this->assertEquals($ifd0_0_0->getThumbnailData(), '');
321
322         /* Next IFD. */
323         $ifd0_0_1 = $ifd0_0_0->getNextIfd();
324         $this->assertNull($ifd0_0_1);
325         /* End of IFD $ifd0_0_0. */
326
327         $this->assertEquals($ifd0_0->getThumbnailData(), '');
328
329         /* Next IFD. */
330         $ifd0_1 = $ifd0_0->getNextIfd();
331         $this->assertNull($ifd0_1);
332         /* End of IFD $ifd0_0. */
333
334         $this->assertEquals($ifd0->getThumbnailData(), '');
335
336         /* Next IFD. */
337         $ifd1 = $ifd0->getNextIfd();
338         $this->assertInstanceOf('lsolesen\pel\PelIfd', $ifd1);
339         /* End of IFD $ifd0. */
340
341         /* Start of IDF $ifd1. */
342         $this->assertEquals(count($ifd1->getEntries()), 4);
343
344         $entry = $ifd1->getEntry(259); // Compression
345         $this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
346         $this->assertEquals($entry->getValue(), 6);
347         $this->assertEquals($entry->getText(), 'JPEG compression');
348
349         $entry = $ifd1->getEntry(282); // XResolution
350         $this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
351         $this->assertEquals($entry->getValue(), array(
352             0 => 180,
353             1 => 1
354         ));
355         $this->assertEquals($entry->getText(), '180/1');
356
357         $entry = $ifd1->getEntry(283); // YResolution
358         $this->assertInstanceOf('lsolesen\pel\PelEntryRational', $entry);
359         $this->assertEquals($entry->getValue(), array(
360             0 => 180,
361             1 => 1
362         ));
363         $this->assertEquals($entry->getText(), '180/1');
364
365         $entry = $ifd1->getEntry(296); // ResolutionUnit
366         $this->assertInstanceOf('lsolesen\pel\PelEntryShort', $entry);
367         $this->assertEquals($entry->getValue(), 2);
368         $this->assertEquals($entry->getText(), 'Inch');
369
370         /* Sub IFDs of $ifd1. */
371         $this->assertEquals(count($ifd1->getSubIfds()), 0);
372
373         $thumb_data = file_get_contents(dirname(__FILE__) . '/canon-powershot-s60-thumb.jpg');
374         $this->assertEquals($ifd1->getThumbnailData(), $thumb_data);
375
376         /* Next IFD. */
377         $ifd2 = $ifd1->getNextIfd();
378         $this->assertNull($ifd2);
379         /* End of IFD $ifd1. */
380
381         $this->assertTrue(count(Pel::getExceptions()) == 0);
382     }
383 }