4 * PEL: PHP Exif Library.
5 * A library with support for reading and
6 * writing all Exif headers in JPEG and TIFF images using PHP.
8 * Copyright (C) 2004, 2006 Martin Geisler.
9 * Copyright (C) 2017 Johannes Weberhofer
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program in the file COPYING; if not, write to the
23 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
24 * Boston, MA 02110-1301 USA
26 use PHPUnit\Framework\TestCase;
27 use lsolesen\pel\PelJpegMarker;
29 use lsolesen\pel\PelJpegInvalidMarkerException;
31 class PelJpegMarkerTest extends TestCase
36 $jpegMarker = new PelJpegMarker();
37 $this->assertEquals($jpegMarker::getName(PelJpegMarker::SOF0), 'SOF0');
38 $this->assertEquals($jpegMarker::getName(PelJpegMarker::RST3), 'RST3');
39 $this->assertEquals($jpegMarker::getName(PelJpegMarker::APP3), 'APP3');
40 $this->assertEquals($jpegMarker::getName(PelJpegMarker::JPG11), 'JPG11');
41 $this->assertEquals($jpegMarker::getName(100), Pel::fmt('Unknown marker: 0x%02X', 100));
44 function testDescriptions()
46 $jpegMarker = new PelJpegMarker();
47 $this->assertEquals($jpegMarker::getDescription(PelJpegMarker::SOF0), 'Encoding (baseline)');
48 $this->assertEquals($jpegMarker::getDescription(PelJpegMarker::RST3), Pel::fmt('Restart %d', 3));
49 $this->assertEquals($jpegMarker::getDescription(PelJpegMarker::APP3), Pel::fmt('Application segment %d', 3));
50 $this->assertEquals($jpegMarker::getDescription(PelJpegMarker::JPG11), Pel::fmt('Extension %d', 11));
51 $this->assertEquals($jpegMarker::getDescription(100), Pel::fmt('Unknown marker: 0x%02X', 100));
55 * @expectedException lsolesen\pel\PelJpegInvalidMarkerException
56 * @throws PelJpegInvalidMarkerException
58 function testInvalidMarkerException()
60 throw new PelJpegInvalidMarkerException(1, 2);