Phuedx has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383831 )

Change subject: gateway/rest: Handle large "small" thumbnails
......................................................................

gateway/rest: Handle large "small" thumbnails

NOTE: This is a test case to demonstrate the following design issue.

The Page Summary API's idea of a "small" thumbnail can vary
independently of the Page Previews client. Indeed, prior to T173434, the
Page Summary API requested thumbnails with a dimension of 320px whereas
this client considered 300px to be the target dimension.

Bug: T176627
Change-Id: I0a3f6ef8d6cb416309c90213074b91e0e5332bd7
---
M tests/node-qunit/gateway/rest.test.js
1 file changed, 25 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Popups 
refs/changes/31/383831/1

diff --git a/tests/node-qunit/gateway/rest.test.js 
b/tests/node-qunit/gateway/rest.test.js
index b2b1de0..b33ecf7 100644
--- a/tests/node-qunit/gateway/rest.test.js
+++ b/tests/node-qunit/gateway/rest.test.js
@@ -184,6 +184,31 @@
        );
 
        // ---
+       //
+       // We deliberately set the thumbnail size to something smaller than 
what is
+       // requested by the Page Summary API. This tests the situation where the
+       // client (Page Previews) and the server have diverged in what they 
consider
+       // the smallest allowable image.
+       //
+       // Prior to T173434, the Page Summary API requested thumbnails with a
+       // dimension of 320px whereas this client considered 300px to be the 
target
+       // dimension. What if we decided that the Page Summary API should 
request
+       // thumbnails at 620px?
+       //
+       // See T176729 for more context.
+       model = gateway.convertPageToModel(
+               RESTBASE_RESPONSE_WITH_SMALL_IMAGE,
+               250,
+               provideParsedExtract
+       );
+
+       assert.deepEqual(
+               model.thumbnail.source,
+               
'https://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/RH-Fedora_logo-nonfree.png/250px-RH-Fedora_log_nonfree.png',
+               'It should handle the Page Summary API returning "small" images 
than are larger than the requested width.'
+       );
+
+       // ---
        model = gateway.convertPageToModel( 
RESTBASE_RESPONSE_WITH_LANDSCAPE_IMAGE, 640, provideParsedExtract );
 
        assert.deepEqual(

-- 
To view, visit https://gerrit.wikimedia.org/r/383831
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0a3f6ef8d6cb416309c90213074b91e0e5332bd7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Popups
Gerrit-Branch: master
Gerrit-Owner: Phuedx <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to