Transformed

This commit is contained in:
Tim Schaub
2017-12-11 16:29:33 -07:00
parent 1cdb6a66f0
commit 7f47883c48
737 changed files with 22216 additions and 21609 deletions

View File

@@ -1,7 +1,5 @@
goog.require('ol.style.Atlas');
goog.require('ol.style.AtlasManager');
import _ol_style_Atlas_ from '../../../../src/ol/style/Atlas.js';
import _ol_style_AtlasManager_ from '../../../../src/ol/style/AtlasManager.js';
describe('ol.style.Atlas', function() {
@@ -12,7 +10,7 @@ describe('ol.style.Atlas', function() {
describe('#constructor', function() {
it('inits the atlas', function() {
var atlas = new ol.style.Atlas(256, 1);
var atlas = new _ol_style_Atlas_(256, 1);
expect(atlas.emptyBlocks_).to.eql(
[{x: 0, y: 0, width: 256, height: 256}]);
});
@@ -21,7 +19,7 @@ describe('ol.style.Atlas', function() {
describe('#add (squares with same size)', function() {
it('adds one entry', function() {
var atlas = new ol.style.Atlas(128, 1);
var atlas = new _ol_style_Atlas_(128, 1);
var info = atlas.add('1', 32, 32, defaultRender);
expect(info).to.eql(
@@ -31,7 +29,7 @@ describe('ol.style.Atlas', function() {
});
it('adds two entries', function() {
var atlas = new ol.style.Atlas(128, 1);
var atlas = new _ol_style_Atlas_(128, 1);
atlas.add('1', 32, 32, defaultRender);
var info = atlas.add('2', 32, 32, defaultRender);
@@ -43,7 +41,7 @@ describe('ol.style.Atlas', function() {
});
it('adds three entries', function() {
var atlas = new ol.style.Atlas(128, 1);
var atlas = new _ol_style_Atlas_(128, 1);
atlas.add('1', 32, 32, defaultRender);
atlas.add('2', 32, 32, defaultRender);
@@ -56,7 +54,7 @@ describe('ol.style.Atlas', function() {
});
it('adds four entries (new row)', function() {
var atlas = new ol.style.Atlas(128, 1);
var atlas = new _ol_style_Atlas_(128, 1);
atlas.add('1', 32, 32, defaultRender);
atlas.add('2', 32, 32, defaultRender);
@@ -70,7 +68,7 @@ describe('ol.style.Atlas', function() {
});
it('returns null when an entry is too big', function() {
var atlas = new ol.style.Atlas(128, 1);
var atlas = new _ol_style_Atlas_(128, 1);
atlas.add('1', 32, 32, defaultRender);
atlas.add('2', 32, 32, defaultRender);
@@ -81,7 +79,7 @@ describe('ol.style.Atlas', function() {
});
it('fills up the whole atlas', function() {
var atlas = new ol.style.Atlas(128, 1);
var atlas = new _ol_style_Atlas_(128, 1);
for (var i = 1; i <= 16; i++) {
expect(atlas.add(i.toString(), 28, 28, defaultRender)).to.be.ok();
@@ -95,7 +93,7 @@ describe('ol.style.Atlas', function() {
describe('#add (rectangles with different sizes)', function() {
it('adds a bunch of rectangles', function() {
var atlas = new ol.style.Atlas(128, 1);
var atlas = new _ol_style_Atlas_(128, 1);
expect(atlas.add('1', 64, 32, defaultRender)).to.eql(
{offsetX: 1, offsetY: 1, image: atlas.canvas_});
@@ -118,7 +116,7 @@ describe('ol.style.Atlas', function() {
});
it('fills up the whole atlas (rectangles in portrait format)', function() {
var atlas = new ol.style.Atlas(128, 1);
var atlas = new _ol_style_Atlas_(128, 1);
for (var i = 1; i <= 32; i++) {
expect(atlas.add(i.toString(), 28, 14, defaultRender)).to.be.ok();
@@ -129,7 +127,7 @@ describe('ol.style.Atlas', function() {
});
it('fills up the whole atlas (rectangles in landscape format)', function() {
var atlas = new ol.style.Atlas(128, 1);
var atlas = new _ol_style_Atlas_(128, 1);
for (var i = 1; i <= 32; i++) {
expect(atlas.add(i.toString(), 14, 28, defaultRender)).to.be.ok();
@@ -143,7 +141,7 @@ describe('ol.style.Atlas', function() {
describe('#add (rendering)', function() {
it('calls the render callback with the right values', function() {
var atlas = new ol.style.Atlas(128, 1);
var atlas = new _ol_style_Atlas_(128, 1);
var rendererCallback = sinon.spy();
atlas.add('1', 32, 32, rendererCallback);
@@ -158,7 +156,7 @@ describe('ol.style.Atlas', function() {
});
it('is possible to actually draw on the canvas', function() {
var atlas = new ol.style.Atlas(128, 1);
var atlas = new _ol_style_Atlas_(128, 1);
var rendererCallback = function(context, x, y) {
context.fillStyle = '#FFA500';
@@ -181,7 +179,7 @@ describe('ol.style.AtlasManager', function() {
describe('#constructor', function() {
it('inits the atlas manager', function() {
var manager = new ol.style.AtlasManager();
var manager = new _ol_style_AtlasManager_();
expect(manager.atlases_).to.not.be.empty();
});
});
@@ -189,7 +187,7 @@ describe('ol.style.AtlasManager', function() {
describe('#add', function() {
it('adds one entry', function() {
var manager = new ol.style.AtlasManager({initialSize: 128});
var manager = new _ol_style_AtlasManager_({initialSize: 128});
var info = manager.add('1', 32, 32, defaultRender);
expect(info).to.eql({
@@ -200,7 +198,7 @@ describe('ol.style.AtlasManager', function() {
});
it('adds one entry (also to the hit detection atlas)', function() {
var manager = new ol.style.AtlasManager({initialSize: 128});
var manager = new _ol_style_AtlasManager_({initialSize: 128});
var info = manager.add('1', 32, 32, defaultRender, defaultRender);
expect(info).to.eql({
@@ -211,7 +209,7 @@ describe('ol.style.AtlasManager', function() {
});
it('creates a new atlas if needed', function() {
var manager = new ol.style.AtlasManager({initialSize: 128});
var manager = new _ol_style_AtlasManager_({initialSize: 128});
expect(manager.add('1', 100, 100, defaultRender, defaultRender))
.to.be.ok();
var info = manager.add('2', 100, 100, defaultRender, defaultRender);
@@ -223,7 +221,7 @@ describe('ol.style.AtlasManager', function() {
});
it('creates new atlases until one is large enough', function() {
var manager = new ol.style.AtlasManager({initialSize: 128});
var manager = new _ol_style_AtlasManager_({initialSize: 128});
expect(manager.add('1', 100, 100, defaultRender, defaultRender))
.to.be.ok();
expect(manager.atlases_).to.have.length(1);
@@ -237,7 +235,7 @@ describe('ol.style.AtlasManager', function() {
});
it('checks all existing atlases and create a new if needed', function() {
var manager = new ol.style.AtlasManager({initialSize: 128});
var manager = new _ol_style_AtlasManager_({initialSize: 128});
expect(manager.add('1', 100, 100, defaultRender, defaultRender))
.to.be.ok();
expect(manager.add('2', 100, 100, defaultRender, defaultRender))
@@ -253,7 +251,7 @@ describe('ol.style.AtlasManager', function() {
});
it('returns null if the size exceeds the maximum size', function() {
var manager = new ol.style.AtlasManager(
var manager = new _ol_style_AtlasManager_(
{initialSize: 128, maxSize: 2048});
expect(manager.add('1', 100, 100, defaultRender, defaultRender))
.to.be.ok();
@@ -262,7 +260,7 @@ describe('ol.style.AtlasManager', function() {
});
it('always has the same offset for the hit-detection', function() {
var manager = new ol.style.AtlasManager({initialSize: 128});
var manager = new _ol_style_AtlasManager_({initialSize: 128});
// add one image without hit-detection callback
var info = manager.add('1', 32, 32, defaultRender);
// add then one with hit-detection callback
@@ -279,7 +277,7 @@ describe('ol.style.AtlasManager', function() {
describe('#getInfo', function() {
it('returns null if no entry for the given id', function() {
var manager = new ol.style.AtlasManager({initialSize: 128});
var manager = new _ol_style_AtlasManager_({initialSize: 128});
expect(manager.getInfo('123456')).to.eql(null);
});
});