mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-11-07 11:06:11 -10:00
Add shadow_color coverage to the text display render parity test
Fixes #3531's render side landed in #3341; this adds the shadow cases its branch carried for tools/test_text_display_render_parity.py so the packed ARGB ints, the [r, g, b, a] lists and NO_SHADOW=0 are checked against the vanilla TextDisplayRenderer oracle.
This commit is contained in:
1 parent
7f54b8abb4
commit
2982f6eb9a
1 file changed
+12
@@ -32,6 +32,10 @@ CHARS = ('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
|
||||
' .,:;!?\'"()[]{}<>-_+=*/\\|@#$%^&~`' 'äöüßéèêñçÅØæ' 'АБВГДабвгдΩλπ')
|
||||
COLORS = ['gold', 'red', 'aqua', 'gray', 'dark_gray', 'green', 'white', 'black', '#FFAA00', '#123456', '#E0E0FF']
|
||||
LEGACY = '0123456789abcdeflmnor'
|
||||
# Style.shadowColor: the packed ARGB ints and the [r, g, b, a] float lists
|
||||
# the scoreboard command writes; 0 is NO_SHADOW.
|
||||
SHADOWS = [-65536, 0, -1, 2130771712, [1.0, 0.0, 0.0, 1.0], [0.0, 1.0, 0.0, 0.5],
|
||||
[0.25, 0.75, 0.5, 0.25], [1.0, 1.0, 0.0, 0.0625]]
|
||||
|
||||
|
||||
def words(rng, count):
|
||||
@@ -51,6 +55,8 @@ def part(rng):
|
||||
out[key] = rng.random() < 0.8
|
||||
if rng.random() < 0.6:
|
||||
out['color'] = rng.choice(COLORS)
|
||||
if rng.random() < 0.35:
|
||||
out['shadow_color'] = rng.choice(SHADOWS)
|
||||
return out
|
||||
|
||||
|
||||
@@ -64,6 +70,12 @@ def cases(count):
|
||||
{'text': {'text': 'see through'}, 'flags': 3},
|
||||
{'text': {'text': 'default background'}, 'flags': 4},
|
||||
{'text': {'text': 'faint'}, 'flags': 1, 'opacity': 4, 'background': 0},
|
||||
{'text': {'text': 'red shadow', 'color': 'white', 'shadow_color': -65536}, 'flags': 1},
|
||||
{'text': {'text': 'half green shadow', 'shadow_color': [0.0, 1.0, 0.0, 0.5]}, 'flags': 1},
|
||||
{'text': {'text': 'no shadow', 'shadow_color': 0}, 'flags': 1},
|
||||
{'text': {'text': '§6§l legacy shadow', 'shadow_color': [0.0, 0.0, 1.0, 1.0]}, 'flags': 1},
|
||||
{'text': {'text': 'fading shadow', 'color': 'aqua', 'shadow_color': [1.0, 0.5, 0.0, 0.8]},
|
||||
'flags': 1, 'opacity': 64},
|
||||
]
|
||||
out = []
|
||||
for n in range(count):
|
||||
|
||||
Reference in new issue
Block a user