extends TestCase ## The client sea from issue W6 follows the simulation's sea level. func test_surface_follows_the_simulation_sea_level() -> void: var sim: Simulation = Simulation.new(1, SimGround.flat()) var view: WaterView = WaterView.new() view.follow(sim) assert_eq(view.surface().position.y, Tuning.SEA_LEVEL_START) sim.set_sea_level(8.0) view.follow(sim) assert_eq(view.surface().position.y, 8.0) assert_eq(view.level, 8.0) # The surface covers the whole world and well past it, so no edge is ever in view. var mesh: PlaneMesh = view.surface().mesh assert_true(mesh.size.x >= Tuning.WORLD_SIZE_METRES * 4.0) assert_near(view.surface().position.x, Tuning.WORLD_SIZE_METRES * 0.5, 0.001) assert_eq(view.surface().cast_shadow, GeometryInstance3D.SHADOW_CASTING_SETTING_OFF) view.free() func test_the_open_sea_colour_is_reached_above_the_sea_floor() -> void: # H6: the floor round the island must not read lighter than the sea past the edge. var view: WaterView = WaterView.new() var open_depth: float = float(view.material().get_shader_parameter("open_depth")) assert_true(open_depth > 0.0 and open_depth < Tuning.ISLAND_SEA_DEPTH) view.free()