Webgl buffer / add utility getSize function

Saves checking whether the buffer was initialized with
an array already
This commit is contained in:
Olivier Guyot
2019-08-30 10:38:02 +02:00
parent e57e660819
commit c48350b666
3 changed files with 28 additions and 2 deletions

View File

@@ -75,4 +75,21 @@ describe('ol.webgl.Buffer', function() {
});
describe('#getSize', function() {
let b;
beforeEach(function() {
b = new WebGLArrayBuffer(ARRAY_BUFFER);
});
it('returns 0 when the buffer array is not initialized', function() {
expect(b.getSize()).to.be(0);
});
it('returns the size of the array otherwise', function() {
b.ofSize(12);
expect(b.getSize()).to.be(12);
});
});
});