Merge branch 'master' of github.com:openlayers/ol3 into vector
This commit is contained in:
@@ -85,28 +85,11 @@ describe('ol.Map', function() {
|
||||
});
|
||||
|
||||
describe('create mousewheel interaction', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
it('creates mousewheel interaction', function() {
|
||||
options.mouseWheelZoom = true;
|
||||
});
|
||||
|
||||
describe('default mouseWheelZoomDelta', function() {
|
||||
it('create mousewheel interaction with default delta', function() {
|
||||
var interactions = ol.Map.createInteractions_(options);
|
||||
expect(interactions.getLength()).toEqual(1);
|
||||
expect(interactions.getAt(0)).toBeA(ol.interaction.MouseWheelZoom);
|
||||
expect(interactions.getAt(0).delta_).toEqual(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('set mouseWheelZoomDelta', function() {
|
||||
it('create mousewheel interaction with set delta', function() {
|
||||
options.mouseWheelZoomDelta = 7;
|
||||
var interactions = ol.Map.createInteractions_(options);
|
||||
expect(interactions.getLength()).toEqual(1);
|
||||
expect(interactions.getAt(0)).toBeA(ol.interaction.MouseWheelZoom);
|
||||
expect(interactions.getAt(0).delta_).toEqual(7);
|
||||
});
|
||||
var interactions = ol.Map.createInteractions_(options);
|
||||
expect(interactions.getLength()).toEqual(1);
|
||||
expect(interactions.getAt(0)).toBeA(ol.interaction.MouseWheelZoom);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -121,11 +104,11 @@ describe('ol.Map', function() {
|
||||
var interactions = ol.Map.createInteractions_(options);
|
||||
expect(interactions.getLength()).toEqual(1);
|
||||
expect(interactions.getAt(0)).toBeA(ol.interaction.DblClickZoom);
|
||||
expect(interactions.getAt(0).delta_).toEqual(4);
|
||||
expect(interactions.getAt(0).delta_).toEqual(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('set mouseWheelZoomDelta', function() {
|
||||
describe('set zoomDelta', function() {
|
||||
it('create double click interaction with set delta', function() {
|
||||
options.zoomDelta = 7;
|
||||
var interactions = ol.Map.createInteractions_(options);
|
||||
|
||||
36
test/spec/ol/rotationconstraint.test.js
Normal file
36
test/spec/ol/rotationconstraint.test.js
Normal file
@@ -0,0 +1,36 @@
|
||||
goog.provide('ol.test.RotationConstraint');
|
||||
|
||||
describe('ol.RotationConstraint', function() {
|
||||
|
||||
describe('SnapToZero', function() {
|
||||
|
||||
it('returns expected rotation value', function() {
|
||||
var rotationConstraint = ol.RotationConstraint.createSnapToZero(0.3);
|
||||
|
||||
expect(rotationConstraint(0.1, 0)).toEqual(0);
|
||||
expect(rotationConstraint(0.2, 0)).toEqual(0);
|
||||
expect(rotationConstraint(0.3, 0)).toEqual(0);
|
||||
expect(rotationConstraint(0.4, 0)).toEqual(0.4);
|
||||
|
||||
expect(rotationConstraint(-0.1, 0)).toEqual(0);
|
||||
expect(rotationConstraint(-0.2, 0)).toEqual(0);
|
||||
expect(rotationConstraint(-0.3, 0)).toEqual(0);
|
||||
expect(rotationConstraint(-0.4, 0)).toEqual(-0.4);
|
||||
|
||||
expect(rotationConstraint(1, -0.9)).toEqual(0);
|
||||
expect(rotationConstraint(1, -0.8)).toEqual(0);
|
||||
// floating-point arithmetic
|
||||
expect(rotationConstraint(1, -0.7)).not.toEqual(0);
|
||||
expect(rotationConstraint(1, -0.6)).toEqual(0.4);
|
||||
|
||||
expect(rotationConstraint(-1, 0.9)).toEqual(0);
|
||||
expect(rotationConstraint(-1, 0.8)).toEqual(0);
|
||||
// floating-point arithmetic
|
||||
expect(rotationConstraint(-1, 0.7)).not.toEqual(0);
|
||||
expect(rotationConstraint(-1, 0.6)).toEqual(-0.4);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
goog.require('ol.RotationConstraint');
|
||||
@@ -74,10 +74,10 @@ describe('ol.TileUrlFunction', function() {
|
||||
'http://wms?foo=bar', {});
|
||||
var tileCoord = new ol.TileCoord(1, 0, 0);
|
||||
var tileUrl = tileUrlFunction(tileCoord, tileGrid, epsg3857);
|
||||
var expected = 'http://wms?foo=bar&SERVICE=WMS&VERSION=1.3.0&' +
|
||||
'REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&WIDTH=256&' +
|
||||
'HEIGHT=256&BBOX=-20037508.342789244%2C20037508.342789244%2C0%2C' +
|
||||
'40075016.68557849&CRS=EPSG%3A3857&STYLES=';
|
||||
var expected = 'http://wms?foo=bar&SERVICE=WMS&VERSION=1.3.0&REQUEST=' +
|
||||
'GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&WIDTH=256&HEIGHT=256&' +
|
||||
'STYLES=&CRS=EPSG%3A3857&BBOX=-20037508.342789244%2C2' +
|
||||
'0037508.342789244%2C0%2C40075016.68557849';
|
||||
expect(tileUrl).toEqual(expected);
|
||||
});
|
||||
it('creates expected URL respecting axis orientation', function() {
|
||||
@@ -86,10 +86,10 @@ describe('ol.TileUrlFunction', function() {
|
||||
'http://wms?foo=bar', {});
|
||||
var tileCoord = new ol.TileCoord(1, 0, 0);
|
||||
var tileUrl = tileUrlFunction(tileCoord, tileGrid, epsg4326);
|
||||
var expected = 'http://wms?foo=bar&SERVICE=WMS&VERSION=1.3.0&' +
|
||||
'REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&WIDTH=256&' +
|
||||
'HEIGHT=256&BBOX=20037508.342789244%2C-20037508.342789244%2C' +
|
||||
'40075016.68557849%2C0&CRS=EPSG%3A4326&STYLES=';
|
||||
var expected = 'http://wms?foo=bar&SERVICE=WMS&VERSION=1.3.0&REQUEST=' +
|
||||
'GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&WIDTH=256&HEIGHT=256&' +
|
||||
'STYLES=&CRS=EPSG%3A4326&BBOX=20037508.342789244%2C' +
|
||||
'-20037508.342789244%2C40075016.68557849%2C0';
|
||||
expect(tileUrl).toEqual(expected);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -49,6 +49,16 @@ describe('ol.View2D', function() {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('create rotation constraint', function() {
|
||||
it('gives a correct rotation constraint function', function() {
|
||||
var options = {};
|
||||
var fn = ol.View2D.createConstraints_(options).rotation;
|
||||
expect(fn(0.01, 0)).toEqual(0);
|
||||
expect(fn(0.15, 0)).toEqual(0.15);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user