23 'wgEnableAutoRotation' =>
true,
38 if ( !$this->
handler->canRotate() ) {
39 $this->markTestSkipped(
"This test needs a rasterizer that can auto-rotate." );
42 $this->assertEquals( $info[
'width'], $file->getWidth(),
"$name: width check" );
43 $this->assertEquals( $info[
'height'], $file->getHeight(),
"$name: height check" );
59 $this->assertEquals( $info[
'width'], $file->getWidth(),
"$name: width check" );
60 $this->assertEquals( $info[
'height'], $file->getHeight(),
"$name: height check" );
68 if ( !$this->
handler->canRotate() ) {
69 $this->markTestSkipped(
"This test needs a rasterizer that can auto-rotate." );
71 foreach ( $thumbs as $size =>
$out ) {
72 if ( preg_match(
'/^(\d+)px$/', $size,
$matches ) ) {
76 } elseif ( preg_match(
'/^(\d+)x(\d+)px$/', $size,
$matches ) ) {
82 throw new MWException(
'bogus test data format ' . $size );
91 "$name: thumb reported width check for $size"
96 "$name: thumb reported height check for $size"
99 $gis = getimagesize( $thumb->getLocalCopyPath() );
100 if (
$out[0] > $info[
'width'] ) {
102 $this->assertEquals( $info[
'width'], $gis[0],
"$name: thumb actual width check for $size" );
103 $this->assertEquals( $info[
'height'], $gis[1],
"$name: thumb actual height check for $size" );
105 $this->assertEquals(
$out[0], $gis[0],
"$name: thumb actual width check for $size" );
106 $this->assertEquals(
$out[1], $gis[1],
"$name: thumb actual height check for $size" );
114 'landscape-plain.jpg',
121 '800x600px' => [ 800, 600 ],
122 '9999x800px' => [ 1067, 800 ],
123 '800px' => [ 800, 600 ],
124 '600px' => [ 600, 450 ],
128 'portrait-rotated.jpg',
135 '800x600px' => [ 450, 600 ],
136 '9999x800px' => [ 600, 800 ],
137 '800px' => [ 800, 1067 ],
138 '600px' => [ 600, 800 ],
152 $this->assertEquals( $info[
'width'], $file->getWidth(),
"$name: width check" );
153 $this->assertEquals( $info[
'height'], $file->getHeight(),
"$name: height check" );
165 $this->assertEquals( $info[
'width'], $file->getWidth(),
"$name: width check" );
166 $this->assertEquals( $info[
'height'], $file->getHeight(),
"$name: height check" );
176 foreach ( $thumbs as $size =>
$out ) {
177 if ( preg_match(
'/^(\d+)px$/', $size,
$matches ) ) {
181 } elseif ( preg_match(
'/^(\d+)x(\d+)px$/', $size,
$matches ) ) {
187 throw new MWException(
'bogus test data format ' . $size );
193 if ( $thumb->isError() ) {
195 $this->fail( $thumb->toText() );
201 "$name: thumb reported width check for $size"
206 "$name: thumb reported height check for $size"
209 $gis = getimagesize( $thumb->getLocalCopyPath() );
210 if (
$out[0] > $info[
'width'] ) {
212 $this->assertEquals( $info[
'width'], $gis[0],
"$name: thumb actual width check for $size" );
213 $this->assertEquals( $info[
'height'], $gis[1],
"$name: thumb actual height check for $size" );
215 $this->assertEquals(
$out[0], $gis[0],
"$name: thumb actual width check for $size" );
216 $this->assertEquals(
$out[1], $gis[1],
"$name: thumb actual height check for $size" );
224 'landscape-plain.jpg',
231 '800x600px' => [ 800, 600 ],
232 '9999x800px' => [ 1067, 800 ],
233 '800px' => [ 800, 600 ],
234 '600px' => [ 600, 450 ],
238 'portrait-rotated.jpg',
245 '800x600px' => [ 800, 600 ],
246 '9999x800px' => [ 1067, 800 ],
247 '800px' => [ 800, 600 ],
248 '600px' => [ 600, 450 ],
261 $result = $this->
handler->extractPreRotationDimensions( [
262 'physicalWidth' => self::TEST_WIDTH,
263 'physicalHeight' => self::TEST_HEIGHT,
265 $this->assertEquals( $expected, $result );
Generic handler for bitmap images.
Tests related to auto rotation.
testMetadataAutoRotate( $name, $type, $info)
Same as before, but with auto-rotation set to auto.
testBitmapExtractPreRotationDimensions( $rotation, $expected)
provideBitmapExtractPreRotationDimensions
testRotationRenderingNoAutoRotate( $name, $type, $info, $thumbs)
provideFilesNoAutoRotate
static provideBitmapExtractPreRotationDimensions()
static provideFilesNoAutoRotate()
testMetadataNoAutoRotate( $name, $type, $info)
Same as before, but with auto-rotation disabled.
testMetadata( $name, $type, $info)
provideFiles
testRotationRendering( $name, $type, $info, $thumbs)
provideFiles
testMetadataAutoRotateUnsupported( $name, $type, $info)
Same as before, but with auto-rotation set to auto and an image scaler that doesn't support it.
createsThumbnails()
Mark this test as creating thumbnail files.
const RENDER_NOW
Force rendering in the current process.
const RENDER_FORCE
Force rendering even if thumbnail already exist and using RENDER_NOW I.e.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check set to true or false to override the $wgMaxImageArea check result gives extension the possibility to transform it themselves set to a MediaTransformOutput the error message to be returned in an array you should do so by altering $wgNamespaceProtection and $wgNamespaceContentModels outside the handler
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out