Skip to content

Commit

Permalink
Merge b05eb6b into d004a38
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress committed Jan 16, 2020
2 parents d004a38 + b05eb6b commit d0e892a
Show file tree
Hide file tree
Showing 50 changed files with 2,260 additions and 2,078 deletions.
1 change: 1 addition & 0 deletions docs/api-reference/test-utils/snapshot-test-runner.md
Expand Up @@ -126,6 +126,7 @@ The test renderer and each test case may choose to override the default image di
* `tolerance`
* `threshold`
* `includeAA`
* `includeEmpty`
* `createDiffImage`
* `saveOnFail`
* `saveAs`
Expand Down
Expand Up @@ -63,7 +63,7 @@ export function getMin(pts, accessor) {

// Function to convert from aggregation/accessor props (like colorAggregation and getColorWeight) to getValue prop (like getColorValue)
export function getValueFunc(aggregation, accessor) {
const op = AGGREGATION_OPERATION[aggregation.toUpperCase()] || AGGREGATION_OPERATION.SUM;
const op = AGGREGATION_OPERATION[aggregation] || AGGREGATION_OPERATION.SUM;
switch (op) {
case AGGREGATION_OPERATION.MIN:
return pts => getMin(pts, accessor);
Expand Down
2 changes: 1 addition & 1 deletion modules/core/package.json
Expand Up @@ -39,6 +39,6 @@
"gl-matrix": "^3.0.0",
"math.gl": "^3.1.2",
"mjolnir.js": "^2.3.0",
"probe.gl": "^3.2.0"
"probe.gl": "^3.2.1"
}
}
2 changes: 1 addition & 1 deletion modules/test-utils/package.json
Expand Up @@ -27,7 +27,7 @@
"@deck.gl/core": "^8.0.0",
"@luma.gl/test-utils": "^8.0.1",
"@luma.gl/webgl": "^8.0.1",
"@probe.gl/test-utils": "^3.2.0"
"@probe.gl/test-utils": "^3.2.1"
},
"scripts": {}
}
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -45,8 +45,8 @@
"@loaders.gl/polyfills": "^2.0.2",
"@luma.gl/engine": "^8.0.1",
"@luma.gl/test-utils": "^8.0.1",
"@probe.gl/bench": "^3.2.0",
"@probe.gl/test-utils": "^3.2.0",
"@probe.gl/bench": "^3.2.1",
"@probe.gl/test-utils": "^3.2.1",
"babel-loader": "^8.0.0",
"babel-plugin-inline-webgl-constants": "^1.0.2",
"babel-plugin-remove-glsl-comments": "^0.1.0",
Expand Down
38 changes: 38 additions & 0 deletions scripts/print-golden-image.js
@@ -0,0 +1,38 @@
/*
Script to retrieve failed screenshot from CI
- In render test, enable `saveOnFail`
- node scripts/print-golden-image.js <image_name> <sx> <sy> <width> <height>
- Copy the printed base64 string
- Use `restore` function in this file to convert string back to image
*/
const {PNG} = require('pngjs');
const fs = require('fs');
const path = require('path');

const INPUT_FILE = path.resolve('./test/render/golden-images', process.argv[2]);
const OUTPUT_FILE = 'out.png';

const SOURCE_X = Number(process.argv[3]) || 0;
const SOURCE_Y = Number(process.argv[4]) || 0;
const WIDTH = Number(process.argv[5]) || 800;
const HEIGHT = Number(process.argv[6]) || 450;

fs.createReadStream(INPUT_FILE)
.pipe(new PNG())
.on('parsed', function() {
const dst = new PNG({width: WIDTH, height: HEIGHT});
// copy to destination
this.bitblt(dst, SOURCE_X, SOURCE_Y, WIDTH, HEIGHT, 0, 0);

dst.pack().pipe(fs.createWriteStream('out.png'))
.on('close', function() {
const buffer = fs.readFileSync('out.png');
console.log(buffer.toString('base64'));
});
});

// Call to convert base64 back to file
function restore(base64, width, height) {
const buffer = Buffer.from(base64, 'base64');
fs.writeFileSync('out.png', buffer);
}
Expand Up @@ -28,19 +28,19 @@ const accessor = x => x;
const TEST_CASES = [
{
name: 'Min Function',
op: 'min',
op: 'MIN',
data,
expected: -3
},
{
name: 'Max Function',
op: 'Max',
op: 'MAX',
data,
expected: 16
},
{
name: 'Sum Function',
op: 'sUM',
op: 'SUM',
data,
expected: 37.2
},
Expand Down
Binary file removed test/render/golden-images/column-shadow-lnglat.png
Binary file not shown.
Binary file modified test/render/golden-images/first-person.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/render/golden-images/grid-lnglat-side.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/render/golden-images/grid-lnglat.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/render/golden-images/line-lnglat.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/render/golden-images/path-billboard.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/render/golden-images/path-lnglat.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed test/render/golden-images/path-maker.png
Binary file not shown.
Binary file modified test/render/golden-images/path-meter.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed test/render/golden-images/path-outline.png
Binary file not shown.
Binary file added test/render/golden-images/path-rounded.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/render/golden-images/pointcloud-identity.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/render/golden-images/post-process-effects.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/render/golden-images/shadow-effect.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/render/golden-images/text-layer-auto-wrapping.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/render/golden-images/text-layer-background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/render/golden-images/text-layer-multi-lines.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/render/golden-images/text-layer.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/render/golden-images/trips.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions test/render/index.js
Expand Up @@ -17,7 +17,6 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import test from 'tape';
import {TEST_CASES, WIDTH, HEIGHT} from './test-cases';
import {SnapshotTestRunner} from '@deck.gl/test-utils';
Expand All @@ -36,7 +35,8 @@ test('Render Test', t => {
onTestFail: (testCase, result) => t.fail(result.error || `match: ${result.matchPercentage}`),

imageDiffOptions: {
threshold: 0.99
threshold: 0.99,
includeEmpty: false
// uncomment to save screenshot to disk
// , saveOnFail: true
// uncomment `saveAs` to overwrite current golden images
Expand Down

0 comments on commit d0e892a

Please sign in to comment.