From 54582bd2f2a2cc339507179191624b3f263a6f5d Mon Sep 17 00:00:00 2001 From: Sanjeet Suhag Date: Fri, 1 Apr 2022 15:02:30 -0400 Subject: [PATCH 1/3] Adds lighting to lambertDiffuseMultiplier spec --- Specs/Scene/GlobeSpec.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Specs/Scene/GlobeSpec.js b/Specs/Scene/GlobeSpec.js index c487a369057c..e39b4571758e 100644 --- a/Specs/Scene/GlobeSpec.js +++ b/Specs/Scene/GlobeSpec.js @@ -316,6 +316,8 @@ describe( it("renders terrain with lambertDiffuseMultiplier", function () { globe.enableLighting = true; + globe.dynamicAtmosphereLighting = true; + globe.dynamicAtmosphereLightingFromSun = true; const layerCollection = globe.imageryLayers; layerCollection.removeAll(); From f892a7e646e1452b5974fc409ae2f6adeb4f8dc0 Mon Sep 17 00:00:00 2001 From: Sanjeet Suhag Date: Fri, 1 Apr 2022 15:28:45 -0400 Subject: [PATCH 2/3] Fixes time for spec --- Specs/Scene/GlobeSpec.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Specs/Scene/GlobeSpec.js b/Specs/Scene/GlobeSpec.js index e39b4571758e..b8c2567aa295 100644 --- a/Specs/Scene/GlobeSpec.js +++ b/Specs/Scene/GlobeSpec.js @@ -7,6 +7,7 @@ import { Color } from "../../Source/Cesium.js"; import { Cartesian3 } from "../../Source/Cesium.js"; import { HeadingPitchRoll } from "../../Source/Cesium.js"; import { NearFarScalar } from "../../Source/Cesium.js"; +import { JulianDate } from "../../Source/Cesium.js"; import createScene from "../createScene.js"; import pollToPromise from "../pollToPromise.js"; @@ -315,6 +316,10 @@ describe( }); it("renders terrain with lambertDiffuseMultiplier", function () { + const renderOptions = { + scene: scene, + time: new JulianDate(2557522.0), + }; globe.enableLighting = true; globe.dynamicAtmosphereLighting = true; globe.dynamicAtmosphereLightingFromSun = true; @@ -359,12 +364,12 @@ describe( return updateUntilDone(globe).then(function () { let initialRgba; - expect(scene).toRenderAndCall(function (rgba) { + expect(renderOptions).toRenderAndCall(function (rgba) { initialRgba = rgba; expect(initialRgba).not.toEqual([0, 0, 0, 255]); }); globe.lambertDiffuseMultiplier = 10.0; - expect(scene).toRenderAndCall(function (rgba) { + expect(renderOptions).toRenderAndCall(function (rgba) { expect(rgba).not.toEqual(initialRgba); }); }); From 02eab725b8f7d7d4937f99b989ce66c1bdf82008 Mon Sep 17 00:00:00 2001 From: Sanjeet Suhag Date: Fri, 1 Apr 2022 15:40:20 -0400 Subject: [PATCH 3/3] Suggested fixes --- Specs/Scene/GlobeSpec.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Specs/Scene/GlobeSpec.js b/Specs/Scene/GlobeSpec.js index b8c2567aa295..9249007e9a73 100644 --- a/Specs/Scene/GlobeSpec.js +++ b/Specs/Scene/GlobeSpec.js @@ -266,6 +266,10 @@ describe( }); it("renders terrain with enableLighting", function () { + const renderOptions = { + scene: scene, + time: new JulianDate(2557522.0), + }; globe.enableLighting = true; const layerCollection = globe.imageryLayers; @@ -307,10 +311,10 @@ describe( }); return updateUntilDone(globe).then(function () { - expect(scene).notToRender([0, 0, 0, 255]); + expect(renderOptions).notToRender([0, 0, 0, 255]); scene.globe.show = false; - expect(scene).toRender([0, 0, 0, 255]); + expect(renderOptions).toRender([0, 0, 0, 255]); }); }); }); @@ -321,8 +325,6 @@ describe( time: new JulianDate(2557522.0), }; globe.enableLighting = true; - globe.dynamicAtmosphereLighting = true; - globe.dynamicAtmosphereLightingFromSun = true; const layerCollection = globe.imageryLayers; layerCollection.removeAll(); @@ -366,12 +368,10 @@ describe( let initialRgba; expect(renderOptions).toRenderAndCall(function (rgba) { initialRgba = rgba; - expect(initialRgba).not.toEqual([0, 0, 0, 255]); + expect(renderOptions).notToRender([0, 0, 0, 255]); }); globe.lambertDiffuseMultiplier = 10.0; - expect(renderOptions).toRenderAndCall(function (rgba) { - expect(rgba).not.toEqual(initialRgba); - }); + expect(renderOptions).notToRender(initialRgba); }); }); });