20 'wgEnableAutoRotation' =>
true,
35 if ( !$this->
handler->canRotate() ) {
36 $this->markTestSkipped(
"This test needs a rasterizer that can auto-rotate." );
39 $this->assertEquals( $info[
'width'], $file->getWidth(),
"$name: width check" );
40 $this->assertEquals( $info[
'height'], $file->getHeight(),
"$name: height check" );
56 $this->assertEquals( $info[
'width'], $file->getWidth(),
"$name: width check" );
57 $this->assertEquals( $info[
'height'], $file->getHeight(),
"$name: height check" );
65 if ( !$this->
handler->canRotate() ) {
66 $this->markTestSkipped(
"This test needs a rasterizer that can auto-rotate." );
68 foreach ( $thumbs as $size =>
$out ) {
69 if ( preg_match(
'/^(\d+)px$/', $size,
$matches ) ) {
73 } elseif ( preg_match(
'/^(\d+)x(\d+)px$/', $size,
$matches ) ) {
79 throw new MWException(
'bogus test data format ' . $size );
88 "$name: thumb reported width check for $size"
93 "$name: thumb reported height check for $size"
96 $gis = getimagesize( $thumb->getLocalCopyPath() );
97 if (
$out[0] > $info[
'width'] ) {
99 $this->assertEquals( $info[
'width'], $gis[0],
"$name: thumb actual width check for $size" );
100 $this->assertEquals( $info[
'height'], $gis[1],
"$name: thumb actual height check for $size" );
102 $this->assertEquals(
$out[0], $gis[0],
"$name: thumb actual width check for $size" );
103 $this->assertEquals(
$out[1], $gis[1],
"$name: thumb actual height check for $size" );
111 'landscape-plain.jpg',
118 '800x600px' => [ 800, 600 ],
119 '9999x800px' => [ 1067, 800 ],
120 '800px' => [ 800, 600 ],
121 '600px' => [ 600, 450 ],
125 'portrait-rotated.jpg',
132 '800x600px' => [ 450, 600 ],
133 '9999x800px' => [ 600, 800 ],
134 '800px' => [ 800, 1067 ],
135 '600px' => [ 600, 800 ],
149 $this->assertEquals( $info[
'width'], $file->getWidth(),
"$name: width check" );
150 $this->assertEquals( $info[
'height'], $file->getHeight(),
"$name: height check" );
162 $this->assertEquals( $info[
'width'], $file->getWidth(),
"$name: width check" );
163 $this->assertEquals( $info[
'height'], $file->getHeight(),
"$name: height check" );
173 foreach ( $thumbs as $size =>
$out ) {
174 if ( preg_match(
'/^(\d+)px$/', $size,
$matches ) ) {
178 } elseif ( preg_match(
'/^(\d+)x(\d+)px$/', $size,
$matches ) ) {
184 throw new MWException(
'bogus test data format ' . $size );
193 "$name: thumb reported width check for $size"
198 "$name: thumb reported height check for $size"
201 $gis = getimagesize( $thumb->getLocalCopyPath() );
202 if (
$out[0] > $info[
'width'] ) {
204 $this->assertEquals( $info[
'width'], $gis[0],
"$name: thumb actual width check for $size" );
205 $this->assertEquals( $info[
'height'], $gis[1],
"$name: thumb actual height check for $size" );
207 $this->assertEquals(
$out[0], $gis[0],
"$name: thumb actual width check for $size" );
208 $this->assertEquals(
$out[1], $gis[1],
"$name: thumb actual height check for $size" );
216 'landscape-plain.jpg',
223 '800x600px' => [ 800, 600 ],
224 '9999x800px' => [ 1067, 800 ],
225 '800px' => [ 800, 600 ],
226 '600px' => [ 600, 450 ],
230 'portrait-rotated.jpg',
237 '800x600px' => [ 800, 600 ],
238 '9999x800px' => [ 1067, 800 ],
239 '800px' => [ 800, 600 ],
240 '600px' => [ 600, 450 ],
253 $result = $this->
handler->extractPreRotationDimensions( [
254 'physicalWidth' => self::TEST_WIDTH,
255 'physicalHeight' => self::TEST_HEIGHT,
257 $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