Skip to content

Commit

Permalink
chore(test): reenable some tests (#8660)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress committed Mar 14, 2024
1 parent fe1871e commit 61dd3a8
Show file tree
Hide file tree
Showing 19 changed files with 62 additions and 81 deletions.
Expand Up @@ -138,7 +138,7 @@ export default class DataFilterExtension extends LayerExtension<
static defaultProps = defaultProps;
static extensionName = 'DataFilterExtension';

constructor(opts: DataFilterExtensionOptions) {
constructor(opts: DataFilterExtensionOptions = {}) {
super({...defaultOptions, ...opts});
}

Expand Down
32 changes: 11 additions & 21 deletions test/modules/core/lib/attribute/attribute.spec.ts
Expand Up @@ -178,15 +178,7 @@ test('Attribute#setConstantValue', t => {
t.end();
});

// TODO v9 re-enable
test.skip('Attribute#allocate - partial', t => {
if (device.info.type !== 'webgl2') {
// buffer.getData() is WebGL2 only
t.comment('This test requires WebGL2');
t.end();
return;
}

test('Attribute#allocate - partial', async t => {
let positions = new Attribute(device, {
id: 'positions',
update: attr => {
Expand All @@ -196,19 +188,24 @@ test.skip('Attribute#allocate - partial', t => {
size: 2
});

const readDataFromBuffer = async () => {
const bytes = await positions.buffer.readAsync();
return new Float32Array(bytes.buffer);
};

positions.allocate(1);
let value = positions.value;
value[0] = 180;
value[1] = 90;
// make sure buffer is created
positions.updateBuffer({});
t.deepEqual(positions.buffer.getData().slice(0, 2), [180, 90], 'value uploaded to buffer');
t.deepEqual((await readDataFromBuffer()).slice(0, 2), [180, 90], 'value uploaded to buffer');

positions.setNeedsUpdate('test', {startRow: 1, endRow: 2});
positions.allocate(value.length / 2 + 1); // array might be overallocated
t.notEqual(positions.value, value, 'a new value array is allocated');
t.deepEqual(positions.value.slice(0, 2), [180, 90], 'old value is copied to new array');
t.deepEqual(positions.buffer.getData().slice(0, 2), [180, 90], 'old value is copied to buffer');
t.deepEqual((await readDataFromBuffer()).slice(0, 2), [180, 90], 'old value is copied to buffer');

positions.delete();

Expand All @@ -228,7 +225,7 @@ test.skip('Attribute#allocate - partial', t => {
// make sure buffer is created
positions.updateBuffer({});
t.deepEqual(
positions.buffer.getData().slice(0, 4),
(await readDataFromBuffer()).slice(0, 4),
[179.89999389648438, 89.9000015258789, 0.00000610351571594947, -0.0000015258789289873675],
'value uploaded to buffer'
);
Expand All @@ -238,7 +235,7 @@ test.skip('Attribute#allocate - partial', t => {
t.notEqual(positions.value, value, 'a new value array is allocated');
t.deepEqual(positions.value.slice(0, 2), [179.9, 89.9], 'old value is copied to new array');
t.deepEqual(
positions.buffer.getData().slice(0, 4),
(await readDataFromBuffer()).slice(0, 4),
[179.89999389648438, 89.9000015258789, 0.00000610351571594947, -0.0000015258789289873675],
'old value is copied to buffer'
);
Expand Down Expand Up @@ -292,8 +289,7 @@ test('Attribute#shaderAttributes', t => {
t.end();
});

// TODO v9 re-enable
test.skip('Attribute#updateBuffer', t => {
test('Attribute#updateBuffer', t => {
const TEST_PROPS = {
data: [
{id: 'A', value: 10, color: [255, 0, 0]},
Expand Down Expand Up @@ -1035,12 +1031,6 @@ test('Attribute#doublePrecision', t0 => {
t.ok(attribute.value instanceof Float64Array, 'Attribute is Float64Array');
validateShaderAttributes(t, attribute, true);

// TODO(v9): Buffer has no inherent type, unclear what should happen here.
// const buffer = device.createBuffer({byteLength: 12});
// attribute.setExternalBuffer(buffer);
// validateShaderAttributes(t, attribute, true);
// buffer.delete();

attribute.delete();
t.end();
});
Expand Down
3 changes: 1 addition & 2 deletions test/modules/core/lib/deck-picker.spec.ts
Expand Up @@ -46,9 +46,8 @@ test('DeckPicker#getPickingRect', t => {
t.end();
});

// TODO - luma v9 disable - picking somehow broken
/* eslint-disable max-statements */
test.skip('DeckPicker#pick empty', t => {
test('DeckPicker#pick empty', t => {
const deckPicker = new DeckPicker(device);
const view = new MapView();
const viewport = view.makeViewport({
Expand Down
3 changes: 1 addition & 2 deletions test/modules/core/lib/deck.spec.ts
Expand Up @@ -96,8 +96,7 @@ test('Deck#no views', t => {
t.pass('Deck constructor did not throw');
});

// TODO v9
test.skip('Deck#rendering, picking, logging', t => {
test('Deck#rendering, picking, logging', t => {
// Test logging functionalities
log.priority = 4;

Expand Down
3 changes: 1 addition & 2 deletions test/modules/core/passes/pick-layers-pass.spec.ts
Expand Up @@ -5,8 +5,7 @@ import PickLayersPass from '@deck.gl/core/passes/pick-layers-pass';
import * as FIXTURES from 'deck.gl-test/data';
import {device} from '@deck.gl/test-utils';

// TODO v9 re-enable
test.skip('PickLayersPass#drawPickingBuffer', t => {
test('PickLayersPass#drawPickingBuffer', t => {
const pickingFBO = device.createFramebuffer({colorAttachments: ['rgba8unorm']});

// Resize it to current canvas size (this is a noop if size hasn't changed)
Expand Down
4 changes: 2 additions & 2 deletions test/modules/extensions/brushing.spec.ts
Expand Up @@ -17,7 +17,7 @@ test('BrushingExtension', t => {
extensions: [new BrushingExtension()]
},
onAfterUpdate: ({layer}) => {
const {uniforms} = layer.state.model.program;
const {uniforms} = layer.state.model;
t.ok(uniforms.brushing_radius, 'has correct uniforms');
t.is(uniforms.brushing_enabled, false, 'has correct uniforms');
t.is(uniforms.brushing_target, 0, 'has correct uniforms');
Expand All @@ -35,7 +35,7 @@ test('BrushingExtension', t => {
layer.context.mousePosition = {x: 1, y: 1};
},
onAfterUpdate: ({layer}) => {
const {uniforms} = layer.state.model.program;
const {uniforms} = layer.state.model;
t.is(uniforms.brushing_radius, 5e6, 'has correct uniforms');
t.is(uniforms.brushing_enabled, true, 'has correct uniforms');
t.is(uniforms.brushing_target, 2, 'has correct uniforms');
Expand Down
Expand Up @@ -21,7 +21,7 @@ test('CollisionFilterExtension', t => {
{
props,
onAfterUpdate: ({layer}) => {
const uniforms = layer.getModels()[0].getUniforms();
const uniforms = layer.getModels()[0].uniforms;
const attributes = layer.getAttributeManager().getAttributes();
t.ok(uniforms.collision_enabled, 'collision_enabled in uniforms');
t.equal(uniforms.collision_sort, false, 'collision_sort in disabled when reading');
Expand All @@ -34,7 +34,7 @@ test('CollisionFilterExtension', t => {
collisionFBO: null
},
onAfterUpdate: ({layer}) => {
const uniforms = layer.getModels()[0].getUniforms();
const uniforms = layer.getModels()[0].uniforms;
t.equal(uniforms.collision_enabled, false, 'collision_enabled is disabled');
t.equal(uniforms.collision_sort, false, 'collision_sort in disabled when reading');
t.equal(
Expand All @@ -50,7 +50,7 @@ test('CollisionFilterExtension', t => {
drawToCollisionMap: true
},
onAfterUpdate: ({layer}) => {
const uniforms = layer.getModels()[0].getUniforms();
const uniforms = layer.getModels()[0].uniforms;
t.ok(uniforms.collision_enabled, 'collision_enabled in uniforms');
t.equal(uniforms.collision_sort, true, 'collision_sort enabled when drawing');
t.equal(
Expand All @@ -65,7 +65,7 @@ test('CollisionFilterExtension', t => {
getCollisionPriority: d => d.priority
},
onAfterUpdate: ({layer}) => {
const uniforms = layer.getModels()[0].getUniforms();
const uniforms = layer.getModels()[0].uniforms;
t.ok(uniforms.collision_enabled, 'collision_enabled in uniforms');
t.ok(uniforms.collision_sort, 'collision_sort enabled when getCollisionPriority set');
}
Expand Down
18 changes: 6 additions & 12 deletions test/modules/extensions/data-filter.spec.ts
Expand Up @@ -11,12 +11,6 @@ test('DataFilterExtension#constructor', t => {
t.is(extension.opts.filterSize, 3, 'Extension has filterSize');
t.ok(extension.opts.fp64, 'fp64 is enabled');

t.throws(
() => new DataFilterExtension({filterSize: 5}),
/filterSize/,
'should throw on invalid filterSize'
);

t.end();
});

Expand All @@ -34,7 +28,7 @@ test('DataFilterExtension', t => {
extensions: [new DataFilterExtension()]
},
onAfterUpdate: ({layer}) => {
const {uniforms} = layer.state.model.program;
const {uniforms} = layer.state.model;
t.is(uniforms.filter_min, 80, 'has correct uniforms');
t.is(uniforms.filter_softMax, 160, 'has correct uniforms');
t.is(uniforms.filter_useSoftMargin, false, 'has correct uniforms');
Expand All @@ -57,7 +51,7 @@ test('DataFilterExtension', t => {
extensions: [new DataFilterExtension({filterSize: 2})]
},
onAfterUpdate: ({layer}) => {
const {uniforms} = layer.state.model.program;
const {uniforms} = layer.state.model;
t.deepEqual(uniforms.filter_min, [10000, 0], 'has correct uniforms');
t.deepEqual(uniforms.filter_softMax, [18000, 8000], 'has correct uniforms');
t.is(uniforms.filter_useSoftMargin, true, 'has correct uniforms');
Expand All @@ -69,7 +63,7 @@ test('DataFilterExtension', t => {
extensions: [new DataFilterExtension({filterSize: 2, fp64: true})]
},
onAfterUpdate: ({layer}) => {
const {uniforms} = layer.state.model.program;
const {uniforms} = layer.state.model;
t.deepEqual(uniforms.filter_min64High, [10000, 0], 'has double uniforms');
t.deepEqual(uniforms.filter_max64High, [20000, 100000], 'has double uniforms');
t.deepEqual(uniforms.filter_min, [0, 0], 'has correct uniforms');
Expand Down Expand Up @@ -98,7 +92,7 @@ test('DataFilterExtension#categories', t => {
filterCategories: [['a'], [8]]
},
onAfterUpdate: ({layer}) => {
const {uniforms} = layer.state.model.program;
const {uniforms} = layer.state.model;
t.deepEqual(
uniforms.filter_categoryBitMask,
[2 ** 0, 0, 2 ** 1, 0],
Expand All @@ -111,7 +105,7 @@ test('DataFilterExtension#categories', t => {
filterCategories: [['b', 'c'], []]
},
onAfterUpdate: ({layer}) => {
const {uniforms} = layer.state.model.program;
const {uniforms} = layer.state.model;
t.deepEqual(
uniforms.filter_categoryBitMask,
[2 ** 1 + 2 ** 2, 0, 0, 0],
Expand All @@ -125,7 +119,7 @@ test('DataFilterExtension#categories', t => {
filterCategories: [['d'], [5]]
},
onAfterUpdate: ({layer}) => {
const {uniforms} = layer.state.model.program;
const {uniforms} = layer.state.model;
t.deepEqual(
uniforms.filter_categoryBitMask,
[2 ** 2, 0, 2 ** 2, 0],
Expand Down
4 changes: 2 additions & 2 deletions test/modules/extensions/fill-style.spec.ts
Expand Up @@ -33,7 +33,7 @@ test('FillStyleExtension#PolygonLayer', t => {
const fillLayer = subLayers.find(l => l.id.includes('fill'));

t.ok(fillLayer.state.emptyTexture, 'should be enabled in composite layer');
let uniforms = fillLayer.getModels()[0].getUniforms();
let uniforms = fillLayer.getModels()[0].uniforms;
t.ok(uniforms.fill_patternMask, 'has fill_patternMask uniform');
t.deepEqual(
fillLayer.getAttributeManager().getAttributes().fillPatternScales.value,
Expand All @@ -46,7 +46,7 @@ test('FillStyleExtension#PolygonLayer', t => {
'fillPatternFrames attribute is populated'
);

uniforms = strokeLayer.getModels()[0].getUniforms();
uniforms = strokeLayer.getModels()[0].uniforms;
t.notOk(strokeLayer.state.emptyTexture, 'should not be enabled in PathLayer');
t.notOk('fill_patternMask' in uniforms, 'should not be enabled in PathLayer');
}
Expand Down
2 changes: 1 addition & 1 deletion test/modules/extensions/fp64.spec.ts
Expand Up @@ -22,7 +22,7 @@ test('Fp64Extension', t => {
extensions: [new Fp64Extension()]
},
onAfterUpdate: ({layer}) => {
const {uniforms} = layer.state.model.program;
const {uniforms} = layer.state.model;
t.ok(uniforms.project_uViewProjectionMatrixFP64, 'has fp64 uniforms');
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/modules/extensions/index.ts
@@ -1,9 +1,9 @@
import './brushing.spec';
import './data-filter.spec';
import './collision-filter';
// import './collision-filter';
import './clip.spec';
import './fp64.spec';
import './path.spec';
import './fill-style.spec';
import './mask';
import './terrain';
// import './mask';
// import './terrain';
8 changes: 4 additions & 4 deletions test/modules/extensions/mask/mask.spec.ts
Expand Up @@ -28,7 +28,7 @@ test('MaskExtension', t => {
}
},
onAfterUpdate: ({layer}) => {
const uniforms = layer.getModels()[0].getUniforms();
const uniforms = layer.getModels()[0].uniforms;
t.ok(uniforms.mask_enabled, 'mask_enabled in uniforms');
t.equal(uniforms.mask_inverted, false, 'mask_inverted defaults to false in uniforms');
t.ok(uniforms.mask_maskByInstance, 'mask_maskByInstance in uniforms');
Expand All @@ -40,7 +40,7 @@ test('MaskExtension', t => {
maskInverted: true
},
onAfterUpdate: ({layer}) => {
const uniforms = layer.getModels()[0].getUniforms();
const uniforms = layer.getModels()[0].uniforms;
t.ok(uniforms.mask_inverted, 'mask_inverted true in uniforms');
}
},
Expand All @@ -49,7 +49,7 @@ test('MaskExtension', t => {
maskId: 'mask2'
},
onAfterUpdate: ({layer}) => {
const uniforms = layer.getModels()[0].getUniforms();
const uniforms = layer.getModels()[0].uniforms;
t.notOk(uniforms.mask_enabled, 'mask disabled for invalid maskId');
}
}
Expand All @@ -62,7 +62,7 @@ test('MaskExtension', t => {

test('MaskExtension#maskByInstance', t => {
const checkLayer = (layer, expectedMaskByInstance) => {
const uniforms = layer.getModels()[0].getUniforms();
const uniforms = layer.getModels()[0].uniforms;
t.is(
uniforms.mask_maskByInstance,
expectedMaskByInstance,
Expand Down
8 changes: 4 additions & 4 deletions test/modules/extensions/path.spec.ts
Expand Up @@ -17,7 +17,7 @@ test('PathStyleExtension#PathLayer', t => {
extensions: [new PathStyleExtension({highPrecisionDash: true, offset: true})]
},
onAfterUpdate: ({layer}) => {
const uniforms = layer.state.model.getUniforms();
const uniforms = layer.state.model.uniforms;
t.is(uniforms.dashAlignMode, 0, 'has dashAlignMode uniform');
const attributes = layer.getAttributeManager().getAttributes();
t.deepEqual(
Expand Down Expand Up @@ -54,7 +54,7 @@ test('PathStyleExtension#PathLayer', t => {
}
},
onAfterUpdate: ({layer}) => {
const uniforms = layer.state.model.getUniforms();
const uniforms = layer.state.model.uniforms;
t.is(uniforms.dashAlignMode, 1, 'has dashAlignMode uniform');
const attributes = layer.getAttributeManager().getAttributes();
t.deepEqual(
Expand Down Expand Up @@ -89,7 +89,7 @@ test('PathStyleExtension#PolygonLayer', t => {
},
onAfterUpdate: ({subLayers}) => {
const pathLayer = subLayers.find(l => l.id.endsWith('stroke'));
const uniforms = pathLayer.state.model.getUniforms();
const uniforms = pathLayer.state.model.uniforms;
t.is(uniforms.dashAlignMode, 0, 'has dashAlignMode uniform');
t.ok(
pathLayer.getAttributeManager().getAttributes().instanceDashArrays.value,
Expand All @@ -104,7 +104,7 @@ test('PathStyleExtension#PolygonLayer', t => {
},
onAfterUpdate: ({subLayers}) => {
const pathLayer = subLayers.find(l => l.id.endsWith('stroke'));
const uniforms = pathLayer.state.model.getUniforms();
const uniforms = pathLayer.state.model.uniforms;
t.is(uniforms.dashAlignMode, 1, 'has dashAlignMode uniform');
t.ok(
pathLayer.getAttributeManager().getAttributes().instanceDashArrays.value,
Expand Down
9 changes: 3 additions & 6 deletions test/modules/geo-layers/h3-layers.spec.ts
Expand Up @@ -153,8 +153,7 @@ test('H3Utils#normalizeLongitudes', t => {
t.end();
});

// TODO - luma v9 - Tries to use GLSL 1.00 extensions with WebGL2 context.
test.skip('H3HexagonLayer', t => {
test('H3HexagonLayer', t => {
const testCases = generateLayerTests({
Layer: H3HexagonLayer,
sampleProps: SAMPLE_PROPS,
Expand All @@ -176,8 +175,7 @@ test.skip('H3HexagonLayer', t => {
t.end();
});

// TODO - luma v9 - Tries to use GLSL 1.00 extensions with WebGL2 context.
test.skip('H3HexagonLayer#_shouldUseHighPrecision', t => {
test('H3HexagonLayer#_shouldUseHighPrecision', t => {
testLayer({
Layer: H3HexagonLayer,
onError: t.notOk,
Expand Down Expand Up @@ -230,8 +228,7 @@ test.skip('H3HexagonLayer#_shouldUseHighPrecision', t => {
t.end();
});

// TODO - luma v9 - Tries to use GLSL 1.00 extensions with WebGL2 context.
test.skip('H3HexagonLayer#viewportUpdate', t => {
test('H3HexagonLayer#viewportUpdate', t => {
let vertices = null;

testLayer({
Expand Down

0 comments on commit 61dd3a8

Please sign in to comment.