Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mock deprecation warning function to fix failing test #4809

Merged
merged 2 commits into from
Jan 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Source/Scene/Batched3DModel3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ define([
this._features = undefined;
}

// This can be overridden for testing purposes
Batched3DModel3DTileContent._deprecationWarning = deprecationWarning;

defineProperties(Batched3DModel3DTileContent.prototype, {
/**
* Part of the {@link Cesium3DTileContent} interface.
Expand Down Expand Up @@ -183,7 +186,7 @@ define([
if (!defined(batchIdAttributeName)) {
batchIdAttributeName = getAttributeOrUniformBySemantic(gltf, 'BATCHID');
if (defined(batchIdAttributeName)) {
deprecationWarning('b3dm-legacy-batchid', 'The glTF in this b3dm uses the semantic `BATCHID`. Application-specific semantics should be prefixed with an underscore: `_BATCHID`.');
Batched3DModel3DTileContent._deprecationWarning('b3dm-legacy-batchid', 'The glTF in this b3dm uses the semantic `BATCHID`. Application-specific semantics should be prefixed with an underscore: `_BATCHID`.');
}
}
return batchIdAttributeName;
Expand Down
11 changes: 6 additions & 5 deletions Specs/Scene/Batched3DModel3DTileContentSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,12 @@ defineSuite([
});

it('logs deprecation warning for use of BATCHID without prefixed underscore', function() {
var deprecationWarningSpy = jasmine.createSpy(deprecationWarning);
return Cesium3DTilesTester.loadTileset(scene, withBatchTableUrl).then(function(tileset) {
expect(deprecationWarningSpy).toHaveBeenCalled();
Cesium3DTilesTester.expectRenderTileset(scene, tileset);
});
spyOn(Batched3DModel3DTileContent, '_deprecationWarning');
return Cesium3DTilesTester.loadTileset(scene, withBatchTableUrl)
.then(function(tileset) {
expect(Batched3DModel3DTileContent._deprecationWarning).toHaveBeenCalled();
Cesium3DTilesTester.expectRenderTileset(scene, tileset);
});
});

it('throws with empty gltf', function() {
Expand Down