Berry animation update palettes (#24251)
This commit is contained in:
parent
7536fb7eb6
commit
30cef9c501
@ -16,28 +16,67 @@ var PALETTE_RAINBOW = bytes(
|
|||||||
"FF00FFFF" # Cyan
|
"FF00FFFF" # Cyan
|
||||||
"FF0080FF" # Blue
|
"FF0080FF" # Blue
|
||||||
"FF8000FF" # Violet
|
"FF8000FF" # Violet
|
||||||
|
)
|
||||||
|
|
||||||
|
# Standard rainbow palette (7 colors with roughly constant brightness) with roll-over
|
||||||
|
var PALETTE_RAINBOW2 = bytes(
|
||||||
|
"FFFC0000" # Red
|
||||||
|
"FFFF8000" # Orange
|
||||||
|
"FFFFFF00" # Yellow
|
||||||
|
"FF00FF00" # Green
|
||||||
|
"FF00FFFF" # Cyan
|
||||||
|
"FF0080FF" # Blue
|
||||||
|
"FF8000FF" # Violet
|
||||||
|
"FFFC0000" # Red
|
||||||
|
)
|
||||||
|
|
||||||
|
# Standard rainbow palette (7 colors + white with roughly constant brightness)
|
||||||
|
var PALETTE_RAINBOW_W = bytes(
|
||||||
|
"FFFC0000" # Red
|
||||||
|
"FFFF8000" # Orange
|
||||||
|
"FFFFFF00" # Yellow
|
||||||
|
"FF00FF00" # Green
|
||||||
|
"FF00FFFF" # Cyan
|
||||||
|
"FF0080FF" # Blue
|
||||||
|
"FF8000FF" # Violet
|
||||||
|
"FFCCCCCC" # White
|
||||||
|
)
|
||||||
|
|
||||||
|
# Standard rainbow palette (7 colors + white with roughly constant brightness) with roll-over
|
||||||
|
var PALETTE_RAINBOW_W2 = bytes(
|
||||||
|
"FFFC0000" # Red
|
||||||
|
"FFFF8000" # Orange
|
||||||
|
"FFFFFF00" # Yellow
|
||||||
|
"FF00FF00" # Green
|
||||||
|
"FF00FFFF" # Cyan
|
||||||
|
"FF0080FF" # Blue
|
||||||
|
"FF8000FF" # Violet
|
||||||
|
"FFCCCCCC" # White
|
||||||
"FFFC0000" # Red
|
"FFFC0000" # Red
|
||||||
)
|
)
|
||||||
|
|
||||||
# Simple RGB palette (3 colors)
|
# Simple RGB palette (3 colors)
|
||||||
var PALETTE_RGB = bytes(
|
var PALETTE_RGB = bytes(
|
||||||
"00FF0000" # Red (value 0)
|
"FFFF0000" # Red (value 0)
|
||||||
"8000FF00" # Green (value 128)
|
"FF00FF00" # Green (value 128)
|
||||||
"FF0000FF" # Blue (value 255)
|
"FF0000FF" # Blue (value 255)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Fire effect palette (warm colors)
|
# Fire effect palette (warm colors)
|
||||||
var PALETTE_FIRE = bytes(
|
var PALETTE_FIRE = bytes(
|
||||||
"00000000" # Black (value 0)
|
"FF000000" # Black (value 0)
|
||||||
"40800000" # Dark red (value 64)
|
"FF800000" # Dark red (value 64)
|
||||||
"80FF0000" # Red (value 128)
|
"FFFF0000" # Red (value 128)
|
||||||
"C0FF8000" # Orange (value 192)
|
"FFFF8000" # Orange (value 192)
|
||||||
"FFFFFF00" # Yellow (value 255)
|
"FFFFFF00" # Yellow (value 255)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Export all palettes
|
# Export all palettes
|
||||||
return {
|
return {
|
||||||
"PALETTE_RAINBOW": PALETTE_RAINBOW,
|
"PALETTE_RAINBOW": PALETTE_RAINBOW,
|
||||||
|
"PALETTE_RAINBOW2": PALETTE_RAINBOW2,
|
||||||
|
"PALETTE_RAINBOW_W": PALETTE_RAINBOW_W,
|
||||||
|
"PALETTE_RAINBOW_W2": PALETTE_RAINBOW_W2,
|
||||||
"PALETTE_RGB": PALETTE_RGB,
|
"PALETTE_RGB": PALETTE_RGB,
|
||||||
"PALETTE_FIRE": PALETTE_FIRE
|
"PALETTE_FIRE": PALETTE_FIRE
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@ -22,9 +22,9 @@ def test_palette_size_parameter_access()
|
|||||||
var engine = MockEngine()
|
var engine = MockEngine()
|
||||||
var provider = animation.color_cycle(engine)
|
var provider = animation.color_cycle(engine)
|
||||||
|
|
||||||
# Test 1: Default palette_size should be 3
|
# Test 1: Default palette_size should be 7
|
||||||
var default_size = provider.palette_size
|
var default_size = provider.palette_size
|
||||||
assert(default_size == 3, f"Default palette_size should be 3, got {default_size}")
|
assert(default_size == 7, f"Default palette_size should be 7, got {default_size}")
|
||||||
|
|
||||||
# Test 2: palette_size should match _get_palette_size()
|
# Test 2: palette_size should match _get_palette_size()
|
||||||
var internal_size = provider._get_palette_size()
|
var internal_size = provider._get_palette_size()
|
||||||
@ -131,15 +131,15 @@ def test_palette_size_with_new_instances()
|
|||||||
var provider1 = animation.color_cycle(engine)
|
var provider1 = animation.color_cycle(engine)
|
||||||
var provider2 = animation.color_cycle(engine)
|
var provider2 = animation.color_cycle(engine)
|
||||||
|
|
||||||
assert(provider1.palette_size == 3, "First provider should have default palette_size of 3")
|
assert(provider1.palette_size == 7, "First provider should have default palette_size of 7")
|
||||||
assert(provider2.palette_size == 3, "Second provider should have default palette_size of 3")
|
assert(provider2.palette_size == 7, "Second provider should have default palette_size of 7")
|
||||||
|
|
||||||
# Test 2: Changing one instance shouldn't affect the other
|
# Test 2: Changing one instance shouldn't affect the other
|
||||||
var custom_palette = bytes("FFFF0000" "FF00FF00")
|
var custom_palette = bytes("FFFF0000" "FF00FF00")
|
||||||
provider1.palette = custom_palette
|
provider1.palette = custom_palette
|
||||||
|
|
||||||
assert(provider1.palette_size == 2, "First provider should have palette_size of 2 after change")
|
assert(provider1.palette_size == 2, "First provider should have palette_size of 2 after change")
|
||||||
assert(provider2.palette_size == 3, "Second provider should still have palette_size of 3")
|
assert(provider2.palette_size == 7, "Second provider should still have palette_size of 7")
|
||||||
|
|
||||||
# Test 3: Both instances should maintain read-only behavior
|
# Test 3: Both instances should maintain read-only behavior
|
||||||
var caught_exception_1 = false
|
var caught_exception_1 = false
|
||||||
@ -161,7 +161,7 @@ def test_palette_size_with_new_instances()
|
|||||||
assert(caught_exception_2, "Second provider should reject palette_size writes")
|
assert(caught_exception_2, "Second provider should reject palette_size writes")
|
||||||
|
|
||||||
assert(provider1.palette_size == 2, "First provider palette_size should remain 2")
|
assert(provider1.palette_size == 2, "First provider palette_size should remain 2")
|
||||||
assert(provider2.palette_size == 3, "Second provider palette_size should remain 3")
|
assert(provider2.palette_size == 7, "Second provider palette_size should remain 7")
|
||||||
|
|
||||||
print("✓ Multiple instance tests passed!")
|
print("✓ Multiple instance tests passed!")
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user