r100576 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100575‎ | r100576 | r100577 >
Date:02:47, 24 October 2011
Author:bawolff
Status:ok (Comments)
Tags:
Comment:
(follow-up r100575 / r99477) unit-tests for jpegMetadataExtractor dealing with padding bytes.
Modified paths:
  • /trunk/phase3/tests/phpunit/data/media/README (modified) (history)
  • /trunk/phase3/tests/phpunit/data/media/jpeg-padding-even.jpg (added) (history)
  • /trunk/phase3/tests/phpunit/data/media/jpeg-padding-odd.jpg (added) (history)
  • /trunk/phase3/tests/phpunit/includes/media/JpegMetadataExtractorTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/media/JpegMetadataExtractorTest.php
@@ -12,10 +12,25 @@
1313 $this->filePath = dirname( __FILE__ ) . '/../../data/media/';
1414 }
1515
16 - public function testUtf8Comment() {
17 - $res = JpegMetadataExtractor::segmentSplitter( $this->filePath . 'jpeg-comment-utf.jpg' );
 16+ /**
 17+ * We also use this test to test padding bytes don't
 18+ * screw stuff up
 19+ *
 20+ * @param $file filename
 21+ *
 22+ * @dataProvider dataUtf8Comment
 23+ */
 24+ public function testUtf8Comment( $file ) {
 25+ $res = JpegMetadataExtractor::segmentSplitter( $this->filePath . $file );
1826 $this->assertEquals( array( 'UTF-8 JPEG Comment — ¼' ), $res['COM'] );
1927 }
 28+ public function dataUtf8Comment() {
 29+ return array(
 30+ array( 'jpeg-comment-utf.jpg' ),
 31+ array( 'jpeg-padding-even.jpg' ),
 32+ array( 'jpeg-padding-odd.jpg' ),
 33+ );
 34+ }
2035 /** The file is iso-8859-1, but it should get auto converted */
2136 public function testIso88591Comment() {
2237 $res = JpegMetadataExtractor::segmentSplitter( $this->filePath . 'jpeg-comment-iso8859-1.jpg' );
Index: trunk/phase3/tests/phpunit/data/media/jpeg-padding-even.jpg
Cannot display: file marked as a binary type.
svn:mime-type = image/jpeg
Property changes on: trunk/phase3/tests/phpunit/data/media/jpeg-padding-even.jpg
___________________________________________________________________
Added: svn:mime-type
2338 + image/jpeg
Index: trunk/phase3/tests/phpunit/data/media/README
@@ -25,7 +25,8 @@
2626 jpeg-comment-iso8859-1.jpg, jpeg-comment-binary.jpg, jpeg-xmp-psir.jpg,
2727 jpeg-xmp-alt.jpg, animated.gif, exif-user-comment.jpg, animated-xmp.gif,
2828 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
 29+xmp.png, nonanimated.gif, exif-gps.jpg, jpeg-xmp-psir.xmp, jpeg-iptc-good-hash.jpg,
 30+jpeg-padding-even.jpg, jpeg-padding-odd.jpg
3031 Are all by Bawolff. I don't think they contain enough originality to
3132 claim copyright, but on the off chance they do, feel free to use them
3233 however you feel fit, without restriction.
Index: trunk/phase3/tests/phpunit/data/media/jpeg-padding-odd.jpg
Cannot display: file marked as a binary type.
svn:mime-type = image/jpeg
Property changes on: trunk/phase3/tests/phpunit/data/media/jpeg-padding-odd.jpg
___________________________________________________________________
Added: svn:mime-type
3334 + image/jpeg

Follow-up revisions

RevisionCommit summaryAuthorDate
r102528REL1_18 MFT r94867, r95163, r100576reedy16:22, 9 November 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r99477(bug 31588, sort of) Jpeg metadata code wasn't handling padding bytes properly....bawolff14:05, 11 October 2011
r100575(follow up r99477) not sure what I was doing on r99477, but its not right (do...bawolff02:41, 24 October 2011

Comments

#Comment by Hashar (talk | contribs)   09:53, 8 November 2011

tagging for 1.18, we want tests!

Status & tagging log