X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Ferror_bars.js;h=e57898be27a01190d50de893059bfe256c6c49f8;hb=12b879f424bcdd49822f33378c740063370bb4be;hp=51443633f9df319ea8319e84a8e472768e9113b1;hpb=fef315fe5bbcb434807a249a0e67f51b6ffaf6a1;p=dygraphs.git diff --git a/auto_tests/tests/error_bars.js b/auto_tests/tests/error_bars.js index 5144363..e57898b 100644 --- a/auto_tests/tests/error_bars.js +++ b/auto_tests/tests/error_bars.js @@ -124,22 +124,8 @@ errorBarsTestCase.prototype.testErrorBarsCorrectColors = function() { // 249-299: empty (white) // TODO(danvk): test the edges of these regions. - var ctx = g.hidden_.getContext("2d"); // bypass Proxy - var imageData = ctx.getImageData(0, 0, 400, 300); - - assertEquals(400, imageData.width); - assertEquals(300, imageData.height); - - // returns an (r, g, b, alpha) tuple for the pixel. - // values are in [0, 255]. - var getPixel = function(imageData, x, y) { - var i = 4 * (x + imageData.width * y); - var d = imageData.data; - return [d[i], d[i+1], d[i+2], d[i+3]]; - }; - - assertEquals([0, 0, 255, 38], getPixel(imageData, 200, 75)); - assertEquals([0, 0, 255, 38], getPixel(imageData, 200, 125)); - assertEquals([0, 255, 0, 38], getPixel(imageData, 200, 175)); - assertEquals([0, 255, 0, 38], getPixel(imageData, 200, 225)); + assertEquals([0, 0, 255, 38], Util.samplePixel(g.hidden_, 200, 75)); + assertEquals([0, 0, 255, 38], Util.samplePixel(g.hidden_, 200, 125)); + assertEquals([0, 255, 0, 38], Util.samplePixel(g.hidden_, 200, 175)); + assertEquals([0, 255, 0, 38], Util.samplePixel(g.hidden_, 200, 225)); }