Fix XMP parser errors due to trailing nullchar
[lhc/web/wiklou.git] / tests / phpunit / includes / media / JpegMetadataExtractorTest.php
index c943cef..b745152 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /**
  * @todo Could use a test of extended XMP segments. Hard to find programs that
- * create example files, and creating my own in vim propbably wouldn't
+ * create example files, and creating my own in vim probably wouldn't
  * serve as a very good "test". (Adobe photoshop probably creates such files
  * but it costs money). The implementation of it currently in MediaWiki is based
  * solely on reading the standard, without any real world test files.
@@ -76,6 +76,12 @@ class JpegMetadataExtractorTest extends MediaWikiTestCase {
                $this->assertEquals( $expected, bin2hex( $res['PSIR'][0] ) );
        }
 
+       public function testXMPExtractionNullChar() {
+               $res = JpegMetadataExtractor::segmentSplitter( $this->filePath . 'jpeg-xmp-nullchar.jpg' );
+               $expected = file_get_contents( $this->filePath . 'jpeg-xmp-psir.xmp' );
+               $this->assertEquals( $expected, $res['XMP'] );
+       }
+
        public function testXMPExtractionAltAppId() {
                $res = JpegMetadataExtractor::segmentSplitter( $this->filePath . 'jpeg-xmp-alt.jpg' );
                $expected = file_get_contents( $this->filePath . 'jpeg-xmp-psir.xmp' );