$res = $this->handler->convertMetadataVersion( $metadata, 1 );
$this->assertEquals( $expected, $res );
}
-
- /**
- * @dataProvider provideSwappingICCProfile
- * @covers ExifBitmapHandler::swapICCProfile
- */
- public function testSwappingICCProfile(
- $sourceFilename, $controlFilename, $newProfileFilename, $oldProfileName
- ) {
- global $wgExiftool;
-
- if ( !$wgExiftool || !is_file( $wgExiftool ) ) {
- $this->markTestSkipped( "Exiftool not installed, cannot test ICC profile swapping" );
- }
-
- $this->setMwGlobals( 'wgUseTinyRGBForJPGThumbnails', true );
-
- $sourceFilepath = $this->filePath . $sourceFilename;
- $controlFilepath = $this->filePath . $controlFilename;
- $profileFilepath = $this->filePath . $newProfileFilename;
- $filepath = $this->getNewTempFile();
-
- copy( $sourceFilepath, $filepath );
-
- $file = $this->dataFile( $sourceFilename, 'image/jpeg' );
- $this->handler->swapICCProfile( $filepath, $oldProfileName, $profileFilepath );
-
- $this->assertEquals(
- sha1( file_get_contents( $filepath ) ),
- sha1( file_get_contents( $controlFilepath ) )
- );
- }
-
- public function provideSwappingICCProfile() {
- return [
- // File with sRGB should end up with TinyRGB
- [
- 'srgb.jpg',
- 'tinyrgb.jpg',
- 'tinyrgb.icc',
- 'IEC 61966-2.1 Default RGB colour space - sRGB'
- ],
- // File with TinyRGB should be left unchanged
- [
- 'tinyrgb.jpg',
- 'tinyrgb.jpg',
- 'tinyrgb.icc',
- 'IEC 61966-2.1 Default RGB colour space - sRGB'
- ],
- // File with no profile should be left unchanged
- [
- 'test.jpg',
- 'test.jpg',
- 'tinyrgb.icc',
- 'IEC 61966-2.1 Default RGB colour space - sRGB'
- ]
- ];
- }
}