From 67554f5410520fab2b77558a5c3bb2d5bf1303f6 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Wed, 22 Apr 2026 15:27:34 +0200 Subject: [PATCH] auto-git: [change] tests/domain/world-settings.test.ts --- tests/domain/world-settings.test.ts | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/domain/world-settings.test.ts b/tests/domain/world-settings.test.ts index 79f4f35e..1f4d58ab 100644 --- a/tests/domain/world-settings.test.ts +++ b/tests/domain/world-settings.test.ts @@ -4,6 +4,7 @@ import { areWorldSettingsEqual, changeWorldBackgroundMode, cloneWorldSettings, + createDefaultWorldShaderSkySettings, createDefaultWorldSettings } from "../../src/document/world-settings"; @@ -15,6 +16,9 @@ describe("world settings helpers", () => { expect(clone).toEqual(source); expect(clone).not.toBe(source); expect(clone.background).not.toBe(source.background); + expect(clone.shaderSky).not.toBe(source.shaderSky); + expect(clone.shaderSky.celestial).not.toBe(source.shaderSky.celestial); + expect(clone.shaderSky.clouds).not.toBe(source.shaderSky.clouds); expect(clone.sunLight.direction).not.toBe(source.sunLight.direction); expect(clone.advancedRendering).not.toBe(source.advancedRendering); expect(clone.advancedRendering.shadows).not.toBe(source.advancedRendering.shadows); @@ -73,6 +77,39 @@ describe("world settings helpers", () => { expect(areWorldSettingsEqual(world, clonedWorld)).toBe(true); }); + it("switches into shader mode and restores the shader day gradient when switching back out", () => { + const shaderBackground = changeWorldBackgroundMode( + { + mode: "verticalGradient", + topColorHex: "#335577", + bottomColorHex: "#99ccff" + }, + "shader" + ); + + expect(shaderBackground).toEqual({ + mode: "shader" + }); + + const restoredGradient = changeWorldBackgroundMode( + shaderBackground, + "verticalGradient", + undefined, + undefined, + { + ...createDefaultWorldShaderSkySettings(), + dayTopColorHex: "#335577", + dayBottomColorHex: "#99ccff" + } + ); + + expect(restoredGradient).toEqual({ + mode: "verticalGradient", + topColorHex: "#335577", + bottomColorHex: "#99ccff" + }); + }); + it("compares authored world settings by value", () => { const left = createDefaultWorldSettings(); const right = cloneWorldSettings(left);