From 4c28ef347fb5de7032a18511f1c8af7772333d30 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Mon, 26 Mar 2018 10:39:54 -0400 Subject: [PATCH] Test (temp) --- Specs/Scene/Cesium3DTilesetSpec.js | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/Specs/Scene/Cesium3DTilesetSpec.js b/Specs/Scene/Cesium3DTilesetSpec.js index ce9f61a122cb..790109d63d54 100644 --- a/Specs/Scene/Cesium3DTilesetSpec.js +++ b/Specs/Scene/Cesium3DTilesetSpec.js @@ -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;