# Tests res://scripts/occlusion_policy.gd (NEO-17 occlusion config).
extends GdUnitTestSuite

const OcclusionPolicyScript := preload("res://scripts/occlusion_policy.gd")


func test_defaults_are_valid() -> void:
	var p = OcclusionPolicyScript.new()
	assert_that(p.is_valid()).is_true()


func test_defaults_match_spec() -> void:
	var p = OcclusionPolicyScript.new()
	assert_that(p.enabled).is_true()
	assert_that(p.fade_alpha).is_equal(0.25)
	assert_that(p.occluder_group).is_equal("occluder")
	assert_that(p.occluder_collision_mask).is_equal(1)
	assert_that(p.max_occluder_cast_depth).is_equal(4)
	assert_that(p.occluder_count_log_threshold).is_equal(0)


func test_is_valid_false_when_disabled() -> void:
	var p = OcclusionPolicyScript.new()
	p.enabled = false
	assert_that(p.is_valid()).is_false()


func test_is_valid_true_when_fade_alpha_zero() -> void:
	var p = OcclusionPolicyScript.new()
	p.fade_alpha = 0.0
	assert_that(p.is_valid()).is_true()


func test_is_valid_false_when_fade_alpha_negative() -> void:
	var p = OcclusionPolicyScript.new()
	p.fade_alpha = -0.1
	assert_that(p.is_valid()).is_false()


func test_is_valid_true_at_full_opaque() -> void:
	var p = OcclusionPolicyScript.new()
	p.fade_alpha = 1.0
	assert_that(p.is_valid()).is_true()
