Files
openlayers/test/spec/ol/tilecoord.test.js
Éric Lemoine b6ed5f2164 Use namespaces for tests
With this commit test files provide namespaces (using goog.provide). This fixes the issue reported by @bartvde where goog objects cannot be used in Jasmine "describe" functions. It also frees us from having to add script tags for the test files in test/ol.html.
2013-01-31 10:18:21 +01:00

51 lines
1.3 KiB
JavaScript

goog.provide('ol.test.TileCoord');
describe('ol.TileCoord', function() {
describe('create', function() {
it('sets x y z properties as expected', function() {
var tc = new ol.TileCoord(1, 2, 3);
expect(tc.z).toEqual(1);
expect(tc.x).toEqual(2);
expect(tc.y).toEqual(3);
});
});
describe('create from quad key', function() {
it('sets x y z properties as expected', function() {
var tc = ol.TileCoord.createFromQuadKey('213');
expect(tc.z).toEqual(3);
expect(tc.x).toEqual(3);
expect(tc.y).toEqual(5);
});
});
describe('create from string', function() {
it('sets x y z properties as expected', function() {
var str = '1/2/3';
var tc = ol.TileCoord.createFromString(str);
expect(tc.z).toEqual(1);
expect(tc.x).toEqual(2);
expect(tc.y).toEqual(3);
});
});
describe('call quadKey', function() {
it('returns expected string', function() {
var tc = new ol.TileCoord(3, 3, 5);
var s = tc.quadKey();
expect(s).toEqual('213');
});
});
describe('hash', function() {
it('produces different hashes for different tile coords', function() {
var tc1 = new ol.TileCoord(3, 2, 1);
var tc2 = new ol.TileCoord(3, 1, 1);
expect(tc1.hash()).not.toEqual(tc2.hash());
});
});
});
goog.require('ol.TileCoord');