extends TestCase ## The helpers that every style draws with. func test_a_point_can_be_found_along_a_path() -> void: var path := PackedVector2Array([Vector2(0, 0), Vector2(10, 0), Vector2(10, 10)]) check_eq(ArtStyle.along(path, 0.0), Vector2(0, 0), "the start") check_eq(ArtStyle.along(path, 0.5), Vector2(10, 0), "halfway is the bend") check_eq(ArtStyle.along(path, 0.75), Vector2(10, 5), "three quarters") check_eq(ArtStyle.along(path, 1.0), Vector2(10, 10), "the end") check_eq(ArtStyle.along(path, 2.0), Vector2(10, 10), "never beyond the end") func test_shares_lie_between_zero_and_one_and_stay_the_same() -> void: for variant in [0, 1, 99, 123456, 2147483647]: for salt in 4: var share := ArtStyle.share(variant, salt) check(share >= 0.0 and share < 1.0, "share of %d and %d: %f" % [variant, salt, share]) check_eq(ArtStyle.share(variant, salt), share, "the same again") func test_a_sway_swings_gently_and_differs_between_things() -> void: for tenth in 100: var swing := ArtStyle.sway(tenth * 0.1, 7) check(swing >= -1.0 and swing <= 1.0, "between left and right at %.1f s: %f" % [tenth * 0.1, swing]) check(ArtStyle.sway(0.0, 1) != ArtStyle.sway(0.0, 2), "two things do not swing alike")