diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
commit | 63601400e476c6cf43d985f3e7b9864681695ed4 (patch) | |
tree | f7846203a952e38aaf66989d0a4702779f549962 /tests/phpunit/includes/media | |
parent | 8ff01378c9e0207f9169b81966a51def645b6a51 (diff) |
Update to MediaWiki 1.20.2
this update includes:
* adjusted Arch Linux skin
* updated FluxBBAuthPlugin
* patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024
Diffstat (limited to 'tests/phpunit/includes/media')
-rw-r--r-- | tests/phpunit/includes/media/BitmapMetadataHandlerTest.php | 5 | ||||
-rw-r--r-- | tests/phpunit/includes/media/ExifRotationTest.php | 20 | ||||
-rw-r--r-- | tests/phpunit/includes/media/ExifTest.php | 22 | ||||
-rw-r--r-- | tests/phpunit/includes/media/FormatMetadataTest.php | 2 | ||||
-rw-r--r-- | tests/phpunit/includes/media/GIFMetadataExtractorTest.php | 2 | ||||
-rw-r--r-- | tests/phpunit/includes/media/GIFTest.php | 2 | ||||
-rw-r--r-- | tests/phpunit/includes/media/JpegMetadataExtractorTest.php | 2 | ||||
-rw-r--r-- | tests/phpunit/includes/media/JpegTest.php | 2 | ||||
-rw-r--r-- | tests/phpunit/includes/media/PNGMetadataExtractorTest.php | 2 | ||||
-rw-r--r-- | tests/phpunit/includes/media/PNGTest.php | 2 | ||||
-rw-r--r-- | tests/phpunit/includes/media/SVGMetadataExtractorTest.php | 24 | ||||
-rw-r--r-- | tests/phpunit/includes/media/TiffTest.php | 2 | ||||
-rw-r--r-- | tests/phpunit/includes/media/XMPTest.php | 11 |
13 files changed, 48 insertions, 50 deletions
diff --git a/tests/phpunit/includes/media/BitmapMetadataHandlerTest.php b/tests/phpunit/includes/media/BitmapMetadataHandlerTest.php index f4f52dd8..88f87ef9 100644 --- a/tests/phpunit/includes/media/BitmapMetadataHandlerTest.php +++ b/tests/phpunit/includes/media/BitmapMetadataHandlerTest.php @@ -2,7 +2,7 @@ class BitmapMetadataHandlerTest extends MediaWikiTestCase { public function setUp() { - $this->filePath = dirname( __FILE__ ) . '/../../data/media/'; + $this->filePath = __DIR__ . '/../../data/media/'; } /** @@ -73,7 +73,8 @@ class BitmapMetadataHandlerTest extends MediaWikiTestCase { $this->assertEquals( '2020:07:14 01:36:05', $meta['DateTimeDigitized'] ); $this->assertEquals( '1997:03:02 00:01:02', $meta['DateTimeOriginal'] ); } - /* File has an invalid time (+ one valid but really weird time) + /** + * File has an invalid time (+ one valid but really weird time) * that shouldn't be included */ public function testIPTCDatesInvalid() { diff --git a/tests/phpunit/includes/media/ExifRotationTest.php b/tests/phpunit/includes/media/ExifRotationTest.php index 25149a05..6af52dd1 100644 --- a/tests/phpunit/includes/media/ExifRotationTest.php +++ b/tests/phpunit/includes/media/ExifRotationTest.php @@ -5,16 +5,12 @@ */ class ExifRotationTest extends MediaWikiTestCase { - /** track directories creations. Content will be deleted. */ - private $createdDirs = array(); - function setUp() { parent::setUp(); $this->handler = new BitmapHandler(); - $filePath = dirname( __FILE__ ) . '/../../data/media'; + $filePath = __DIR__ . '/../../data/media'; - $tmpDir = wfTempDir() . '/exif-test-' . time() . '-' . mt_rand(); - $this->createdDirs[] = $tmpDir; + $tmpDir = $this->getNewTempDirectory(); $this->repo = new FSRepo( array( 'name' => 'temp', @@ -42,17 +38,7 @@ class ExifRotationTest extends MediaWikiTestCase { $wgShowEXIF = $this->show; $wgEnableAutoRotation = $this->oldAuto; - $this->tearDownFiles(); - } - - private function tearDownFiles() { - foreach( $this->createdDirs as $dir ) { - wfRecursiveRemoveDir( $dir ); - } - } - - function __destruct() { - $this->tearDownFiles(); + parent::tearDown(); } /** diff --git a/tests/phpunit/includes/media/ExifTest.php b/tests/phpunit/includes/media/ExifTest.php index b39c15e4..045777d7 100644 --- a/tests/phpunit/includes/media/ExifTest.php +++ b/tests/phpunit/includes/media/ExifTest.php @@ -2,22 +2,22 @@ class ExifTest extends MediaWikiTestCase { public function setUp() { - $this->mediaPath = dirname( __FILE__ ) . '/../../data/media/'; + $this->mediaPath = __DIR__ . '/../../data/media/'; if ( !wfDl( 'exif' ) ) { $this->markTestSkipped( "This test needs the exif extension." ); } - global $wgShowEXIF; - $this->showExif = $wgShowEXIF; - $wgShowEXIF = true; + global $wgShowEXIF; + $this->showExif = $wgShowEXIF; + $wgShowEXIF = true; } - public function tearDown() { - global $wgShowEXIF; - $wgShowEXIF = $this->showExif; - } - public function testGPSExtraction() { + public function tearDown() { + global $wgShowEXIF; + $wgShowEXIF = $this->showExif; + } + public function testGPSExtraction() { $filename = $this->mediaPath . 'exif-gps.jpg'; $seg = JpegMetadataExtractor::segmentSplitter( $filename ); $exif = new Exif( $filename, $seg['byteOrder'] ); @@ -25,14 +25,14 @@ class ExifTest extends MediaWikiTestCase { $expected = array( 'GPSLatitude' => 88.5180555556, 'GPSLongitude' => -21.12357, - 'GPSAltitude' => -200, + 'GPSAltitude' => -3.141592653, 'GPSDOP' => '5/1', 'GPSVersionID' => '2.2.0.0', ); $this->assertEquals( $expected, $data, '', 0.0000000001 ); } - public function testUnicodeUserComment() { + public function testUnicodeUserComment() { $filename = $this->mediaPath . 'exif-user-comment.jpg'; $seg = JpegMetadataExtractor::segmentSplitter( $filename ); $exif = new Exif( $filename, $seg['byteOrder'] ); diff --git a/tests/phpunit/includes/media/FormatMetadataTest.php b/tests/phpunit/includes/media/FormatMetadataTest.php index 8a632f52..6ade6702 100644 --- a/tests/phpunit/includes/media/FormatMetadataTest.php +++ b/tests/phpunit/includes/media/FormatMetadataTest.php @@ -4,7 +4,7 @@ class FormatMetadataTest extends MediaWikiTestCase { if ( !wfDl( 'exif' ) ) { $this->markTestSkipped( "This test needs the exif extension." ); } - $filePath = dirname( __FILE__ ) . '/../../data/media'; + $filePath = __DIR__ . '/../../data/media'; $this->backend = new FSFileBackend( array( 'name' => 'localtesting', 'lockManager' => 'nullLockManager', diff --git a/tests/phpunit/includes/media/GIFMetadataExtractorTest.php b/tests/phpunit/includes/media/GIFMetadataExtractorTest.php index 47fc368b..650fdd5c 100644 --- a/tests/phpunit/includes/media/GIFMetadataExtractorTest.php +++ b/tests/phpunit/includes/media/GIFMetadataExtractorTest.php @@ -2,7 +2,7 @@ class GIFMetadataExtractorTest extends MediaWikiTestCase { public function setUp() { - $this->mediaPath = dirname( __FILE__ ) . '/../../data/media/'; + $this->mediaPath = __DIR__ . '/../../data/media/'; } /** * Put in a file, and see if the metadata coming out is as expected. diff --git a/tests/phpunit/includes/media/GIFTest.php b/tests/phpunit/includes/media/GIFTest.php index 36658358..5dcbeee0 100644 --- a/tests/phpunit/includes/media/GIFTest.php +++ b/tests/phpunit/includes/media/GIFTest.php @@ -2,7 +2,7 @@ class GIFHandlerTest extends MediaWikiTestCase { public function setUp() { - $this->filePath = dirname( __FILE__ ) . '/../../data/media'; + $this->filePath = __DIR__ . '/../../data/media'; $this->backend = new FSFileBackend( array( 'name' => 'localtesting', 'lockManager' => 'nullLockManager', diff --git a/tests/phpunit/includes/media/JpegMetadataExtractorTest.php b/tests/phpunit/includes/media/JpegMetadataExtractorTest.php index f48382a4..41d81190 100644 --- a/tests/phpunit/includes/media/JpegMetadataExtractorTest.php +++ b/tests/phpunit/includes/media/JpegMetadataExtractorTest.php @@ -9,7 +9,7 @@ class JpegMetadataExtractorTest extends MediaWikiTestCase { public function setUp() { - $this->filePath = dirname( __FILE__ ) . '/../../data/media/'; + $this->filePath = __DIR__ . '/../../data/media/'; } /** diff --git a/tests/phpunit/includes/media/JpegTest.php b/tests/phpunit/includes/media/JpegTest.php index ddabf5b8..ea007f90 100644 --- a/tests/phpunit/includes/media/JpegTest.php +++ b/tests/phpunit/includes/media/JpegTest.php @@ -2,7 +2,7 @@ class JpegTest extends MediaWikiTestCase { public function setUp() { - $this->filePath = dirname( __FILE__ ) . '/../../data/media/'; + $this->filePath = __DIR__ . '/../../data/media/'; if ( !wfDl( 'exif' ) ) { $this->markTestSkipped( "This test needs the exif extension." ); } diff --git a/tests/phpunit/includes/media/PNGMetadataExtractorTest.php b/tests/phpunit/includes/media/PNGMetadataExtractorTest.php index 9f702c50..1b1b2ec3 100644 --- a/tests/phpunit/includes/media/PNGMetadataExtractorTest.php +++ b/tests/phpunit/includes/media/PNGMetadataExtractorTest.php @@ -2,7 +2,7 @@ class PNGMetadataExtractorTest extends MediaWikiTestCase { function setUp() { - $this->filePath = dirname( __FILE__ ) . '/../../data/media/'; + $this->filePath = __DIR__ . '/../../data/media/'; } /** * Tests zTXt tag (compressed textual metadata) diff --git a/tests/phpunit/includes/media/PNGTest.php b/tests/phpunit/includes/media/PNGTest.php index b6f911fd..fe73c9c7 100644 --- a/tests/phpunit/includes/media/PNGTest.php +++ b/tests/phpunit/includes/media/PNGTest.php @@ -2,7 +2,7 @@ class PNGHandlerTest extends MediaWikiTestCase { public function setUp() { - $this->filePath = dirname( __FILE__ ) . '/../../data/media'; + $this->filePath = __DIR__ . '/../../data/media'; $this->backend = new FSFileBackend( array( 'name' => 'localtesting', 'lockManager' => 'nullLockManager', diff --git a/tests/phpunit/includes/media/SVGMetadataExtractorTest.php b/tests/phpunit/includes/media/SVGMetadataExtractorTest.php index 526beae8..2116554e 100644 --- a/tests/phpunit/includes/media/SVGMetadataExtractorTest.php +++ b/tests/phpunit/includes/media/SVGMetadataExtractorTest.php @@ -39,27 +39,33 @@ class SVGMetadataExtractorTest extends MediaWikiTestCase { } function providerSvgFiles() { - $base = dirname( __FILE__ ) . '/../../data/media'; + $base = __DIR__ . '/../../data/media'; return array( array( "$base/Wikimedia-logo.svg", array( 'width' => 1024, - 'height' => 1024 + 'height' => 1024, + 'originalWidth' => '1024', + 'originalHeight' => '1024', ) ), array( "$base/QA_icon.svg", array( 'width' => 60, - 'height' => 60 + 'height' => 60, + 'originalWidth' => '60', + 'originalHeight' => '60', ) ), array( "$base/Gtk-media-play-ltr.svg", array( 'width' => 60, - 'height' => 60 + 'height' => 60, + 'originalWidth' => '60.0000000', + 'originalHeight' => '60.0000000', ) ), array( @@ -67,14 +73,16 @@ class SVGMetadataExtractorTest extends MediaWikiTestCase { // This file triggered bug 31719, needs entity expansion in the xmlns checks array( 'width' => 385, - 'height' => 385 + 'height' => 385, + 'originalWidth' => '385', + 'originalHeight' => '385.0004883', ) ) ); } function providerSvgFilesWithXMLMetadata() { - $base = dirname( __FILE__ ) . '/../../data/media'; + $base = __DIR__ . '/../../data/media'; $metadata = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <ns4:Work xmlns:ns4="http://creativecommons.org/ns#" rdf:about=""> @@ -89,7 +97,9 @@ class SVGMetadataExtractorTest extends MediaWikiTestCase { array( 'height' => 593, 'metadata' => $metadata, - 'width' => 959 + 'width' => 959, + 'originalWidth' => '958.69', + 'originalHeight' => '592.78998', ) ), ); diff --git a/tests/phpunit/includes/media/TiffTest.php b/tests/phpunit/includes/media/TiffTest.php index d4cf503b..4c79f66c 100644 --- a/tests/phpunit/includes/media/TiffTest.php +++ b/tests/phpunit/includes/media/TiffTest.php @@ -5,7 +5,7 @@ class TiffTest extends MediaWikiTestCase { global $wgShowEXIF; $this->showExif = $wgShowEXIF; $wgShowEXIF = true; - $this->filePath = dirname( __FILE__ ) . '/../../data/media/'; + $this->filePath = __DIR__ . '/../../data/media/'; $this->handler = new TiffHandler; } diff --git a/tests/phpunit/includes/media/XMPTest.php b/tests/phpunit/includes/media/XMPTest.php index c952b23c..8198d3b0 100644 --- a/tests/phpunit/includes/media/XMPTest.php +++ b/tests/phpunit/includes/media/XMPTest.php @@ -22,11 +22,11 @@ class XMPTest extends MediaWikiTestCase { } $reader = new XMPReader; $reader->parse( $xmp ); - $this->assertEquals( $expected, $reader->getResults(), $info ); + $this->assertEquals( $expected, $reader->getResults(), $info, 0.0000000001 ); } public function dataXMPParse() { - $xmpPath = dirname( __FILE__ ) . '/../../data/xmp/' ; + $xmpPath = __DIR__ . '/../../data/xmp/' ; $data = array(); // $xmpFiles format: array of arrays with first arg file base name, @@ -52,6 +52,7 @@ class XMPTest extends MediaWikiTestCase { array( 'utf32BE', 'UTF-32BE encoding' ), array( 'utf32LE', 'UTF-32LE encoding' ), array( 'xmpExt', 'Extended XMP missing second part' ), + array( 'gps', 'Handling of exif GPS parameters in XMP' ), ); foreach( $xmpFiles as $file ) { $xmp = file_get_contents( $xmpPath . $file[0] . '.xmp' ); @@ -72,7 +73,7 @@ class XMPTest extends MediaWikiTestCase { * world example file to double check the support for this is right. */ function testExtendedXMP() { - $xmpPath = dirname( __FILE__ ) . '/../../data/xmp/'; + $xmpPath = __DIR__ . '/../../data/xmp/'; $standardXMP = file_get_contents( $xmpPath . 'xmpExt.xmp' ); $extendedXMP = file_get_contents( $xmpPath . 'xmpExt2.xmp' ); @@ -102,7 +103,7 @@ class XMPTest extends MediaWikiTestCase { * and thus should only return the StandardXMP, not the ExtendedXMP. */ function testExtendedXMPWithWrongGUID() { - $xmpPath = dirname( __FILE__ ) . '/../../data/xmp/'; + $xmpPath = __DIR__ . '/../../data/xmp/'; $standardXMP = file_get_contents( $xmpPath . 'xmpExt.xmp' ); $extendedXMP = file_get_contents( $xmpPath . 'xmpExt2.xmp' ); @@ -130,7 +131,7 @@ class XMPTest extends MediaWikiTestCase { * which should cause it to ignore the ExtendedXMP packet. */ function testExtendedXMPMissingPacket() { - $xmpPath = dirname( __FILE__ ) . '/../../data/xmp/'; + $xmpPath = __DIR__ . '/../../data/xmp/'; $standardXMP = file_get_contents( $xmpPath . 'xmpExt.xmp' ); $extendedXMP = file_get_contents( $xmpPath . 'xmpExt2.xmp' ); |