From 2df7d73d00efbae6353c09a0d03f17bedb54d326 Mon Sep 17 00:00:00 2001 From: Keat Tang Date: Mon, 19 Oct 2015 09:41:38 +1100 Subject: [PATCH] added tests for `CesiumTerrainProvider` and `TileMapServiceImageryProvider` --- Specs/Core/CesiumTerrainProviderSpec.js | 15 +++++++++++++ .../TileMapServiceImageryProviderSpec.js | 22 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/Specs/Core/CesiumTerrainProviderSpec.js b/Specs/Core/CesiumTerrainProviderSpec.js index 8c7885755bf6..575a2009083d 100644 --- a/Specs/Core/CesiumTerrainProviderSpec.js +++ b/Specs/Core/CesiumTerrainProviderSpec.js @@ -600,5 +600,20 @@ defineSuite([ expect(terrainProvider.getTileDataAvailable(1, 0, 2)).toBe(false); }); }); + + it('supports a query string in the base URL', function() { + var baseUrl = 'made/up/url?a=some&b=query'; + + loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) { + // Just return any old file, as long as its big enough + loadWithXhr.defaultLoad('Data/EarthOrientationParameters/IcrfToFixedStkComponentsRotationData.json', responseType, method, data, headers, deferred); + }; + + returnHeightmapTileJson(); + + return waitForTile(0, 0, 0, false, false, function(loadedData) { + expect(loadedData).toBeInstanceOf(HeightmapTerrainData); + }); + }); }); }); diff --git a/Specs/Scene/TileMapServiceImageryProviderSpec.js b/Specs/Scene/TileMapServiceImageryProviderSpec.js index 06845062e95f..2eb396bb6f6b 100644 --- a/Specs/Scene/TileMapServiceImageryProviderSpec.js +++ b/Specs/Scene/TileMapServiceImageryProviderSpec.js @@ -114,6 +114,28 @@ defineSuite([ }); }); + it('supports a query string at the end of the URL', function() { + var provider = new TileMapServiceImageryProvider({ + url : 'made/up/tms/server/?a=some&b=query' + }); + + return pollToPromise(function() { + return provider.ready; + }).then(function() { + spyOn(loadImage, 'createImage').and.callFake(function(url, crossOrigin, deferred) { + expect(url).not.toContain('//'); + + // Just return any old image. + loadImage.defaultCreateImage('Data/Images/Red16x16.png', crossOrigin, deferred); + }); + + return provider.requestImage(0, 0, 0).then(function(image) { + expect(loadImage.createImage).toHaveBeenCalled(); + expect(image).toBeInstanceOf(Image); + }); + }); + }); + it('requestImage returns a promise for an image and loads it for cross-origin use', function() { var provider = new TileMapServiceImageryProvider({ url : 'made/up/tms/server/'