From 30c465a4e3809f1627a16cf534ce92d7f7c398e4 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Wed, 22 Apr 2026 16:54:51 +0200 Subject: [PATCH] auto-git: [change] tests/domain/world-settings.test.ts --- tests/domain/world-settings.test.ts | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/domain/world-settings.test.ts b/tests/domain/world-settings.test.ts index 0cc24c79..d180565c 100644 --- a/tests/domain/world-settings.test.ts +++ b/tests/domain/world-settings.test.ts @@ -4,7 +4,9 @@ import { areWorldSettingsEqual, changeWorldBackgroundMode, cloneWorldSettings, + createDefaultWorldCelestialOrbitAuthoringSettings, createDefaultWorldShaderSkySettings, + createWorldCelestialOrbitSettingsFromPeakDirection, createDefaultWorldSettings } from "../../src/document/world-settings"; @@ -19,6 +21,8 @@ describe("world settings helpers", () => { 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.celestialOrbits).not.toBe(source.celestialOrbits); + expect(clone.celestialOrbits.sun).not.toBe(source.celestialOrbits.sun); expect(clone.sunLight.direction).not.toBe(source.sunLight.direction); expect(clone.advancedRendering).not.toBe(source.advancedRendering); expect(clone.advancedRendering.shadows).not.toBe( @@ -186,4 +190,30 @@ describe("world settings helpers", () => { expect(areWorldSettingsEqual(left, right)).toBe(false); }); + + it("treats celestial orbit settings as part of authored world equality", () => { + const left = createDefaultWorldSettings(); + const right = cloneWorldSettings(left); + + right.celestialOrbits.moon.azimuthDegrees = + right.celestialOrbits.moon.azimuthDegrees + 12; + + expect(areWorldSettingsEqual(left, right)).toBe(false); + }); + + it("derives default celestial orbit settings from a legacy sun direction", () => { + const direction = { + x: -0.6, + y: 1, + z: 0.35 + }; + const defaults = createDefaultWorldCelestialOrbitAuthoringSettings( + direction + ); + const derivedSunOrbit = + createWorldCelestialOrbitSettingsFromPeakDirection(direction); + + expect(defaults.sun).toEqual(derivedSunOrbit); + expect(defaults.moon).toEqual(derivedSunOrbit); + }); });