From 7dba70b359581b9bad5876c54fedc4cef5d3dffb Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 16 Oct 2018 15:59:20 -0400 Subject: [PATCH] Add tests. --- Specs/Scene/Cesium3DTilesetSpec.js | 26 +++++++++++++++++++++++ Specs/Scene/ModelSpec.js | 34 ++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/Specs/Scene/Cesium3DTilesetSpec.js b/Specs/Scene/Cesium3DTilesetSpec.js index 38313c4b79cb..e68374ff6c5e 100644 --- a/Specs/Scene/Cesium3DTilesetSpec.js +++ b/Specs/Scene/Cesium3DTilesetSpec.js @@ -1,5 +1,6 @@ defineSuite([ 'Scene/Cesium3DTileset', + 'Core/Cartesian2', 'Core/Cartesian3', 'Core/Color', 'Core/defined', @@ -32,6 +33,7 @@ defineSuite([ 'ThirdParty/when' ], function( Cesium3DTileset, + Cartesian2, Cartesian3, Color, defined, @@ -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 diff --git a/Specs/Scene/ModelSpec.js b/Specs/Scene/ModelSpec.js index c4d67c41b25a..394c93fa3567 100644 --- a/Specs/Scene/ModelSpec.js +++ b/Specs/Scene/ModelSpec.js @@ -1,5 +1,6 @@ defineSuite([ 'Scene/Model', + 'Core/Cartesian2', 'Core/Cartesian3', 'Core/Cartesian4', 'Core/CesiumTerrainProvider', @@ -37,6 +38,7 @@ defineSuite([ 'ThirdParty/when' ], function( Model, + Cartesian2, Cartesian3, Cartesian4, CesiumTerrainProvider, @@ -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;