Adapt the batch renderers to trigger a repaint after buffer rebuild

This commit is contained in:
Olivier Guyot
2022-05-04 11:15:30 +02:00
parent 8769ea519e
commit 9e35acaa0a
3 changed files with 41 additions and 10 deletions

View File

@@ -98,12 +98,15 @@ describe('Batch renderers', function () {
});
});
describe('#rebuild', function () {
let rebuildCb;
beforeEach(function (done) {
sinon.spy(helper, 'flushBufferData');
rebuildCb = sinon.spy();
batchRenderer.rebuild(
mixedBatch.pointBatch,
SAMPLE_FRAMESTATE,
GeometryType.POINT
GeometryType.POINT,
rebuildCb
);
// wait for worker response for our specific message
worker.addEventListener('message', function (event) {
@@ -134,6 +137,9 @@ describe('Batch renderers', function () {
0.2, 0, 0, 0.2, 0, -2,
]);
});
it('calls the provided callback', function () {
expect(rebuildCb.calledOnce).to.be(true);
});
});
describe('#render (from parent)', function () {
let transform;
@@ -196,12 +202,15 @@ describe('Batch renderers', function () {
});
});
describe('#rebuild', function () {
let rebuildCb;
beforeEach(function (done) {
sinon.spy(helper, 'flushBufferData');
rebuildCb = sinon.spy();
batchRenderer.rebuild(
mixedBatch.lineStringBatch,
SAMPLE_FRAMESTATE,
GeometryType.LINE_STRING
GeometryType.LINE_STRING,
rebuildCb
);
// wait for worker response for our specific message
worker.addEventListener('message', function (event) {
@@ -231,6 +240,9 @@ describe('Batch renderers', function () {
).to.be.greaterThan(0);
expect(helper.flushBufferData.calledTwice).to.be(true);
});
it('calls the provided callback', function () {
expect(rebuildCb.calledOnce).to.be(true);
});
});
});
@@ -253,12 +265,15 @@ describe('Batch renderers', function () {
});
});
describe('#rebuild', function () {
let rebuildCb;
beforeEach(function (done) {
sinon.spy(helper, 'flushBufferData');
rebuildCb = sinon.spy();
batchRenderer.rebuild(
mixedBatch.polygonBatch,
SAMPLE_FRAMESTATE,
GeometryType.POLYGON
GeometryType.POLYGON,
rebuildCb
);
// wait for worker response for our specific message
worker.addEventListener('message', function (event) {
@@ -285,6 +300,9 @@ describe('Batch renderers', function () {
).to.be.greaterThan(0);
expect(helper.flushBufferData.calledTwice).to.be(true);
});
it('calls the provided callback', function () {
expect(rebuildCb.calledOnce).to.be(true);
});
});
});
});