Merge pull request #4567 from bartvde/issue-4566

Always pass on a compare function to sort
This commit is contained in:
Bart van den Eijnden
2015-12-16 11:35:59 +01:00
committed by Bart van den Eijnden
parent 5d64762bcb
commit 4b7e8f5f83
11 changed files with 54 additions and 9 deletions

View File

@@ -2,6 +2,16 @@ goog.provide('ol.test.array');
describe('ol.array', function() {
describe('defaultCompare', function() {
it('sorts as expected', function() {
var arr = [40, 200, 3000];
var expected = [40, 200, 3000];
// default sort would yield [200, 3000, 40]
arr.sort(ol.array.defaultCompare);
expect(arr).to.eql(expected);
});
});
describe('binaryFindNearest', function() {
it('returns expected value', function() {
var arr = [1000, 500, 100];

View File

@@ -1,6 +1,22 @@
goog.provide('ol.test.render.canvas.Immediate');
describe('ol.render.canvas.Immediate', function() {
describe('#flush', function() {
it('calls callback in correct z-order', function() {
var canvas = new ol.render.canvas.Immediate();
var log = [];
canvas.drawAsync(11, function() {
log.push(11);
});
canvas.drawAsync(5, function() {
log.push(5);
});
canvas.flush();
expect(log).to.eql([5, 11]);
});
});
describe('#drawMultiPolygonGeometry', function() {
it('creates the correct canvas instructions for 3D geometries', function() {
var log = {