From 479ff833583cfdee8615c4d5a1968f499c4ab74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Fri, 15 Apr 2016 15:14:44 -0400 Subject: [PATCH 1/2] move constants to top of file --- test/image/compare_pixels_test.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/image/compare_pixels_test.js b/test/image/compare_pixels_test.js index 035eb5ea8d4..ac6fa1f2f86 100644 --- a/test/image/compare_pixels_test.js +++ b/test/image/compare_pixels_test.js @@ -9,6 +9,9 @@ var request = require('request'); var test = require('tape'); var gm = require('gm'); +var TOLERANCE = 1e-6; // pixel comparison tolerance +var BASE_TIMEOUT = 500; // base timeout time +var BATCH_SIZE = 5; // size of each test 'batch' var touch = function(fileName) { fs.closeSync(fs.openSync(fileName, 'w')); }; @@ -55,9 +58,7 @@ function runAll() { ); }); - var BASE_TIMEOUT = 500, // base timeout time - BATCH_SIZE = 5, // size of each test 'batch' - cnt = 0; + var cnt = 0; function testFunction() { testMock(mocks[cnt++], t); @@ -98,7 +99,7 @@ function testMock(fileName, t) { var options = { file: diffPath, highlightColor: 'purple', - tolerance: 1e-6 + tolerance: TOLERANCE }; /* From 7e16d0feb49b2ff1ee829868d20f052f058c06aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Fri, 15 Apr 2016 15:15:54 -0400 Subject: [PATCH 2/2] put back test cases that feature run-to-run randomness: - maybe with new non-zero pixel comparison tolerance, these will behave consistently. --- test/image/compare_pixels_test.js | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/test/image/compare_pixels_test.js b/test/image/compare_pixels_test.js index ac6fa1f2f86..4f4ce95a3b6 100644 --- a/test/image/compare_pixels_test.js +++ b/test/image/compare_pixels_test.js @@ -12,6 +12,7 @@ var gm = require('gm'); var TOLERANCE = 1e-6; // pixel comparison tolerance var BASE_TIMEOUT = 500; // base timeout time var BATCH_SIZE = 5; // size of each test 'batch' + var touch = function(fileName) { fs.closeSync(fs.openSync(fileName, 'w')); }; @@ -36,25 +37,19 @@ function runAll() { var allMocks = fs.readdirSync(constants.pathToTestImageMocks); - /* - * Some test cases exhibit run-to-run randomness; - * skip over these few test cases for now. + /* Test cases: + * + * - font-wishlist + * - all gl2d * - * More info: - * https://github.com/plotly/plotly.js/issues/62 + * don't behave consistently from run-to-run and/or + * machine-to-machine; skip over them. * - * 41 test cases are removed: - * - font-wishlist (1 test case) - * - all gl2d (38) - * - gl3d_bunny-hull (1) - * - polar_scatter (1) */ var mocks = allMocks.filter(function(mock) { return !( mock === 'font-wishlist.json' || - mock.indexOf('gl2d') !== -1 || - mock === 'gl3d_bunny-hull.json' || - mock === 'polar_scatter.json' + mock.indexOf('gl2d') !== -1 ); });