New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@deck.gl/test-utils

Package Overview
Dependencies
Maintainers
7
Versions
489
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deck.gl/test-utils - npm Package Compare versions

Comparing version 6.4.0-beta.1 to 6.4.0

24

dist/es6/lifecycle-test-deprecated.js

@@ -22,6 +22,5 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

import gl from './utils/setup-gl';
export function testInitializeLayer({
layer,
viewport
}) {
export function testInitializeLayer(_ref) {
let layer = _ref.layer,
viewport = _ref.viewport;
const layerManager = new LayerManager(gl);

@@ -37,7 +36,6 @@

}
export function testUpdateLayer({
layer,
viewport,
newProps
}) {
export function testUpdateLayer(_ref2) {
let layer = _ref2.layer,
viewport = _ref2.viewport,
newProps = _ref2.newProps;
const layerManager = new LayerManager(gl);

@@ -54,6 +52,6 @@

}
export function testDrawLayer({
layer,
uniforms = {}
}) {
export function testDrawLayer(_ref3) {
let layer = _ref3.layer,
_ref3$uniforms = _ref3.uniforms,
uniforms = _ref3$uniforms === void 0 ? {} : _ref3$uniforms;
const layerManager = new LayerManager(gl);

@@ -60,0 +58,0 @@

@@ -41,6 +41,5 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

export function testInitializeLayer({
layer,
viewport
}) {
export function testInitializeLayer(_ref) {
let layer = _ref.layer,
viewport = _ref.viewport;
const layerManager = new LayerManager(gl);

@@ -56,7 +55,6 @@

}
export function testUpdateLayer({
layer,
viewport,
newProps
}) {
export function testUpdateLayer(_ref2) {
let layer = _ref2.layer,
viewport = _ref2.viewport,
newProps = _ref2.newProps;
const layerManager = new LayerManager(gl);

@@ -73,6 +71,6 @@

}
export function testDrawLayer({
layer,
uniforms = {}
}) {
export function testDrawLayer(_ref3) {
let layer = _ref3.layer,
_ref3$uniforms = _ref3.uniforms,
uniforms = _ref3$uniforms === void 0 ? {} : _ref3$uniforms;
const layerManager = new LayerManager(gl);

@@ -91,9 +89,12 @@

}
export function testLayer({
Layer,
testCases = [],
spies = [],
userData = null,
doesNotThrow = checkDoesNotThrow
}) {
export function testLayer(_ref4) {
let Layer = _ref4.Layer,
_ref4$testCases = _ref4.testCases,
testCases = _ref4$testCases === void 0 ? [] : _ref4$testCases,
_ref4$spies = _ref4.spies,
spies = _ref4$spies === void 0 ? [] : _ref4$spies,
_ref4$userData = _ref4.userData,
userData = _ref4$userData === void 0 ? null : _ref4$userData,
_ref4$doesNotThrow = _ref4.doesNotThrow,
doesNotThrow = _ref4$doesNotThrow === void 0 ? checkDoesNotThrow : _ref4$doesNotThrow;
// assert(Layer);

@@ -100,0 +101,0 @@ const layerManager = new LayerManager(gl);

@@ -43,3 +43,4 @@ /*

export function diffImagePixels(data1, data2, colorDeltaThreshold = DEFAULT_THRESHOLD) {
export function diffImagePixels(data1, data2) {
let colorDeltaThreshold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_THRESHOLD;
const pixelCount = data1.data.length / 4;

@@ -46,0 +47,0 @@ const maxDeltaSq = colorDeltaThreshold * colorDeltaThreshold;

@@ -23,3 +23,5 @@ // TODO - only works in browser

}
export function getImagePixelData(image, width = null, height = null) {
export function getImagePixelData(image) {
let width = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
let height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
width = width || image.width;

@@ -26,0 +28,0 @@ height = height || image.height;

@@ -29,16 +29,24 @@ import { getPathPrefix } from './path-prefix';

class XHR {
constructor({
url,
path = null,
method = 'GET',
asynchronous = true,
noCache = false,
// body = null,
sendAsBinary = false,
responseType = false,
onProgress = noop,
onError = noop,
onAbort = noop,
onComplete = noop
}) {
constructor(_ref) {
let url = _ref.url,
_ref$path = _ref.path,
path = _ref$path === void 0 ? null : _ref$path,
_ref$method = _ref.method,
method = _ref$method === void 0 ? 'GET' : _ref$method,
_ref$asynchronous = _ref.asynchronous,
asynchronous = _ref$asynchronous === void 0 ? true : _ref$asynchronous,
_ref$noCache = _ref.noCache,
noCache = _ref$noCache === void 0 ? false : _ref$noCache,
_ref$sendAsBinary = _ref.sendAsBinary,
sendAsBinary = _ref$sendAsBinary === void 0 ? false : _ref$sendAsBinary,
_ref$responseType = _ref.responseType,
responseType = _ref$responseType === void 0 ? false : _ref$responseType,
_ref$onProgress = _ref.onProgress,
onProgress = _ref$onProgress === void 0 ? noop : _ref$onProgress,
_ref$onError = _ref.onError,
onError = _ref$onError === void 0 ? noop : _ref$onError,
_ref$onAbort = _ref.onAbort,
onAbort = _ref$onAbort === void 0 ? noop : _ref$onAbort,
_ref$onComplete = _ref.onComplete,
onComplete = _ref$onComplete === void 0 ? noop : _ref$onComplete;
this.url = path ? path.join(path, url) : url;

@@ -73,3 +81,4 @@ this.method = method;

sendAsync(body = this.body || null) {
sendAsync() {
let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.body || null;
return new Promise((resolve, reject) => {

@@ -76,0 +85,0 @@ try {

@@ -0,1 +1,9 @@

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import { loadFile } from './browser-load-file';

@@ -6,8 +14,15 @@ import { Program } from '../webgl';

export function loadModel(gl, opts = {}) {
return loadFile(opts).then(([file]) => parseModel(gl, Object.assign({
file
}, opts)));
export function loadModel(gl) {
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return loadFile(opts).then((_ref) => {
let _ref2 = _slicedToArray(_ref, 1),
file = _ref2[0];
return parseModel(gl, Object.assign({
file
}, opts));
});
}
export function parseModel(gl, opts = {}) {
export function parseModel(gl) {
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
const file = opts.file,

@@ -14,0 +29,0 @@ _opts$program = opts.program,

@@ -12,3 +12,4 @@ /* eslint-disable guard-for-in, complexity, no-try-catch */

export function loadFiles(opts = {}) {
export function loadFiles() {
let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
const urls = opts.urls,

@@ -36,3 +37,4 @@ _opts$onProgress = opts.onProgress,

export function loadImages(opts = {}) {
export function loadImages() {
let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
const urls = opts.urls,

@@ -39,0 +41,0 @@ _opts$onProgress2 = opts.onProgress,

@@ -0,1 +1,9 @@

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import { loadFiles, loadImages } from './load-files';

@@ -7,3 +15,4 @@ import { Program, Texture2D } from '../webgl';

export function loadTexture(gl, url, opts = {}) {
export function loadTexture(gl, url) {
let opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
const urls = opts.urls,

@@ -24,3 +33,4 @@ _opts$onProgress = opts.onProgress,

}
export function loadProgram(gl, opts = {}) {
export function loadProgram(gl) {
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
const vs = opts.vs,

@@ -33,8 +43,15 @@ fs = opts.fs,

onProgress
}, opts)).then(([vsText, fsText]) => new Program(gl, Object.assign({
vs: vsText,
fs: fsText
}, opts)));
}, opts)).then((_ref) => {
let _ref2 = _slicedToArray(_ref, 2),
vsText = _ref2[0],
fsText = _ref2[1];
return new Program(gl, Object.assign({
vs: vsText,
fs: fsText
}, opts));
});
}
export function loadTextures(gl, opts = {}) {
export function loadTextures(gl) {
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
const urls = opts.urls,

@@ -41,0 +58,0 @@ _opts$onProgress3 = opts.onProgress,

@@ -14,3 +14,5 @@ // Use stackgl modules for DOM-less reading and writing of images

*/
export function compressImage(image, type = 'png') {
export function compressImage(image) {
let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'png';
const savePixels = module.require('save-pixels');

@@ -17,0 +19,0 @@

@@ -42,3 +42,5 @@ // A browser implementation of the Node.js `fs` module's `fs.writeFile` method.

export function writeFile(file, data, options, callback = () => {}) {
export function writeFile(file, data, options) {
let callback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : () => {};
// options is optional

@@ -45,0 +47,0 @@ if (callback === undefined && typeof options === 'function') {

@@ -26,14 +26,20 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

export default class RenderTest {
constructor({
testCases,
width = 800,
height = 450,
// Max color delta in the YIQ difference metric for two pixels to be considered the same
colorDeltaThreshold = 255 * 0.05,
// Percentage of pixels that must be the same for the test to pass
testPassThreshold = 0.99,
stopOnFail = true,
reportResult = reportResultInBrowser,
reportFinalResult = reportFinalResultInBrowser
} = {}) {
constructor() {
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
testCases = _ref.testCases,
_ref$width = _ref.width,
width = _ref$width === void 0 ? 800 : _ref$width,
_ref$height = _ref.height,
height = _ref$height === void 0 ? 450 : _ref$height,
_ref$colorDeltaThresh = _ref.colorDeltaThreshold,
colorDeltaThreshold = _ref$colorDeltaThresh === void 0 ? 255 * 0.05 : _ref$colorDeltaThresh,
_ref$testPassThreshol = _ref.testPassThreshold,
testPassThreshold = _ref$testPassThreshol === void 0 ? 0.99 : _ref$testPassThreshol,
_ref$stopOnFail = _ref.stopOnFail,
stopOnFail = _ref$stopOnFail === void 0 ? true : _ref$stopOnFail,
_ref$reportResult = _ref.reportResult,
reportResult = _ref$reportResult === void 0 ? reportResultInBrowser : _ref$reportResult,
_ref$reportFinalResul = _ref.reportFinalResult,
reportFinalResult = _ref$reportFinalResul === void 0 ? reportFinalResultInBrowser : _ref$reportFinalResul;
this.sceneRenderer = new SceneRenderer({

@@ -63,7 +69,6 @@ width,

_diffResult({
name,
image,
referenceImage
}) {
_diffResult(_ref2) {
let name = _ref2.name,
image = _ref2.image,
referenceImage = _ref2.referenceImage;
const referencePixelData = getImagePixelData(referenceImage);

@@ -93,7 +98,6 @@ const resultPixelData = getImagePixelData(image);

_onSceneRendered({
name,
image,
referenceImageUrl
}) {
_onSceneRendered(_ref3) {
let name = _ref3.name,
image = _ref3.image,
referenceImageUrl = _ref3.referenceImageUrl;
return this._loadReferenceImage(referenceImageUrl).then(referenceImage => {

@@ -151,6 +155,5 @@ // Both images are loaded, compare results

function initializeDOM({
width,
height
}) {
function initializeDOM(_ref4) {
let width = _ref4.width,
height = _ref4.height;
// DeckGL container

@@ -184,8 +187,7 @@ const deckGLContainer = document.createElement('div');

function reportResultInBrowser({
name,
passed,
percentage,
renderTest
}) {
function reportResultInBrowser(_ref5) {
let name = _ref5.name,
passed = _ref5.passed,
percentage = _ref5.percentage,
renderTest = _ref5.renderTest;
console.log(`Rendered new scene ${name} ${passed}`); // eslint-disable-line

@@ -201,6 +203,5 @@

function reportFinalResultInBrowser({
passed,
renderTest
}) {
function reportFinalResultInBrowser(_ref6) {
let passed = _ref6.passed,
renderTest = _ref6.renderTest;
const outputString = `${passed ? 'All CASES PASSED!' : 'NOT All CASES PASSED!'}`;

@@ -207,0 +208,0 @@ const paragraph = document.createElement('p');

@@ -39,9 +39,13 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

export default class SceneRenderer {
constructor({
scenes,
width = 800,
height = 450,
onSceneRendered,
onComplete = noop
} = {}) {
constructor() {
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
scenes = _ref.scenes,
_ref$width = _ref.width,
width = _ref$width === void 0 ? 800 : _ref$width,
_ref$height = _ref.height,
height = _ref$height === void 0 ? 450 : _ref$height,
onSceneRendered = _ref.onSceneRendered,
_ref$onComplete = _ref.onComplete,
onComplete = _ref$onComplete === void 0 ? noop : _ref$onComplete;
this.width = width;

@@ -86,5 +90,5 @@ this.height = height;

_onAfterRender(promise, scene, {
gl
}) {
_onAfterRender(promise, scene, _ref2) {
let gl = _ref2.gl;
if (this.renderingTimes === 0 && !this.resultReported) {

@@ -91,0 +95,0 @@ this.resultReported = true;

@@ -8,3 +8,5 @@ /**

*/
export function toLowPrecision(input, precision = 11) {
export function toLowPrecision(input) {
let precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 11;
/* eslint-disable guard-for-in */

@@ -11,0 +13,0 @@ if (typeof input === 'number') {

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "6.4.0-beta.1",
"version": "6.4.0",
"publishConfig": {

@@ -29,3 +29,3 @@ "access": "public"

"dependencies": {
"deck.gl": "^6.4.0-beta.1",
"deck.gl": "^6.4.0",
"pixelmatch": "^4.0.2",

@@ -32,0 +32,0 @@ "probe.gl": "^2.0.0"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc