Skip to content

Commit

Permalink
Test (temp)
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Mar 26, 2018
1 parent 50c85ee commit 4c28ef3
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions Specs/Scene/Cesium3DTilesetSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,49 @@ defineSuite([
});
});

it('process tiles in loaded order', function() {
viewNothing();
return Resource.fetch(batchedColorsB3dmUrl).then(function(tileArrayBuffer) {
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
var loadedUrls = [];
var processedUrls = [];

function getProcessTileFunction(tile) {
return function(tileset, frameState) {
var url = tile._header.content.url;
console.log('hat' + url);
if (processedUrls.indexOf(url) === -1) {
processedUrls.push(url);
}
tile.processOld(tileset, frameState);
};
}

var root = tileset._root;
var tiles = root.children.slice();
tiles.push(root);
var length = tiles.length;
for (var i = 0; i < length; ++i) {
var tile = tiles[i];
tile.processOld = tile.process;
spyOn(tile, 'process').and.callFake(getProcessTileFunction(tile));
}

spyOn(Resource.prototype, 'fetchArrayBuffer').and.callFake(function() {
loadedUrls.push(this._url);
return when.resolve(tileArrayBuffer);
});

viewAllTiles();
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
console.log(loadedUrls);
console.log(processedUrls);
expect(loadedUrls).toEqual(processedUrls);
});
});
});
});

it('does not process tileset when screen space error is not met', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
var statistics = tileset._statistics;
Expand Down

0 comments on commit 4c28ef3

Please sign in to comment.