mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-13 18:06:57 +00:00
SVG files display at max resolution
When an svg file is requested, returns the 1024px file and displays at max possible size Bug: T71237 Change-Id: I797794d1f9b1aa66cbb9bd9fec57274554292fb1
This commit is contained in:
parent
957deebfa3
commit
2fad4daa43
|
@ -792,9 +792,8 @@
|
|||
thumbnailPromise,
|
||||
imagePromise;
|
||||
|
||||
if ( originalWidth && width > originalWidth ) {
|
||||
if ( fileTitle.ext.toLowerCase() !== 'svg' && originalWidth && width > originalWidth ) {
|
||||
// Do not request images larger than the original image
|
||||
// This would be possible (but still unwanted) for SVG images
|
||||
width = originalWidth;
|
||||
}
|
||||
|
||||
|
|
|
@ -562,16 +562,25 @@
|
|||
} );
|
||||
|
||||
QUnit.test( 'Refuse to load too-big thumbnails', function ( assert ) {
|
||||
var viewer = mw.mmv.testHelpers.getMultimediaViewer(),
|
||||
intendedWidth = 50,
|
||||
title = mw.Title.newFromText( 'File:Foobar.svg' );
|
||||
var title, expectedWidth,
|
||||
reuestedWidth = 1000,
|
||||
originalWidth = 50,
|
||||
viewer = mw.mmv.testHelpers.getMultimediaViewer();
|
||||
|
||||
viewer.thumbnailInfoProvider.get = function ( fileTitle, width ) {
|
||||
assert.strictEqual( width, intendedWidth );
|
||||
assert.strictEqual( width, expectedWidth );
|
||||
return $.Deferred().reject();
|
||||
};
|
||||
|
||||
viewer.fetchThumbnail( title, 1000, null, intendedWidth, 60 );
|
||||
// non-vector should be capped to original size
|
||||
title = mw.Title.newFromText( 'File:Foobar.png' );
|
||||
expectedWidth = originalWidth;
|
||||
viewer.fetchThumbnail( title, reuestedWidth, null, originalWidth, 60 );
|
||||
|
||||
// vector images can be aritrarily large
|
||||
title = mw.Title.newFromText( 'File:Foobar.svg' );
|
||||
expectedWidth = reuestedWidth;
|
||||
viewer.fetchThumbnail( title, reuestedWidth, null, originalWidth, 60 );
|
||||
} );
|
||||
|
||||
QUnit.test( 'fetchThumbnail()', function ( assert ) {
|
||||
|
|
Loading…
Reference in a new issue