B2G/gecko/browser/components/thumbnails/test/head.js
/**
 * Retrieve a thumbnail from the cache and compare its pixel color values.
 * @param aURL The URL of the thumbnail's page.
 * @param aRed The red component's intensity.
 * @param aGreen The green component's intensity.
 * @param aBlue The blue component's intensity.
 * @param aMessage The info message to print when comparing the pixel color.
 */
Retrieve a thumbnail from the cache and compare its pixel color values.
@param aURL The URL of the thumbnail's page.
@param aRed The red component's intensity.
@param aGreen The green component's intensity.
@param aBlue The blue component's intensity.
@param aMessage The info message to print when comparing the pixel color.
Retrieve a thumbnail from the cache and compare its pixel color values . @param aURL The URL of the thumbnail ' s page . @param aRed The red component ' s intensity . @param aGreen The green component ' s intensity . @param aBlue The blue component ' s intensity . @param aMessage The info message to print when comparing the pixel color .
function checkThumbnailColor(aURL, aRed, aGreen, aBlue, aMessage) {
  let width = 100, height = 100;
  let thumb = PageThumbs.getThumbnailURL(aURL, width, height);
  let htmlns = "http://www.w3.org/1999/xhtml";
  let img = document.createElementNS(htmlns, "img");
  img.setAttribute("src", thumb);
  whenLoaded(img, function () {
    let canvas = document.createElementNS(htmlns, "canvas");
    canvas.setAttribute("width", width);
    canvas.setAttribute("height", height);
    let ctx = canvas.getContext("2d");
    ctx.drawImage(img, 0, 0, width, height);
    checkCanvasColor(ctx, aRed, aGreen, aBlue, aMessage);
    next();
  });
}
function checkThumbnailColor ( aURL , aRed , aGreen , aBlue , aMessage ) { let width = 100 , height = 100 ; let thumb = PageThumbs . getThumbnailURL ( aURL , width , height ) ; let htmlns = "http://www.w3.org/1999/xhtml" ; let img = document . createElementNS ( htmlns , "img" ) ; img . setAttribute ( "src" , thumb ) ; whenLoaded ( img , function ( ) { let canvas = document . createElementNS ( htmlns , "canvas" ) ; canvas . setAttribute ( "width" , width ) ; canvas . setAttribute ( "height" , height ) ; let ctx = canvas . getContext ( "2d" ) ; ctx . drawImage ( img , 0 , 0 , width , height ) ; checkCanvasColor ( ctx , aRed , aGreen , aBlue , aMessage ) ; next ( ) ; } ) ; }
Retrieve a thumbnail from the cache and compare its pixel color values.
Retrieve a thumbnail from the cache and compare its pixel color values .
// Draw the image to a canvas and compare the pixel color values.