diff options
| author | mat <git@matdoes.dev> | 2025-08-12 17:39:05 +1200 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-08-12 17:39:05 +1200 |
| commit | 12aeae07d2667cd188acf88190ed5c3f7983926a (patch) | |
| tree | 4f4549b8e37d76f098d4164398517813bb0dfcc6 /azalea-chat/tests | |
| parent | fa1050d6eedf80bbc20e91163b99c0306414e627 (diff) | |
| download | azalea-drasl-12aeae07d2667cd188acf88190ed5c3f7983926a.tar.xz | |
fix wrong chat styling sometimes when 'extra' field is used
Diffstat (limited to 'azalea-chat/tests')
| -rw-r--r-- | azalea-chat/tests/integration_test.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/azalea-chat/tests/integration_test.rs b/azalea-chat/tests/integration_test.rs index 37e4620f..08f59d48 100644 --- a/azalea-chat/tests/integration_test.rs +++ b/azalea-chat/tests/integration_test.rs @@ -41,7 +41,7 @@ fn complex_ansi_test() { { "text": " asdf", "italic": false, - "obfuscated": "true", + "obfuscated": true, "strikethrough": false }, { @@ -52,16 +52,18 @@ fn complex_ansi_test() { ) .unwrap(); let component = FormattedText::deserialize(&j).unwrap(); + assert_eq!( component.to_ansi(), format!( - "{bold}{italic}{underlined}{red}hello{reset}{bold}{italic}{red} {reset}{italic}{strikethrough}{abcdef}world{reset}{abcdef} asdf{bold}!{reset}", + "{bold}{italic}{underlined}{red}hello{reset}{bold}{italic}{red} {reset}{italic}{underlined}{strikethrough}{abcdef}world{reset}{bold}{underlined}{obfuscated}{red} asdf{reset}{bold}{italic}{underlined}{red}!{reset}", bold = Ansi::BOLD, italic = Ansi::ITALIC, underlined = Ansi::UNDERLINED, red = Ansi::rgb(ChatFormatting::Red.color().unwrap()), reset = Ansi::RESET, strikethrough = Ansi::STRIKETHROUGH, + obfuscated = Ansi::OBFUSCATED, abcdef = Ansi::rgb(TextColor::parse("#abcdef").unwrap().value), ) ); @@ -71,5 +73,5 @@ fn complex_ansi_test() { fn component_from_string() { let j: Value = serde_json::from_str("\"foo\"").unwrap(); let component = FormattedText::deserialize(&j).unwrap(); - assert_eq!(component.to_ansi(), "foo"); + assert_eq!(component.to_ansi(), "\u{1b}[38;2;255;255;255mfoo\u{1b}[m"); } |
