Skip to content

Commit

Permalink
Add tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
bagnell committed Oct 16, 2018
1 parent ca42a1b commit 7dba70b
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Specs/Scene/Cesium3DTilesetSpec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defineSuite([
'Scene/Cesium3DTileset',
'Core/Cartesian2',
'Core/Cartesian3',
'Core/Color',
'Core/defined',
Expand Down Expand Up @@ -32,6 +33,7 @@ defineSuite([
'ThirdParty/when'
], function(
Cesium3DTileset,
Cartesian2,
Cartesian3,
Color,
defined,
Expand Down Expand Up @@ -1920,6 +1922,30 @@ defineSuite([
});
});

it('renders with imageBaseLightingFactor', function() {
return Cesium3DTilesTester.loadTileset(scene, withoutBatchTableUrl).then(function(tileset) {
expect(scene).toRenderAndCall(function(rgba) {
expect(rgba).not.toEqual([0, 0, 0, 255]);
tileset.imageBasedLightingFactor = new Cartesian2(0.0, 0.0);
expect(scene).notToRender(rgba);
});
});
});

it('renders with lightColor', function() {
return Cesium3DTilesTester.loadTileset(scene, withoutBatchTableUrl).then(function(tileset) {
expect(scene).toRenderAndCall(function(rgba) {
expect(rgba).not.toEqual([0, 0, 0, 255]);
tileset.imageBasedLightingFactor = new Cartesian2(0.0, 0.0);
expect(scene).toRenderAndCall(function(rgba2) {
expect(rgba2).not.toEqual(rgba);
tileset.lightColor = new Cartesian3(5.0, 5.0, 5.0);
expect(scene).notToRender(rgba2);
});
});
});
});

///////////////////////////////////////////////////////////////////////////
// Styling tests

Expand Down
34 changes: 34 additions & 0 deletions Specs/Scene/ModelSpec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defineSuite([
'Scene/Model',
'Core/Cartesian2',
'Core/Cartesian3',
'Core/Cartesian4',
'Core/CesiumTerrainProvider',
Expand Down Expand Up @@ -37,6 +38,7 @@ defineSuite([
'ThirdParty/when'
], function(
Model,
Cartesian2,
Cartesian3,
Cartesian4,
CesiumTerrainProvider,
Expand Down Expand Up @@ -2926,6 +2928,38 @@ defineSuite([
});
});

it('renders with imageBaseLightingFactor', function() {
return loadModel(boxPbrUrl).then(function(model) {
model.show = true;
model.zoomTo();
expect(scene).toRenderAndCall(function(rgba) {
expect(rgba).not.toEqual([0, 0, 0, 255]);
model.imageBasedLightingFactor = new Cartesian2(0.0, 0.0);
expect(scene).notToRender(rgba);

primitives.remove(model);
});
});
});

it('renders with lightColor', function() {
return loadModel(boxPbrUrl).then(function(model) {
model.show = true;
model.zoomTo();
expect(scene).toRenderAndCall(function(rgba) {
expect(rgba).not.toEqual([0, 0, 0, 255]);
model.imageBasedLightingFactor = new Cartesian2(0.0, 0.0);
expect(scene).toRenderAndCall(function(rgba2) {
expect(rgba2).not.toEqual(rgba);
model.lightColor = new Cartesian3(5.0, 5.0, 5.0);
expect(scene).notToRender(rgba2);

primitives.remove(model);
});
});
});
});

it('Updates clipping planes when clipping planes are enabled', function () {
return loadModel(boxUrl).then(function(model) {
model.show = true;
Expand Down

0 comments on commit 7dba70b

Please sign in to comment.