Index: trunk/phase3/tests/phpunit/includes/media/ExifTest.php |
— | — | @@ -0,0 +1,51 @@ |
| 2 | +<?php |
| 3 | +class ExifTest extends MediaWikiTestCase { |
| 4 | + |
| 5 | + public function setUp() { |
| 6 | + $this->mediaPath = dirname( __FILE__ ) . '/../../data/media/'; |
| 7 | + |
| 8 | + global $wgShowEXIF; |
| 9 | + $this->showExif = $wgShowEXIF; |
| 10 | + $wgShowEXIF = true; |
| 11 | + } |
| 12 | + public function tearDown() { |
| 13 | + global $wgShowEXIF; |
| 14 | + $wgShowEXIF = $this->showExif; |
| 15 | + } |
| 16 | + |
| 17 | + public function testGPSExtraction() { |
| 18 | + if ( !wfDl( 'exif' ) ) { |
| 19 | + $this->markTestIncomplete( "This test needs the exif extension." ); |
| 20 | + } |
| 21 | + |
| 22 | + $filename = $this->mediaPath . 'exif-gps.jpg'; |
| 23 | + $seg = JpegMetadataExtractor::segmentSplitter( $filename ); |
| 24 | + $exif = new Exif( $filename, $seg['byteOrder'] ); |
| 25 | + $data = $exif->getFilteredData(); |
| 26 | + $expected = array( |
| 27 | + 'GPSLatitude' => 88.5180555556, |
| 28 | + 'GPSLongitude' => -21.12357, |
| 29 | + 'GPSAltitude' => -200, |
| 30 | + 'GPSDOP' => '5/1', |
| 31 | + 'GPSVersionID' => '2.2.0.0', |
| 32 | + ); |
| 33 | + $this->assertEquals( $expected, $data, '', 0.0000000001 ); |
| 34 | + } |
| 35 | + public function testUnicodeUserComment() { |
| 36 | + if ( !wfDl( 'exif' ) ) { |
| 37 | + $this->markTestIncomplete( "This test needs the exif extension." ); |
| 38 | + } |
| 39 | + |
| 40 | + $filename = $this->mediaPath . 'exif-user-comment.jpg'; |
| 41 | + $seg = JpegMetadataExtractor::segmentSplitter( $filename ); |
| 42 | + $exif = new Exif( $filename, $seg['byteOrder'] ); |
| 43 | + $data = $exif->getFilteredData(); |
| 44 | + |
| 45 | + $expected = array( |
| 46 | + 'UserComment' => 'test⁔comment' |
| 47 | + ); |
| 48 | + $this->assertEquals( $expected, $data ); |
| 49 | + } |
| 50 | + |
| 51 | + |
| 52 | +} |
Property changes on: trunk/phase3/tests/phpunit/includes/media/ExifTest.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 53 | + native |
Index: trunk/phase3/tests/phpunit/includes/media/IPTCTest.php |
— | — | @@ -0,0 +1,55 @@ |
| 2 | +<?php |
| 3 | +class IPTCTest extends MediaWikiTestCase { |
| 4 | + public function testRecognizeUtf8() { |
| 5 | + // utf-8 is the only one used in practise. |
| 6 | + $res = IPTC::getCharset( "\x1b%G" ); |
| 7 | + $this->assertEquals( 'UTF-8', $res ); |
| 8 | + } |
| 9 | + |
| 10 | + public function testIPTCParseNoCharset88591() { |
| 11 | + // basically IPTC for keyword with value of 0xBC which is 1/4 in iso-8859-1 |
| 12 | + // This data doesn't specify a charset. We're supposed to guess |
| 13 | + // (which basically means utf-8 if valid, windows 1252 (iso 8859-1) if not) |
| 14 | + $iptcData = "Photoshop 3.0\08BIM\4\4\0\0\0\0\0\x06\x1c\x02\x19\x00\x01\xBC"; |
| 15 | + $res = IPTC::Parse( $iptcData ); |
| 16 | + $this->assertEquals( array( '¼' ), $res['Keywords'] ); |
| 17 | + } |
| 18 | + /* This one contains a sequence that's valid iso 8859-1 but not valid utf8 */ |
| 19 | + /* \xC3 = Ã, \xB8 = ¸ */ |
| 20 | + public function testIPTCParseNoCharset88591b() { |
| 21 | + $iptcData = "Photoshop 3.0\08BIM\4\4\0\0\0\0\0\x09\x1c\x02\x19\x00\x04\xC3\xC3\xC3\xB8"; |
| 22 | + $res = IPTC::Parse( $iptcData ); |
| 23 | + $this->assertEquals( array( 'ÃÃø' ), $res['Keywords'] ); |
| 24 | + } |
| 25 | + /* Same as testIPTCParseNoCharset88591b, but forcing the charset to utf-8. |
| 26 | + * What should happen is the first "\xC3\xC3" should be dropped as invalid, |
| 27 | + * leaving \xC3\xB8, which is ø |
| 28 | + */ |
| 29 | + public function testIPTCParseForcedUTFButInvalid() { |
| 30 | + $iptcData = "Photoshop 3.0\08BIM\4\4\0\0\0\0\0\x11\x1c\x02\x19\x00\x04\xC3\xC3\xC3\xB8" |
| 31 | + . "\x1c\x01\x5A\x00\x03\x1B\x25\x47"; |
| 32 | + $res = IPTC::Parse( $iptcData ); |
| 33 | + $this->assertEquals( array( 'ø' ), $res['Keywords'] ); |
| 34 | + } |
| 35 | + public function testIPTCParseNoCharsetUTF8() { |
| 36 | + $iptcData = "Photoshop 3.0\08BIM\4\4\0\0\0\0\0\x07\x1c\x02\x19\x00\x02¼"; |
| 37 | + $res = IPTC::Parse( $iptcData ); |
| 38 | + $this->assertEquals( array( '¼' ), $res['Keywords'] ); |
| 39 | + } |
| 40 | + // Testing something that has 2 values for keyword |
| 41 | + public function testIPTCParseMulti() { |
| 42 | + $iptcData = /* identifier */ "Photoshop 3.0\08BIM\4\4" |
| 43 | + /* length */ . "\0\0\0\0\0\x0D" |
| 44 | + . "\x1c\x02\x19" . "\x00\x01" . "\xBC" |
| 45 | + . "\x1c\x02\x19" . "\x00\x02" . "\xBC\xBD"; |
| 46 | + $res = IPTC::Parse( $iptcData ); |
| 47 | + $this->assertEquals( array( '¼', '¼½' ), $res['Keywords'] ); |
| 48 | + } |
| 49 | + public function testIPTCParseUTF8() { |
| 50 | + // This has the magic "\x1c\x01\x5A\x00\x03\x1B\x25\x47" which marks content as UTF8. |
| 51 | + $iptcData = "Photoshop 3.0\08BIM\4\4\0\0\0\0\0\x0F\x1c\x02\x19\x00\x02¼\x1c\x01\x5A\x00\x03\x1B\x25\x47"; |
| 52 | + $res = IPTC::Parse( $iptcData ); |
| 53 | + $this->assertEquals( array( '¼' ), $res['Keywords'] ); |
| 54 | + } |
| 55 | + |
| 56 | +} |
Property changes on: trunk/phase3/tests/phpunit/includes/media/IPTCTest.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 57 | + native |
Index: trunk/phase3/tests/phpunit/includes/media/GIFMetadataExtractorTest.php |
— | — | @@ -0,0 +1,95 @@ |
| 2 | +<?php |
| 3 | +class GIFMetadataExtractorTest extends MediaWikiTestCase { |
| 4 | + |
| 5 | + public function setUp() { |
| 6 | + $this->mediaPath = dirname( __FILE__ ) . '/../../data/media/'; |
| 7 | + } |
| 8 | + /** |
| 9 | + * Put in a file, and see if the metadata coming out is as expected. |
| 10 | + * @param $filename String |
| 11 | + * @param $expected Array The extracted metadata. |
| 12 | + * @dataProvider dataGetMetadata |
| 13 | + */ |
| 14 | + public function testGetMetadata( $filename, $expected ) { |
| 15 | + $actual = GIFMetadataExtractor::getMetadata( $this->mediaPath . $filename ); |
| 16 | + $this->assertEquals( $expected, $actual ); |
| 17 | + } |
| 18 | + public function dataGetMetadata() { |
| 19 | + |
| 20 | + $xmpNugget = <<<EOF |
| 21 | +<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?> |
| 22 | +<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 7.30'> |
| 23 | +<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'> |
| 24 | + |
| 25 | + <rdf:Description rdf:about='' |
| 26 | + xmlns:Iptc4xmpCore='http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/'> |
| 27 | + <Iptc4xmpCore:Location>The interwebs</Iptc4xmpCore:Location> |
| 28 | + </rdf:Description> |
| 29 | + |
| 30 | + <rdf:Description rdf:about='' |
| 31 | + xmlns:tiff='http://ns.adobe.com/tiff/1.0/'> |
| 32 | + <tiff:Artist>Bawolff</tiff:Artist> |
| 33 | + <tiff:ImageDescription> |
| 34 | + <rdf:Alt> |
| 35 | + <rdf:li xml:lang='x-default'>A file to test GIF</rdf:li> |
| 36 | + </rdf:Alt> |
| 37 | + </tiff:ImageDescription> |
| 38 | + </rdf:Description> |
| 39 | +</rdf:RDF> |
| 40 | +</x:xmpmeta> |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | +<?xpacket end='w'?> |
| 66 | +EOF; |
| 67 | + |
| 68 | + return array( |
| 69 | + array( 'nonanimated.gif', array( |
| 70 | + 'comment' => array( 'GIF test file ⁕ Created with GIMP' ), |
| 71 | + 'duration' => 0.1, |
| 72 | + 'frameCount' => 1, |
| 73 | + 'looped' => false, |
| 74 | + 'xmp' => '', |
| 75 | + ) |
| 76 | + ), |
| 77 | + array( 'animated.gif', array( |
| 78 | + 'comment' => array( 'GIF test file . Created with GIMP' ), |
| 79 | + 'duration' => 2.4, |
| 80 | + 'frameCount' => 4, |
| 81 | + 'looped' => true, |
| 82 | + 'xmp' => '', |
| 83 | + ) |
| 84 | + ), |
| 85 | + |
| 86 | + array( 'animated-xmp.gif', array( |
| 87 | + 'xmp' => $xmpNugget, |
| 88 | + 'duration' => 2.4, |
| 89 | + 'frameCount' => 4, |
| 90 | + 'looped' => true, |
| 91 | + 'comment' => array( 'GIƒ·test·file' ), |
| 92 | + ) |
| 93 | + ), |
| 94 | + ); |
| 95 | + } |
| 96 | +} |
Property changes on: trunk/phase3/tests/phpunit/includes/media/GIFMetadataExtractorTest.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 97 | + native |
Index: trunk/phase3/tests/phpunit/includes/media/XMPTest.php |
— | — | @@ -0,0 +1,154 @@ |
| 2 | +<?php |
| 3 | +class XMPTest extends MediaWikiTestCase { |
| 4 | + |
| 5 | + /** |
| 6 | + * Put XMP in, compare what comes out... |
| 7 | + * |
| 8 | + * @param $xmp String the actual xml data. |
| 9 | + * @param $expected Array expected result of parsing the xmp. |
| 10 | + * @param $info String Short sentence on what's being tested. |
| 11 | + * |
| 12 | + * @dataProvider dataXMPParse |
| 13 | + */ |
| 14 | + public function testXMPParse( $xmp, $expected, $info ) { |
| 15 | + if ( !function_exists( 'xml_parser_create_ns' ) ) { |
| 16 | + $this->markIncomplete( 'Requires libxml to do XMP parsing' ); |
| 17 | + } |
| 18 | + if ( !is_string( $xmp ) || !is_array( $expected ) ) { |
| 19 | + throw new Exception( "Invalid data provided to " . __METHOD__ ); |
| 20 | + } |
| 21 | + $reader = new XMPReader; |
| 22 | + $reader->parse( $xmp ); |
| 23 | + $this->assertEquals( $expected, $reader->getResults(), $info ); |
| 24 | + } |
| 25 | + |
| 26 | + public function dataXMPParse() { |
| 27 | + $xmpPath = dirname( __FILE__ ) . '/../../data/xmp/' ; |
| 28 | + $data = array(); |
| 29 | + |
| 30 | + // $xmpFiles format: array of arrays with first arg file base name, |
| 31 | + // with the actual file having .xmp on the end for the xmp |
| 32 | + // and .result.php on the end for a php file containing the result |
| 33 | + // array. Second argument is some info on what's being tested. |
| 34 | + $xmpFiles = array( |
| 35 | + array( '1', 'parseType=Resource test' ), |
| 36 | + array( '2', 'Structure with mixed attribute and element props' ), |
| 37 | + array( '3', 'Extra qualifiers (that should be ignored)' ), |
| 38 | + array( '3-invalid', 'Test ignoring qualifiers that look like normal props' ), |
| 39 | + array( '4', 'Flash as qualifier' ), |
| 40 | + array( '5', 'Flash as qualifier 2' ), |
| 41 | + array( '6', 'Multiple rdf:Description' ), |
| 42 | + array( '7', 'Generic test of several property types' ), |
| 43 | + array( 'flash', 'Test of Flash property' ), |
| 44 | + array( 'invalid-child-not-struct', 'Test child props not in struct or ignored' ), |
| 45 | + array( 'no-recognized-props', 'Test namespace and no recognized props' ), |
| 46 | + array( 'no-namespace', 'Test non-namespaced attributes are ignored' ), |
| 47 | + array( 'bag-for-seq', "Allow bag's instead of seq's. (bug 27105)" ), |
| 48 | + array( 'utf16BE', 'UTF-16BE encoding' ), |
| 49 | + array( 'utf16LE', 'UTF-16LE encoding' ), |
| 50 | + array( 'utf32BE', 'UTF-32BE encoding' ), |
| 51 | + array( 'utf32LE', 'UTF-32LE encoding' ), |
| 52 | + array( 'xmpExt', 'Extended XMP missing second part' ), |
| 53 | + ); |
| 54 | + foreach( $xmpFiles as $file ) { |
| 55 | + $xmp = file_get_contents( $xmpPath . $file[0] . '.xmp' ); |
| 56 | + // I'm not sure if this is the best way to handle getting the |
| 57 | + // result array, but it seems kind of big to put directly in the test |
| 58 | + // file. |
| 59 | + $result = null; |
| 60 | + include( $xmpPath . $file[0] . '.result.php' ); |
| 61 | + $data[] = array( $xmp, $result, '[' . $file[0] . '.xmp] ' . $file[1] ); |
| 62 | + } |
| 63 | + return $data; |
| 64 | + } |
| 65 | + |
| 66 | + /** Test ExtendedXMP block support. (Used when the XMP has to be split |
| 67 | + * over multiple jpeg segments, due to 64k size limit on jpeg segments. |
| 68 | + * |
| 69 | + * @todo This is based on what the standard says. Need to find a real |
| 70 | + * world example file to double check the support for this is right. |
| 71 | + */ |
| 72 | + function testExtendedXMP() { |
| 73 | + $xmpPath = dirname( __FILE__ ) . '/../../data/xmp/'; |
| 74 | + $standardXMP = file_get_contents( $xmpPath . 'xmpExt.xmp' ); |
| 75 | + $extendedXMP = file_get_contents( $xmpPath . 'xmpExt2.xmp' ); |
| 76 | + |
| 77 | + $md5sum = '28C74E0AC2D796886759006FBE2E57B7'; // of xmpExt2.xmp |
| 78 | + $length = pack( 'N', strlen( $extendedXMP ) ); |
| 79 | + $offset = pack( 'N', 0 ); |
| 80 | + $extendedPacket = $md5sum . $length . $offset . $extendedXMP; |
| 81 | + |
| 82 | + $reader = new XMPReader(); |
| 83 | + $reader->parse( $standardXMP ); |
| 84 | + $reader->parseExtended( $extendedPacket ); |
| 85 | + $actual = $reader->getResults(); |
| 86 | + |
| 87 | + $expected = array( 'xmp-exif' => |
| 88 | + array( |
| 89 | + 'DigitalZoomRatio' => '0/10', |
| 90 | + 'Flash' => 9, |
| 91 | + 'FNumber' => '2/10', |
| 92 | + ) |
| 93 | + ); |
| 94 | + |
| 95 | + $this->assertEquals( $expected, $actual ); |
| 96 | + } |
| 97 | + |
| 98 | + /** |
| 99 | + * This test has an extended XMP block with a wrong guid (md5sum) |
| 100 | + * and thus should only return the StandardXMP, not the ExtendedXMP. |
| 101 | + */ |
| 102 | + function testExtendedXMPWithWrongGUID() { |
| 103 | + $xmpPath = dirname( __FILE__ ) . '/../../data/xmp/'; |
| 104 | + $standardXMP = file_get_contents( $xmpPath . 'xmpExt.xmp' ); |
| 105 | + $extendedXMP = file_get_contents( $xmpPath . 'xmpExt2.xmp' ); |
| 106 | + |
| 107 | + $md5sum = '28C74E0AC2D796886759006FBE2E57B9'; // Note last digit. |
| 108 | + $length = pack( 'N', strlen( $extendedXMP ) ); |
| 109 | + $offset = pack( 'N', 0 ); |
| 110 | + $extendedPacket = $md5sum . $length . $offset . $extendedXMP; |
| 111 | + |
| 112 | + $reader = new XMPReader(); |
| 113 | + $reader->parse( $standardXMP ); |
| 114 | + $reader->parseExtended( $extendedPacket ); |
| 115 | + $actual = $reader->getResults(); |
| 116 | + |
| 117 | + $expected = array( 'xmp-exif' => |
| 118 | + array( |
| 119 | + 'DigitalZoomRatio' => '0/10', |
| 120 | + 'Flash' => 9, |
| 121 | + ) |
| 122 | + ); |
| 123 | + |
| 124 | + $this->assertEquals( $expected, $actual ); |
| 125 | + } |
| 126 | + /** |
| 127 | + * Have a high offset to simulate a missing packet, |
| 128 | + * which should cause it to ignore the ExtendedXMP packet. |
| 129 | + */ |
| 130 | + function testExtendedXMPMissingPacket() { |
| 131 | + $xmpPath = dirname( __FILE__ ) . '/../../data/xmp/'; |
| 132 | + $standardXMP = file_get_contents( $xmpPath . 'xmpExt.xmp' ); |
| 133 | + $extendedXMP = file_get_contents( $xmpPath . 'xmpExt2.xmp' ); |
| 134 | + |
| 135 | + $md5sum = '28C74E0AC2D796886759006FBE2E57B7'; // of xmpExt2.xmp |
| 136 | + $length = pack( 'N', strlen( $extendedXMP ) ); |
| 137 | + $offset = pack( 'N', 2048 ); |
| 138 | + $extendedPacket = $md5sum . $length . $offset . $extendedXMP; |
| 139 | + |
| 140 | + $reader = new XMPReader(); |
| 141 | + $reader->parse( $standardXMP ); |
| 142 | + $reader->parseExtended( $extendedPacket ); |
| 143 | + $actual = $reader->getResults(); |
| 144 | + |
| 145 | + $expected = array( 'xmp-exif' => |
| 146 | + array( |
| 147 | + 'DigitalZoomRatio' => '0/10', |
| 148 | + 'Flash' => 9, |
| 149 | + ) |
| 150 | + ); |
| 151 | + |
| 152 | + $this->assertEquals( $expected, $actual ); |
| 153 | + } |
| 154 | + |
| 155 | +} |
Property changes on: trunk/phase3/tests/phpunit/includes/media/XMPTest.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 156 | + native |
Index: trunk/phase3/tests/phpunit/includes/media/GIFTest.php |
— | — | @@ -0,0 +1,85 @@ |
| 2 | +<?php |
| 3 | +class GIFHandlerTest extends MediaWikiTestCase { |
| 4 | + |
| 5 | + public function setUp() { |
| 6 | + $this->filePath = dirname( __FILE__ ) . '/../../data/media/'; |
| 7 | + $this->handler = new GIFHandler(); |
| 8 | + } |
| 9 | + |
| 10 | + public function testInvalidFile() { |
| 11 | + $res = $this->handler->getMetadata( null, $this->filePath . 'README' ); |
| 12 | + $this->assertEquals( GIFHandler::BROKEN_FILE, $res ); |
| 13 | + } |
| 14 | + /** |
| 15 | + * @param $filename String basename of the file to check |
| 16 | + * @param $expected boolean Expected result. |
| 17 | + * @dataProvider dataIsAnimated |
| 18 | + */ |
| 19 | + public function testIsAnimanted( $filename, $expected ) { |
| 20 | + $file = UnregisteredLocalFile::newFromPath( $this->filePath . $filename, |
| 21 | + 'image/gif' ); |
| 22 | + $actual = $this->handler->isAnimatedImage( $file ); |
| 23 | + $this->assertEquals( $expected, $actual ); |
| 24 | + } |
| 25 | + public function dataIsAnimated() { |
| 26 | + return array( |
| 27 | + array( 'animated.gif', true ), |
| 28 | + array( 'nonanimated.gif', false ), |
| 29 | + ); |
| 30 | + } |
| 31 | + |
| 32 | + /** |
| 33 | + * @param $filename String |
| 34 | + * @param $expected Integer Total image area |
| 35 | + * @dataProvider dataGetImageArea |
| 36 | + */ |
| 37 | + public function testGetImageArea( $filename, $expected ) { |
| 38 | + $file = UnregisteredLocalFile::newFromPath( $this->filePath . $filename, |
| 39 | + 'image/gif' ); |
| 40 | + $actual = $this->handler->getImageArea( $file, $file->getWidth(), $file->getHeight() ); |
| 41 | + $this->assertEquals( $expected, $actual ); |
| 42 | + } |
| 43 | + public function dataGetImageArea() { |
| 44 | + return array( |
| 45 | + array( 'animated.gif', 5400 ), |
| 46 | + array( 'nonanimated.gif', 1350 ), |
| 47 | + ); |
| 48 | + } |
| 49 | + |
| 50 | + /** |
| 51 | + * @param $metadata String Serialized metadata |
| 52 | + * @param $expected Integer One of the class constants of GIFHandler |
| 53 | + * @dataProvider dataIsMetadataValid |
| 54 | + */ |
| 55 | + public function testIsMetadataValid( $metadata, $expected ) { |
| 56 | + $actual = $this->handler->isMetadataValid( null, $metadata ); |
| 57 | + $this->assertEquals( $expected, $actual ); |
| 58 | + } |
| 59 | + public function dataIsMetadataValid() { |
| 60 | + return array( |
| 61 | + array( GIFHandler::BROKEN_FILE, GIFHandler::METADATA_GOOD ), |
| 62 | + array( '', GIFHandler::METADATA_BAD ), |
| 63 | + array( null, GIFHandler::METADATA_BAD ), |
| 64 | + array( 'Something invalid!', GIFHandler::METADATA_BAD ), |
| 65 | + array( 'a:4:{s:10:"frameCount";i:1;s:6:"looped";b:0;s:8:"duration";d:0.1000000000000000055511151231257827021181583404541015625;s:8:"metadata";a:2:{s:14:"GIFFileComment";a:1:{i:0;s:35:"GIF test file ⁕ Created with GIMP";}s:15:"_MW_GIF_VERSION";i:1;}}', GIFHandler::METADATA_GOOD ), |
| 66 | + ); |
| 67 | + } |
| 68 | + |
| 69 | + /** |
| 70 | + * @param $filename String |
| 71 | + * @param $expected String Serialized array |
| 72 | + * @dataProvider dataGetMetadata |
| 73 | + */ |
| 74 | + public function testGetMetadata( $filename, $expected ) { |
| 75 | + $file = UnregisteredLocalFile::newFromPath( $this->filePath . $filename, |
| 76 | + 'image/gif' ); |
| 77 | + $actual = $this->handler->getMetadata( $file, $this->filePath . $filename ); |
| 78 | + $this->assertEquals( unserialize( $expected ), unserialize( $actual ) ); |
| 79 | + } |
| 80 | + public function dataGetMetadata() { |
| 81 | + return array( |
| 82 | + array( 'nonanimated.gif', 'a:4:{s:10:"frameCount";i:1;s:6:"looped";b:0;s:8:"duration";d:0.1000000000000000055511151231257827021181583404541015625;s:8:"metadata";a:2:{s:14:"GIFFileComment";a:1:{i:0;s:35:"GIF test file ⁕ Created with GIMP";}s:15:"_MW_GIF_VERSION";i:1;}}' ), |
| 83 | + array( 'animated-xmp.gif', 'a:4:{s:10:"frameCount";i:4;s:6:"looped";b:1;s:8:"duration";d:2.399999999999999911182158029987476766109466552734375;s:8:"metadata";a:5:{s:6:"Artist";s:7:"Bawolff";s:16:"ImageDescription";a:2:{s:9:"x-default";s:18:"A file to test GIF";s:5:"_type";s:4:"lang";}s:15:"SublocationDest";s:13:"The interwebs";s:14:"GIFFileComment";a:1:{i:0;s:16:"GIƒ·test·file";}s:15:"_MW_GIF_VERSION";i:1;}}' ), |
| 84 | + ); |
| 85 | + } |
| 86 | +} |
Property changes on: trunk/phase3/tests/phpunit/includes/media/GIFTest.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 87 | + native |
Index: trunk/phase3/tests/phpunit/includes/media/BitmapMetadataHandlerTest.php |
— | — | @@ -47,4 +47,78 @@ |
48 | 48 | $this->assertEquals( 'UTF-8 JPEG Comment — ¼', |
49 | 49 | $meta['JPEGFileComment'][0] ); |
50 | 50 | } |
| 51 | + |
| 52 | + public function testIPTCDates() { |
| 53 | + $meta = BitmapMetadataHandler::Jpeg( $this->filePath . |
| 54 | + 'iptc-timetest.jpg' ); |
| 55 | + |
| 56 | + $this->assertEquals( '2020:07:14 01:36:05', $meta['DateTimeDigitized'] ); |
| 57 | + $this->assertEquals( '1997:03:02 00:01:02', $meta['DateTimeOriginal'] ); |
| 58 | + } |
| 59 | + /* File has an invalid time (+ one valid but really weird time) |
| 60 | + * that shouldn't be included |
| 61 | + */ |
| 62 | + public function testIPTCDatesInvalid() { |
| 63 | + $meta = BitmapMetadataHandler::Jpeg( $this->filePath . |
| 64 | + 'iptc-timetest-invalid.jpg' ); |
| 65 | + |
| 66 | + $this->assertEquals( '1845:03:02 00:01:02', $meta['DateTimeOriginal'] ); |
| 67 | + $this->assertFalse( isset( $meta['DateTimeDigitized'] ) ); |
| 68 | + } |
| 69 | + |
| 70 | + /** |
| 71 | + * XMP data should take priority over iptc data |
| 72 | + * when hash has been updated, but not when |
| 73 | + * the hash is wrong. |
| 74 | + */ |
| 75 | + public function testMerging() { |
| 76 | + $merger = new BitmapMetadataHandler(); |
| 77 | + $merger->addMetadata( array( 'foo' => 'xmp' ), 'xmp-general' ); |
| 78 | + $merger->addMetadata( array( 'bar' => 'xmp' ), 'xmp-general' ); |
| 79 | + $merger->addMetadata( array( 'baz' => 'xmp' ), 'xmp-general' ); |
| 80 | + $merger->addMetadata( array( 'fred' => 'xmp' ), 'xmp-general' ); |
| 81 | + $merger->addMetadata( array( 'foo' => 'iptc (hash)' ), 'iptc-good-hash' ); |
| 82 | + $merger->addMetadata( array( 'bar' => 'iptc (bad hash)' ), 'iptc-bad-hash' ); |
| 83 | + $merger->addMetadata( array( 'baz' => 'iptc (bad hash)' ), 'iptc-bad-hash' ); |
| 84 | + $merger->addMetadata( array( 'fred' => 'iptc (no hash)' ), 'iptc-no-hash' ); |
| 85 | + $merger->addMetadata( array( 'baz' => 'exif' ), 'exif' ); |
| 86 | + |
| 87 | + $actual = $merger->getMetadataArray(); |
| 88 | + $expected = array( |
| 89 | + 'foo' => 'xmp', |
| 90 | + 'bar' => 'iptc (bad hash)', |
| 91 | + 'baz' => 'exif', |
| 92 | + 'fred' => 'xmp', |
| 93 | + ); |
| 94 | + $this->assertEquals( $expected, $actual ); |
| 95 | + } |
| 96 | + |
| 97 | + public function testPNGXMP() { |
| 98 | + $handler = new BitmapMetadataHandler(); |
| 99 | + $result = $handler->png( $this->filePath . 'xmp.png' ); |
| 100 | + $expected = array ( |
| 101 | + 'frameCount' => 0, |
| 102 | + 'loopCount' => 1, |
| 103 | + 'duration' => 0, |
| 104 | + 'bitDepth' => 1, |
| 105 | + 'colorType' => 'index-coloured', |
| 106 | + 'metadata' => array ( |
| 107 | + 'SerialNumber' => '123456789', |
| 108 | + '_MW_PNG_VERSION' => 1, |
| 109 | + ), |
| 110 | + ); |
| 111 | + $this->assertEquals( $expected, $result ); |
| 112 | + } |
| 113 | + public function testPNGNative() { |
| 114 | + $handler = new BitmapMetadataHandler(); |
| 115 | + $result = $handler->png( $this->filePath . 'Png-native-test.png' ); |
| 116 | + $expected = 'http://example.com/url'; |
| 117 | + $this->assertEquals( $expected, $result['metadata']['Identifier']['x-default'] ); |
| 118 | + } |
| 119 | + public function testTiffByteOrder() { |
| 120 | + $handler = new BitmapMetadataHandler(); |
| 121 | + $res = $handler->getTiffByteOrder( $this->filePath . 'test.tiff' ); |
| 122 | + $this->assertEquals( 'LE', $res ); |
| 123 | + } |
| 124 | + |
51 | 125 | } |
Index: trunk/phase3/tests/phpunit/includes/media/PNGMetadataExtractorTest.php |
— | — | @@ -138,5 +138,4 @@ |
139 | 139 | $this->assertEquals( 'greyscale', $meta['colorType'] ); |
140 | 140 | } |
141 | 141 | |
142 | | - |
143 | 142 | } |
Index: trunk/phase3/tests/phpunit/includes/media/JpegMetadataExtractorTest.php |
— | — | @@ -1,4 +1,11 @@ |
2 | 2 | <?php |
| 3 | +/* |
| 4 | + * @todo Could use a test of extended XMP segments. Hard to find programs that |
| 5 | + * create example files, and creating my own in vim propbably wouldn't |
| 6 | + * serve as a very good "test". (Adobe photoshop probably creates such files |
| 7 | + * but it costs money). The implementation of it currently in MediaWiki is based |
| 8 | + * solely on reading the standard, without any real world test files. |
| 9 | + */ |
3 | 10 | class JpegMetadataExtractorTest extends MediaWikiTestCase { |
4 | 11 | |
5 | 12 | public function setUp() { |
— | — | @@ -29,4 +36,44 @@ |
30 | 37 | $res = JpegMetadataExtractor::segmentSplitter( $this->filePath . 'jpeg-comment-multiple.jpg' ); |
31 | 38 | $this->assertEquals( array( 'foo', 'bar' ), $res['COM'] ); |
32 | 39 | } |
| 40 | + public function testXMPExtraction() { |
| 41 | + $res = JpegMetadataExtractor::segmentSplitter( $this->filePath . 'jpeg-xmp-psir.jpg' ); |
| 42 | + $expected = file_get_contents( $this->filePath . 'jpeg-xmp-psir.xmp' ); |
| 43 | + $this->assertEquals( $expected, $res['XMP'] ); |
| 44 | + } |
| 45 | + public function testPSIRExtraction() { |
| 46 | + $res = JpegMetadataExtractor::segmentSplitter( $this->filePath . 'jpeg-xmp-psir.jpg' ); |
| 47 | + $expected = '50686f746f73686f7020332e30003842494d04040000000000181c02190004746573741c02190003666f6f1c020000020004'; |
| 48 | + $this->assertEquals( $expected, bin2hex( $res['PSIR'] ) ); |
| 49 | + } |
| 50 | + public function testXMPExtractionAltAppId() { |
| 51 | + $res = JpegMetadataExtractor::segmentSplitter( $this->filePath . 'jpeg-xmp-alt.jpg' ); |
| 52 | + $expected = file_get_contents( $this->filePath . 'jpeg-xmp-psir.xmp' ); |
| 53 | + $this->assertEquals( $expected, $res['XMP'] ); |
| 54 | + } |
| 55 | + |
| 56 | + |
| 57 | + public function testIPTCHashComparisionNoHash() { |
| 58 | + $segments = JpegMetadataExtractor::segmentSplitter( $this->filePath . 'jpeg-xmp-psir.jpg' ); |
| 59 | + $res = JpegMetadataExtractor::doPSIR( $segments['PSIR'] ); |
| 60 | + |
| 61 | + $this->assertEquals( 'iptc-no-hash', $res ); |
| 62 | + } |
| 63 | + public function testIPTCHashComparisionBadHash() { |
| 64 | + $segments = JpegMetadataExtractor::segmentSplitter( $this->filePath . 'jpeg-iptc-bad-hash.jpg' ); |
| 65 | + $res = JpegMetadataExtractor::doPSIR( $segments['PSIR'] ); |
| 66 | + |
| 67 | + $this->assertEquals( 'iptc-bad-hash', $res ); |
| 68 | + } |
| 69 | + public function testIPTCHashComparisionGoodHash() { |
| 70 | + $segments = JpegMetadataExtractor::segmentSplitter( $this->filePath . 'jpeg-iptc-good-hash.jpg' ); |
| 71 | + $res = JpegMetadataExtractor::doPSIR( $segments['PSIR'] ); |
| 72 | + |
| 73 | + $this->assertEquals( 'iptc-good-hash', $res ); |
| 74 | + } |
| 75 | + public function testExifByteOrder() { |
| 76 | + $res = JpegMetadataExtractor::segmentSplitter( $this->filePath . 'exif-user-comment.jpg' ); |
| 77 | + $expected = 'BE'; |
| 78 | + $this->assertEquals( $expected, $res['byteOrder'] ); |
| 79 | + } |
33 | 80 | } |
Index: trunk/phase3/tests/phpunit/includes/media/PNGTest.php |
— | — | @@ -0,0 +1,88 @@ |
| 2 | +<?php |
| 3 | +class PNGHandlerTest extends MediaWikiTestCase { |
| 4 | + |
| 5 | + public function setUp() { |
| 6 | + $this->filePath = dirname( __FILE__ ) . '/../../data/media/'; |
| 7 | + $this->handler = new PNGHandler(); |
| 8 | + } |
| 9 | + |
| 10 | + public function testInvalidFile() { |
| 11 | + $res = $this->handler->getMetadata( null, $this->filePath . 'README' ); |
| 12 | + $this->assertEquals( PNGHandler::BROKEN_FILE, $res ); |
| 13 | + } |
| 14 | + /** |
| 15 | + * @param $filename String basename of the file to check |
| 16 | + * @param $expected boolean Expected result. |
| 17 | + * @dataProvider dataIsAnimated |
| 18 | + */ |
| 19 | + public function testIsAnimanted( $filename, $expected ) { |
| 20 | + $file = UnregisteredLocalFile::newFromPath( $this->filePath . $filename, |
| 21 | + 'image/png' ); |
| 22 | + $actual = $this->handler->isAnimatedImage( $file ); |
| 23 | + $this->assertEquals( $expected, $actual ); |
| 24 | + } |
| 25 | + public function dataIsAnimated() { |
| 26 | + return array( |
| 27 | + array( 'Animated_PNG_example_bouncing_beach_ball.png', true ), |
| 28 | + array( '1bit-png.png', false ), |
| 29 | + ); |
| 30 | + } |
| 31 | + |
| 32 | + /** |
| 33 | + * @param $filename String |
| 34 | + * @param $expected Integer Total image area |
| 35 | + * @dataProvider dataGetImageArea |
| 36 | + */ |
| 37 | + public function testGetImageArea( $filename, $expected ) { |
| 38 | + $file = UnregisteredLocalFile::newFromPath( $this->filePath . $filename, |
| 39 | + 'image/png' ); |
| 40 | + $actual = $this->handler->getImageArea( $file, $file->getWidth(), $file->getHeight() ); |
| 41 | + $this->assertEquals( $expected, $actual ); |
| 42 | + } |
| 43 | + public function dataGetImageArea() { |
| 44 | + return array( |
| 45 | + array( '1bit-png.png', 2500 ), |
| 46 | + array( 'greyscale-png.png', 2500 ), |
| 47 | + array( 'Png-native-test.png', 126000 ), |
| 48 | + array( 'Animated_PNG_example_bouncing_beach_ball.png', 10000 ), |
| 49 | + ); |
| 50 | + } |
| 51 | + |
| 52 | + /** |
| 53 | + * @param $metadata String Serialized metadata |
| 54 | + * @param $expected Integer One of the class constants of PNGHandler |
| 55 | + * @dataProvider dataIsMetadataValid |
| 56 | + */ |
| 57 | + public function testIsMetadataValid( $metadata, $expected ) { |
| 58 | + $actual = $this->handler->isMetadataValid( null, $metadata ); |
| 59 | + $this->assertEquals( $expected, $actual ); |
| 60 | + } |
| 61 | + public function dataIsMetadataValid() { |
| 62 | + return array( |
| 63 | + array( PNGHandler::BROKEN_FILE, PNGHandler::METADATA_GOOD ), |
| 64 | + array( '', PNGHandler::METADATA_BAD ), |
| 65 | + array( null, PNGHandler::METADATA_BAD ), |
| 66 | + array( 'Something invalid!', PNGHandler::METADATA_BAD ), |
| 67 | + array( 'a:6:{s:10:"frameCount";i:0;s:9:"loopCount";i:1;s:8:"duration";d:0;s:8:"bitDepth";i:8;s:9:"colorType";s:10:"truecolour";s:8:"metadata";a:1:{s:15:"_MW_PNG_VERSION";i:1;}}', PNGHandler::METADATA_GOOD ), |
| 68 | + ); |
| 69 | + } |
| 70 | + |
| 71 | + /** |
| 72 | + * @param $filename String |
| 73 | + * @param $expected String Serialized array |
| 74 | + * @dataProvider dataGetMetadata |
| 75 | + */ |
| 76 | + public function testGetMetadata( $filename, $expected ) { |
| 77 | + $file = UnregisteredLocalFile::newFromPath( $this->filePath . $filename, |
| 78 | + 'image/png' ); |
| 79 | + $actual = $this->handler->getMetadata( $file, $this->filePath . $filename ); |
| 80 | +// $this->assertEquals( unserialize( $expected ), unserialize( $actual ) ); |
| 81 | + $this->assertEquals( ( $expected ), ( $actual ) ); |
| 82 | + } |
| 83 | + public function dataGetMetadata() { |
| 84 | + return array( |
| 85 | + array( 'rgb-na-png.png', 'a:6:{s:10:"frameCount";i:0;s:9:"loopCount";i:1;s:8:"duration";d:0;s:8:"bitDepth";i:8;s:9:"colorType";s:10:"truecolour";s:8:"metadata";a:1:{s:15:"_MW_PNG_VERSION";i:1;}}' ), |
| 86 | + array( 'xmp.png', 'a:6:{s:10:"frameCount";i:0;s:9:"loopCount";i:1;s:8:"duration";d:0;s:8:"bitDepth";i:1;s:9:"colorType";s:14:"index-coloured";s:8:"metadata";a:2:{s:12:"SerialNumber";s:9:"123456789";s:15:"_MW_PNG_VERSION";i:1;}}' ), |
| 87 | + ); |
| 88 | + } |
| 89 | +} |
Property changes on: trunk/phase3/tests/phpunit/includes/media/PNGTest.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 90 | + native |
Index: trunk/phase3/tests/phpunit/includes/media/TiffTest.php |
— | — | @@ -6,6 +6,7 @@ |
7 | 7 | $this->showExif = $wgShowEXIF; |
8 | 8 | $wgShowEXIF = true; |
9 | 9 | $this->filePath = dirname( __FILE__ ) . '/../../data/media/'; |
| 10 | + $this->handler = new TiffHandler; |
10 | 11 | } |
11 | 12 | |
12 | 13 | public function tearDown() { |
— | — | @@ -17,8 +18,7 @@ |
18 | 19 | if ( !wfDl( 'exif' ) ) { |
19 | 20 | $this->markTestIncomplete( "This test needs the exif extension." ); |
20 | 21 | } |
21 | | - $tiff = new TiffHandler; |
22 | | - $res = $tiff->getMetadata( null, $this->filePath . 'README' ); |
| 22 | + $res = $this->handler->getMetadata( null, $this->filePath . 'README' ); |
23 | 23 | $this->assertEquals( ExifBitmapHandler::BROKEN_FILE, $res ); |
24 | 24 | } |
25 | 25 | |
— | — | @@ -26,8 +26,7 @@ |
27 | 27 | if ( !wfDl( 'exif' ) ) { |
28 | 28 | $this->markTestIncomplete( "This test needs the exif extension." ); |
29 | 29 | } |
30 | | - $tiff = new TiffHandler; |
31 | | - $res = $tiff->getMetadata( null, $this->filePath . 'test.tiff' ); |
| 30 | + $res = $this->handler->getMetadata( null, $this->filePath . 'test.tiff' ); |
32 | 31 | $expected = 'a:16:{s:10:"ImageWidth";i:20;s:11:"ImageLength";i:20;s:13:"BitsPerSample";a:3:{i:0;i:8;i:1;i:8;i:2;i:8;}s:11:"Compression";i:5;s:25:"PhotometricInterpretation";i:2;s:16:"ImageDescription";s:17:"Created with GIMP";s:12:"StripOffsets";i:8;s:11:"Orientation";i:1;s:15:"SamplesPerPixel";i:3;s:12:"RowsPerStrip";i:64;s:15:"StripByteCounts";i:238;s:11:"XResolution";s:19:"1207959552/16777216";s:11:"YResolution";s:19:"1207959552/16777216";s:19:"PlanarConfiguration";i:1;s:14:"ResolutionUnit";i:2;s:22:"MEDIAWIKI_EXIF_VERSION";i:2;}'; |
33 | 32 | // Re-unserialize in case there are subtle differences between how versions |
34 | 33 | // of php serialize stuff. |
Index: trunk/phase3/tests/phpunit/includes/media/ExifBitmapTest.php |
— | — | @@ -6,6 +6,7 @@ |
7 | 7 | global $wgShowEXIF; |
8 | 8 | $this->showExif = $wgShowEXIF; |
9 | 9 | $wgShowEXIF = true; |
| 10 | + $this->handler = new ExifBitmapHandler; |
10 | 11 | } |
11 | 12 | |
12 | 13 | public function tearDown() { |
— | — | @@ -17,42 +18,37 @@ |
18 | 19 | if ( !wfDl( 'exif' ) ) { |
19 | 20 | $this->markTestIncomplete( "This test needs the exif extension." ); |
20 | 21 | } |
21 | | - $handler = new ExifBitmapHandler; |
22 | | - $res = $handler->isMetadataValid( null, ExifBitmapHandler::OLD_BROKEN_FILE ); |
| 22 | + $res = $this->handler->isMetadataValid( null, ExifBitmapHandler::OLD_BROKEN_FILE ); |
23 | 23 | $this->assertEquals( ExifBitmapHandler::METADATA_COMPATIBLE, $res ); |
24 | 24 | } |
25 | 25 | public function testIsBrokenFile() { |
26 | 26 | if ( !wfDl( 'exif' ) ) { |
27 | 27 | $this->markTestIncomplete( "This test needs the exif extension." ); |
28 | 28 | } |
29 | | - $handler = new ExifBitmapHandler; |
30 | | - $res = $handler->isMetadataValid( null, ExifBitmapHandler::BROKEN_FILE ); |
| 29 | + $res = $this->handler->isMetadataValid( null, ExifBitmapHandler::BROKEN_FILE ); |
31 | 30 | $this->assertEquals( ExifBitmapHandler::METADATA_GOOD, $res ); |
32 | 31 | } |
33 | 32 | public function testIsInvalid() { |
34 | 33 | if ( !wfDl( 'exif' ) ) { |
35 | 34 | $this->markTestIncomplete( "This test needs the exif extension." ); |
36 | 35 | } |
37 | | - $handler = new ExifBitmapHandler; |
38 | | - $res = $handler->isMetadataValid( null, 'Something Invalid Here.' ); |
| 36 | + $res = $this->handler->isMetadataValid( null, 'Something Invalid Here.' ); |
39 | 37 | $this->assertEquals( ExifBitmapHandler::METADATA_BAD, $res ); |
40 | 38 | } |
41 | 39 | public function testGoodMetadata() { |
42 | 40 | if ( !wfDl( 'exif' ) ) { |
43 | 41 | $this->markTestIncomplete( "This test needs the exif extension." ); |
44 | 42 | } |
45 | | - $handler = new ExifBitmapHandler; |
46 | 43 | $meta = 'a:16:{s:10:"ImageWidth";i:20;s:11:"ImageLength";i:20;s:13:"BitsPerSample";a:3:{i:0;i:8;i:1;i:8;i:2;i:8;}s:11:"Compression";i:5;s:25:"PhotometricInterpretation";i:2;s:16:"ImageDescription";s:17:"Created with GIMP";s:12:"StripOffsets";i:8;s:11:"Orientation";i:1;s:15:"SamplesPerPixel";i:3;s:12:"RowsPerStrip";i:64;s:15:"StripByteCounts";i:238;s:11:"XResolution";s:19:"1207959552/16777216";s:11:"YResolution";s:19:"1207959552/16777216";s:19:"PlanarConfiguration";i:1;s:14:"ResolutionUnit";i:2;s:22:"MEDIAWIKI_EXIF_VERSION";i:2;}'; |
47 | | - $res = $handler->isMetadataValid( null, $meta ); |
| 44 | + $res = $this->handler->isMetadataValid( null, $meta ); |
48 | 45 | $this->assertEquals( ExifBitmapHandler::METADATA_GOOD, $res ); |
49 | 46 | } |
50 | 47 | public function testIsOldGood() { |
51 | 48 | if ( !wfDl( 'exif' ) ) { |
52 | 49 | $this->markTestIncomplete( "This test needs the exif extension." ); |
53 | 50 | } |
54 | | - $handler = new ExifBitmapHandler; |
55 | 51 | $meta = 'a:16:{s:10:"ImageWidth";i:20;s:11:"ImageLength";i:20;s:13:"BitsPerSample";a:3:{i:0;i:8;i:1;i:8;i:2;i:8;}s:11:"Compression";i:5;s:25:"PhotometricInterpretation";i:2;s:16:"ImageDescription";s:17:"Created with GIMP";s:12:"StripOffsets";i:8;s:11:"Orientation";i:1;s:15:"SamplesPerPixel";i:3;s:12:"RowsPerStrip";i:64;s:15:"StripByteCounts";i:238;s:11:"XResolution";s:19:"1207959552/16777216";s:11:"YResolution";s:19:"1207959552/16777216";s:19:"PlanarConfiguration";i:1;s:14:"ResolutionUnit";i:2;s:22:"MEDIAWIKI_EXIF_VERSION";i:1;}'; |
56 | | - $res = $handler->isMetadataValid( null, $meta ); |
| 52 | + $res = $this->handler->isMetadataValid( null, $meta ); |
57 | 53 | $this->assertEquals( ExifBitmapHandler::METADATA_COMPATIBLE, $res ); |
58 | 54 | } |
59 | 55 | // Handle metadata from paged tiff handler (gotten via instant commons) |
— | — | @@ -61,9 +57,59 @@ |
62 | 58 | if ( !wfDl( 'exif' ) ) { |
63 | 59 | $this->markTestIncomplete( "This test needs the exif extension." ); |
64 | 60 | } |
65 | | - $handler = new ExifBitmapHandler; |
66 | 61 | $meta = 'a:6:{s:9:"page_data";a:1:{i:1;a:5:{s:5:"width";i:643;s:6:"height";i:448;s:5:"alpha";s:4:"true";s:4:"page";i:1;s:6:"pixels";i:288064;}}s:10:"page_count";i:1;s:10:"first_page";i:1;s:9:"last_page";i:1;s:4:"exif";a:9:{s:10:"ImageWidth";i:643;s:11:"ImageLength";i:448;s:11:"Compression";i:5;s:25:"PhotometricInterpretation";i:2;s:11:"Orientation";i:1;s:15:"SamplesPerPixel";i:4;s:12:"RowsPerStrip";i:50;s:19:"PlanarConfiguration";i:1;s:22:"MEDIAWIKI_EXIF_VERSION";i:1;}s:21:"TIFF_METADATA_VERSION";s:3:"1.4";}'; |
67 | | - $res = $handler->isMetadataValid( null, $meta ); |
| 62 | + $res = $this->handler->isMetadataValid( null, $meta ); |
68 | 63 | $this->assertEquals( ExifBitmapHandler::METADATA_BAD, $res ); |
69 | 64 | } |
| 65 | + |
| 66 | + function testConvertMetadataLatest() { |
| 67 | + $metadata = array( |
| 68 | + 'foo' => array( 'First', 'Second', '_type' => 'ol' ), |
| 69 | + 'MEDIAWIKI_EXIF_VERSION' => 2 |
| 70 | + ); |
| 71 | + $res = $this->handler->convertMetadataVersion( $metadata, 2 ); |
| 72 | + $this->assertEquals( $metadata, $res ); |
| 73 | + } |
| 74 | + function testConvertMetadataToOld() { |
| 75 | + $metadata = array( |
| 76 | + 'foo' => array( 'First', 'Second', '_type' => 'ol' ), |
| 77 | + 'bar' => array( 'First', 'Second', '_type' => 'ul' ), |
| 78 | + 'baz' => array( 'First', 'Second' ), |
| 79 | + 'fred' => 'Single', |
| 80 | + 'MEDIAWIKI_EXIF_VERSION' => 2, |
| 81 | + ); |
| 82 | + $expected = array( |
| 83 | + 'foo' => "\n#First\n#Second", |
| 84 | + 'bar' => "\n*First\n*Second", |
| 85 | + 'baz' => "\n*First\n*Second", |
| 86 | + 'fred' => 'Single', |
| 87 | + 'MEDIAWIKI_EXIF_VERSION' => 1, |
| 88 | + ); |
| 89 | + $res = $this->handler->convertMetadataVersion( $metadata, 1 ); |
| 90 | + $this->assertEquals( $expected, $res ); |
| 91 | + } |
| 92 | + function testConvertMetadataSoftware() { |
| 93 | + $metadata = array( |
| 94 | + 'Software' => array( array('GIMP', '1.1' ) ), |
| 95 | + 'MEDIAWIKI_EXIF_VERSION' => 2, |
| 96 | + ); |
| 97 | + $expected = array( |
| 98 | + 'Software' => 'GIMP (Version 1.1)', |
| 99 | + 'MEDIAWIKI_EXIF_VERSION' => 1, |
| 100 | + ); |
| 101 | + $res = $this->handler->convertMetadataVersion( $metadata, 1 ); |
| 102 | + $this->assertEquals( $expected, $res ); |
| 103 | + } |
| 104 | + function testConvertMetadataSoftwareNormal() { |
| 105 | + $metadata = array( |
| 106 | + 'Software' => array( "GIMP 1.2", "vim" ), |
| 107 | + 'MEDIAWIKI_EXIF_VERSION' => 2, |
| 108 | + ); |
| 109 | + $expected = array( |
| 110 | + 'Software' => "\n*GIMP 1.2\n*vim", |
| 111 | + 'MEDIAWIKI_EXIF_VERSION' => 1, |
| 112 | + ); |
| 113 | + $res = $this->handler->convertMetadataVersion( $metadata, 1 ); |
| 114 | + $this->assertEquals( $expected, $res ); |
| 115 | + } |
70 | 116 | } |
Index: trunk/phase3/tests/phpunit/data/media/jpeg-xmp-psir.jpg |
Cannot display: file marked as a binary type. |
svn:mime-type = image/jpeg |
Property changes on: trunk/phase3/tests/phpunit/data/media/jpeg-xmp-psir.jpg |
___________________________________________________________________ |
Added: svn:mime-type |
71 | 117 | + image/jpeg |
Index: trunk/phase3/tests/phpunit/data/media/jpeg-xmp-alt.jpg |
Cannot display: file marked as a binary type. |
svn:mime-type = image/jpeg |
Property changes on: trunk/phase3/tests/phpunit/data/media/jpeg-xmp-alt.jpg |
___________________________________________________________________ |
Added: svn:mime-type |
72 | 118 | + image/jpeg |
Index: trunk/phase3/tests/phpunit/data/media/animated.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = image/gif |
Property changes on: trunk/phase3/tests/phpunit/data/media/animated.gif |
___________________________________________________________________ |
Added: svn:mime-type |
73 | 119 | + image/gif |
Index: trunk/phase3/tests/phpunit/data/media/exif-user-comment.jpg |
Cannot display: file marked as a binary type. |
svn:mime-type = image/jpeg |
Property changes on: trunk/phase3/tests/phpunit/data/media/exif-user-comment.jpg |
___________________________________________________________________ |
Added: svn:mime-type |
74 | 120 | + image/jpeg |
Index: trunk/phase3/tests/phpunit/data/media/animated-xmp.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = image/gif |
Property changes on: trunk/phase3/tests/phpunit/data/media/animated-xmp.gif |
___________________________________________________________________ |
Added: svn:mime-type |
75 | 121 | + image/gif |
Index: trunk/phase3/tests/phpunit/data/media/iptc-timetest-invalid.jpg |
Cannot display: file marked as a binary type. |
svn:mime-type = image/jpeg |
Property changes on: trunk/phase3/tests/phpunit/data/media/iptc-timetest-invalid.jpg |
___________________________________________________________________ |
Added: svn:mime-type |
76 | 122 | + image/jpeg |
Index: trunk/phase3/tests/phpunit/data/media/jpeg-iptc-bad-hash.jpg |
Cannot display: file marked as a binary type. |
svn:mime-type = image/jpeg |
Property changes on: trunk/phase3/tests/phpunit/data/media/jpeg-iptc-bad-hash.jpg |
___________________________________________________________________ |
Added: svn:mime-type |
77 | 123 | + image/jpeg |
Index: trunk/phase3/tests/phpunit/data/media/iptc-timetest.jpg |
Cannot display: file marked as a binary type. |
svn:mime-type = image/jpeg |
Property changes on: trunk/phase3/tests/phpunit/data/media/iptc-timetest.jpg |
___________________________________________________________________ |
Added: svn:mime-type |
78 | 124 | + image/jpeg |
Index: trunk/phase3/tests/phpunit/data/media/xmp.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/phase3/tests/phpunit/data/media/xmp.png |
___________________________________________________________________ |
Added: svn:mime-type |
79 | 125 | + image/png |
Index: trunk/phase3/tests/phpunit/data/media/README |
— | — | @@ -22,7 +22,10 @@ |
23 | 23 | greyscale-na-png.png, rgb-png.png, Xmp-exif-multilingual_test.jpg |
24 | 24 | greyscale-png.png, 1bit-png.png, Png-native-test.png, rgb-na-png.png, |
25 | 25 | test.tiff, test.jpg, jpeg-comment-multiple.jpg, jpeg-comment-utf.jpg, |
26 | | -jpeg-comment-iso8859-1.jpg, jpeg-comment-binary.jpg |
| 26 | +jpeg-comment-iso8859-1.jpg, jpeg-comment-binary.jpg, jpeg-xmp-psir.jpg, |
| 27 | +jpeg-xmp-alt.jpg, animated.gif, exif-user-comment.jpg, animated-xmp.gif, |
| 28 | +iptc-timetest-invalid.jpg, jpeg-iptc-bad-hash.jpg, iptc-timetest.jpg, |
| 29 | +xmp.png, nonanimated.gif, exif-gps.jpg, jpeg-xmp-psir.xmp, jpeg-iptc-good-hash.jpg |
27 | 30 | Are all by Bawolff. I don't think they contain enough originality to |
28 | 31 | claim copyright, but on the off chance they do, feel free to use them |
29 | 32 | however you feel fit, without restriction. |
Index: trunk/phase3/tests/phpunit/data/media/exif-gps.jpg |
Cannot display: file marked as a binary type. |
svn:mime-type = image/jpeg |
Property changes on: trunk/phase3/tests/phpunit/data/media/exif-gps.jpg |
___________________________________________________________________ |
Added: svn:mime-type |
30 | 33 | + image/jpeg |
Index: trunk/phase3/tests/phpunit/data/media/nonanimated.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = image/gif |
Property changes on: trunk/phase3/tests/phpunit/data/media/nonanimated.gif |
___________________________________________________________________ |
Added: svn:mime-type |
31 | 34 | + image/gif |
Index: trunk/phase3/tests/phpunit/data/media/jpeg-xmp-psir.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/media/jpeg-xmp-psir.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
32 | 35 | + application/rdf+xml |
Index: trunk/phase3/tests/phpunit/data/media/jpeg-iptc-good-hash.jpg |
Cannot display: file marked as a binary type. |
svn:mime-type = image/jpeg |
Property changes on: trunk/phase3/tests/phpunit/data/media/jpeg-iptc-good-hash.jpg |
___________________________________________________________________ |
Added: svn:mime-type |
33 | 36 | + image/jpeg |
Index: trunk/phase3/tests/phpunit/data/xmp/utf16BE.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/utf16BE.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
34 | 37 | + application/rdf+xml |
Index: trunk/phase3/tests/phpunit/data/xmp/utf32LE.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/utf32LE.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
35 | 38 | + application/rdf+xml |
Index: trunk/phase3/tests/phpunit/data/xmp/utf16LE.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/utf16LE.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
36 | 39 | + application/rdf+xml |
Index: trunk/phase3/tests/phpunit/data/xmp/3-invalid.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/3-invalid.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
37 | 40 | + application/rdf+xml |
Index: trunk/phase3/tests/phpunit/data/xmp/flash.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/flash.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
38 | 41 | + application/rdf+xml |
Index: trunk/phase3/tests/phpunit/data/xmp/flash.result.php |
— | — | @@ -0,0 +1,8 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$result = array( 'xmp-exif' => |
| 5 | + array( |
| 6 | + 'DigitalZoomRatio' => '0/10', |
| 7 | + 'Flash' => '127' |
| 8 | + ) |
| 9 | +); |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/flash.result.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 10 | + native |
Index: trunk/phase3/tests/phpunit/data/xmp/1.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/1.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 11 | + application/rdf+xml |
Index: trunk/phase3/tests/phpunit/data/xmp/2.result.php |
— | — | @@ -0,0 +1,8 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$result = array( 'xmp-exif' => |
| 5 | + array( |
| 6 | + 'DigitalZoomRatio' => '0/10', |
| 7 | + 'Flash' => '9' |
| 8 | + ) |
| 9 | +); |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/2.result.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 10 | + native |
Index: trunk/phase3/tests/phpunit/data/xmp/2.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/2.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 11 | + application/rdf+xml |
Index: trunk/phase3/tests/phpunit/data/xmp/3.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/3.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
3 | 12 | + application/rdf+xml |
Index: trunk/phase3/tests/phpunit/data/xmp/bag-for-seq.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/bag-for-seq.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
4 | 13 | + application/rdf+xml |
Index: trunk/phase3/tests/phpunit/data/xmp/bag-for-seq.result.php |
— | — | @@ -0,0 +1,10 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$result = array( |
| 5 | + 'xmp-general' => array( |
| 6 | + 'Artist' => array( |
| 7 | + '_type' => 'ul', |
| 8 | + 0 => 'The author', |
| 9 | + ) |
| 10 | + ) |
| 11 | +); |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/bag-for-seq.result.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 12 | + native |
Index: trunk/phase3/tests/phpunit/data/xmp/4.result.php |
— | — | @@ -0,0 +1,7 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$result = array( 'xmp-exif' => |
| 5 | + array( |
| 6 | + 'DigitalZoomRatio' => '0/10', |
| 7 | + ) |
| 8 | +); |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/4.result.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 9 | + native |
Index: trunk/phase3/tests/phpunit/data/xmp/4.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/4.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 10 | + application/rdf+xml |
Index: trunk/phase3/tests/phpunit/data/xmp/no-recognized-props.result.php |
— | — | @@ -0,0 +1,2 @@ |
| 2 | +<?php |
| 3 | +$result = array(); |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/no-recognized-props.result.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 4 | + native |
Index: trunk/phase3/tests/phpunit/data/xmp/5.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/5.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 5 | + application/rdf+xml |
Index: trunk/phase3/tests/phpunit/data/xmp/6.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/6.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
3 | 6 | + application/rdf+xml |
Index: trunk/phase3/tests/phpunit/data/xmp/6.result.php |
— | — | @@ -0,0 +1,8 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$result = array( 'xmp-exif' => |
| 5 | + array( |
| 6 | + 'DigitalZoomRatio' => '0/10', |
| 7 | + 'Flash' => '9' |
| 8 | + ) |
| 9 | +); |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/6.result.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 10 | + native |
Index: trunk/phase3/tests/phpunit/data/xmp/7.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/7.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 11 | + application/rdf+xml |
Index: trunk/phase3/tests/phpunit/data/xmp/no-namespace.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/no-namespace.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
3 | 12 | + application/rdf+xml |
Index: trunk/phase3/tests/phpunit/data/xmp/xmpExt2.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/xmpExt2.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
4 | 13 | + application/rdf+xml |
Index: trunk/phase3/tests/phpunit/data/xmp/utf32BE.result.php |
— | — | @@ -0,0 +1,12 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$result = array( |
| 5 | + 'xmp-exif' => |
| 6 | + array( |
| 7 | + 'DigitalZoomRatio' => '0/10', |
| 8 | + ), |
| 9 | + 'xmp-general' => |
| 10 | + array( |
| 11 | + 'Label' => '' |
| 12 | + ), |
| 13 | +); |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/utf32BE.result.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 14 | + native |
Index: trunk/phase3/tests/phpunit/data/xmp/utf16BE.result.php |
— | — | @@ -0,0 +1,12 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$result = array( |
| 5 | + 'xmp-exif' => |
| 6 | + array( |
| 7 | + 'DigitalZoomRatio' => '0/10', |
| 8 | + ), |
| 9 | + 'xmp-general' => |
| 10 | + array( |
| 11 | + 'Label' => '' |
| 12 | + ), |
| 13 | +); |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/utf16BE.result.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 14 | + native |
Index: trunk/phase3/tests/phpunit/data/xmp/utf32LE.result.php |
— | — | @@ -0,0 +1,12 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$result = array( |
| 5 | + 'xmp-exif' => |
| 6 | + array( |
| 7 | + 'DigitalZoomRatio' => '0/10', |
| 8 | + ), |
| 9 | + 'xmp-general' => |
| 10 | + array( |
| 11 | + 'Label' => '' |
| 12 | + ), |
| 13 | +); |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/utf32LE.result.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 14 | + native |
Index: trunk/phase3/tests/phpunit/data/xmp/xmpExt.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/xmpExt.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 15 | + application/rdf+xml |
Index: trunk/phase3/tests/phpunit/data/xmp/xmpExt.result.php |
— | — | @@ -0,0 +1,8 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$result = array( 'xmp-exif' => |
| 5 | + array( |
| 6 | + 'DigitalZoomRatio' => '0/10', |
| 7 | + 'Flash' => '9' |
| 8 | + ) |
| 9 | +); |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/xmpExt.result.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 10 | + native |
Index: trunk/phase3/tests/phpunit/data/xmp/3-invalid.result.php |
— | — | @@ -0,0 +1,7 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$result = array( 'xmp-exif' => |
| 5 | + array( |
| 6 | + 'DigitalZoomRatio' => '0/10', |
| 7 | + ) |
| 8 | +); |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/3-invalid.result.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 9 | + native |
Index: trunk/phase3/tests/phpunit/data/xmp/utf16LE.result.php |
— | — | @@ -0,0 +1,12 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$result = array( |
| 5 | + 'xmp-exif' => |
| 6 | + array( |
| 7 | + 'DigitalZoomRatio' => '0/10', |
| 8 | + ), |
| 9 | + 'xmp-general' => |
| 10 | + array( |
| 11 | + 'Label' => '' |
| 12 | + ), |
| 13 | +); |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/utf16LE.result.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 14 | + native |
Index: trunk/phase3/tests/phpunit/data/xmp/invalid-child-not-struct.result.php |
— | — | @@ -0,0 +1,7 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$result = array( 'xmp-exif' => |
| 5 | + array( |
| 6 | + 'DigitalZoomRatio' => '0/10', |
| 7 | + ) |
| 8 | +); |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/invalid-child-not-struct.result.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 9 | + native |
Index: trunk/phase3/tests/phpunit/data/xmp/invalid-child-not-struct.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/invalid-child-not-struct.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 10 | + application/rdf+xml |
Index: trunk/phase3/tests/phpunit/data/xmp/README |
— | — | @@ -0,0 +1,3 @@ |
| 2 | +This directory contains a bunch of XMP files |
| 3 | +as well as a bunch of php files containing what the |
| 4 | +parsed version of the XMP looks like. |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/README |
___________________________________________________________________ |
Added: svn:mime-type |
1 | 5 | + text/plain |
Added: svn:eol-style |
2 | 6 | + native |
Index: trunk/phase3/tests/phpunit/data/xmp/1.result.php |
— | — | @@ -0,0 +1,8 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$result = array( 'xmp-exif' => |
| 5 | + array( |
| 6 | + 'DigitalZoomRatio' => '0/10', |
| 7 | + 'Flash' => '9' |
| 8 | + ) |
| 9 | +); |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/1.result.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 10 | + native |
Index: trunk/phase3/tests/phpunit/data/xmp/3.result.php |
— | — | @@ -0,0 +1,8 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$result = array( 'xmp-exif' => |
| 5 | + array( |
| 6 | + 'DigitalZoomRatio' => '0/10', |
| 7 | + 'Flash' => '9' |
| 8 | + ) |
| 9 | +); |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/3.result.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 10 | + native |
Index: trunk/phase3/tests/phpunit/data/xmp/no-recognized-props.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/no-recognized-props.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 11 | + application/rdf+xml |
Index: trunk/phase3/tests/phpunit/data/xmp/5.result.php |
— | — | @@ -0,0 +1,7 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$result = array( 'xmp-exif' => |
| 5 | + array( |
| 6 | + 'DigitalZoomRatio' => '0/10', |
| 7 | + ) |
| 8 | +); |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/5.result.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 9 | + native |
Index: trunk/phase3/tests/phpunit/data/xmp/no-namespace.result.php |
— | — | @@ -0,0 +1,7 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$result = array( 'xmp-exif' => |
| 5 | + array( |
| 6 | + 'FNumber' => '28/10', |
| 7 | + ) |
| 8 | +); |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/no-namespace.result.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 9 | + native |
Index: trunk/phase3/tests/phpunit/data/xmp/7.result.php |
— | — | @@ -0,0 +1,52 @@ |
| 2 | +<?php |
| 3 | +$result = array ( |
| 4 | + 'xmp-exif' => |
| 5 | + array ( |
| 6 | + 'CameraOwnerName' => 'Me!', |
| 7 | + ), |
| 8 | + 'xmp-general' => |
| 9 | + array ( |
| 10 | + 'LicenseUrl' => 'http://creativecommons.com/cc-by-2.9', |
| 11 | + 'ImageDescription' => |
| 12 | + array ( |
| 13 | + 'x-default' => 'Test image for the cc: xmp: xmpRights: namespaces in xmp', |
| 14 | + '_type' => 'lang', |
| 15 | + ), |
| 16 | + 'ObjectName' => |
| 17 | + array ( |
| 18 | + 'x-default' => 'xmp core/xmp rights/cc ns test', |
| 19 | + '_type' => 'lang', |
| 20 | + ), |
| 21 | + 'DateTimeDigitized' => '2005:04:03', |
| 22 | + 'Software' => 'The one true editor: Vi (ok i used gimp)', |
| 23 | + 'Identifier' => |
| 24 | + array ( |
| 25 | + 0 => 'http://example.com/identifierurl', |
| 26 | + 1 => 'urn:sha1:342524abcdef', |
| 27 | + '_type' => 'ul', |
| 28 | + ), |
| 29 | + 'Label' => 'Test image', |
| 30 | + 'DateTimeMetadata' => '2011:05:12', |
| 31 | + 'DateTime' => '2007:03:04 06:34:10', |
| 32 | + 'Nickname' => 'My little xmp test image', |
| 33 | + 'Rating' => '5', |
| 34 | + 'RightsCertificate' => 'http://example.com/rights-certificate/', |
| 35 | + 'Copyrighted' => 'True', |
| 36 | + 'CopyrightOwner' => |
| 37 | + array ( |
| 38 | + 0 => 'Bawolff is copyright owner', |
| 39 | + '_type' => 'ul', |
| 40 | + ), |
| 41 | + 'UsageTerms' => |
| 42 | + array ( |
| 43 | + 'x-default' => 'do whatever you want', |
| 44 | + 'en-gb' => 'Do whatever you want in british english', |
| 45 | + '_type' => 'lang', |
| 46 | + ), |
| 47 | + 'WebStatement' => 'http://example.com/web_statement', |
| 48 | + ), |
| 49 | + 'xmp-deprecated' => |
| 50 | + array ( |
| 51 | + 'Identifier' => 'http://example.com/identifierurl/wrong', |
| 52 | + ), |
| 53 | +); |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/7.result.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 54 | + native |
Index: trunk/phase3/tests/phpunit/data/xmp/utf32BE.xmp |
Cannot display: file marked as a binary type. |
svn:mime-type = application/rdf+xml |
Property changes on: trunk/phase3/tests/phpunit/data/xmp/utf32BE.xmp |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 55 | + application/rdf+xml |