Add runtime text shadow support
This commit is contained in:
@@ -138,6 +138,31 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('applies text shadow style', () {
|
||||
final component = RuntimeComponent(
|
||||
node: const RuntimeNode(
|
||||
id: 'text',
|
||||
type: RuntimeNodeType.text,
|
||||
text: 'Shadowed',
|
||||
alpha: 0.5,
|
||||
textShadowColor: Color(0x80000000),
|
||||
textShadowOffsetX: 2,
|
||||
textShadowOffsetY: 3,
|
||||
textShadowBlur: 4,
|
||||
),
|
||||
resources: GameResourceManager(),
|
||||
onNodeTap: (_, __) {},
|
||||
);
|
||||
|
||||
final text = component.children.whereType<TextComponent>().single;
|
||||
final style = (text.textRenderer as TextPaint).style;
|
||||
final shadow = style.shadows!.single;
|
||||
expect(shadow.color.a, closeTo(0.25, 0.003));
|
||||
expect(shadow.offset.dx, 2);
|
||||
expect(shadow.offset.dy, 3);
|
||||
expect(shadow.blurRadius, 4);
|
||||
});
|
||||
|
||||
test('multi-line non-button text is top aligned', () {
|
||||
final component = RuntimeComponent(
|
||||
node: const RuntimeNode(
|
||||
|
||||
Reference in New Issue
Block a user