extends GutTest const CYCLE := preload("res://world/jajce/day_night_cycle.gd") func test_sun_is_highest_at_noon_and_lights_the_ground_throughout_day() -> void: var cycle := CYCLE.new() var light := DirectionalLight3D.new() cycle.directional_light = light cycle._apply_light_rotation(0.5) var noon_elevation := -light.rotation_degrees.x assert_gt(noon_elevation, 45.0, "Noon should have an elevated sun, not grazing light") for time in [0.15, 0.25, 0.4, 0.6, 0.75, 0.85]: cycle._apply_light_rotation(time) assert_lt(light.rotation_degrees.x, 0.0, "The daylight source points down toward terrain") assert_lt(-light.rotation_degrees.x, noon_elevation, "The solar arc peaks at noon") cycle.free() light.free() func test_warm_transitions_overlap_dawn_and_dusk_without_persisting_at_noon() -> void: var cycle := CYCLE.new() for time in [0.22, 0.78]: assert_gt(cycle._day_factor(time), 0.0) assert_lt(cycle._day_factor(time), 1.0) assert_gt(cycle._sunrise_sunset_weight(time), 0.8) assert_eq(cycle._sunrise_sunset_weight(0.5), 0.0) assert_eq(cycle._sunrise_sunset_weight(0.0), 0.0) cycle.free()