Skip to content

Commit

Permalink
added tests for CesiumTerrainProvider and `TileMapServiceImageryPro…
Browse files Browse the repository at this point in the history
…vider`
  • Loading branch information
keattang committed Oct 18, 2015
1 parent 45b93fb commit 2df7d73
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Specs/Core/CesiumTerrainProviderSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});
});
22 changes: 22 additions & 0 deletions Specs/Scene/TileMapServiceImageryProviderSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/'
Expand Down

0 comments on commit 2df7d73

Please sign in to comment.