diff options
author | appable <enzospiacitelli@gmail.com> | 2024-06-01 03:31:25 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-01 12:31:25 +0200 |
commit | 2698b9d13de081be2e72e63faa213a74cafb6a6b (patch) | |
tree | 33764051474a286d91da3c6c5f93dd804eb66ca1 /src/test/java/at/hannibal2/skyhanni | |
parent | 020bd7ec2c4250a5787f805b7961cc7af99d70a1 (diff) | |
download | skyhanni-2698b9d13de081be2e72e63faa213a74cafb6a6b.tar.gz skyhanni-2698b9d13de081be2e72e63faa213a74cafb6a6b.tar.bz2 skyhanni-2698b9d13de081be2e72e63faa213a74cafb6a6b.zip |
Backend: Keep visual formatting appearance with CharSequence.removeColor(keepFormatting=true) (#1824)
Diffstat (limited to 'src/test/java/at/hannibal2/skyhanni')
-rw-r--r-- | src/test/java/at/hannibal2/skyhanni/test/RemoveColorTest.kt | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/test/java/at/hannibal2/skyhanni/test/RemoveColorTest.kt b/src/test/java/at/hannibal2/skyhanni/test/RemoveColorTest.kt index f12f295fa..f50fc2403 100644 --- a/src/test/java/at/hannibal2/skyhanni/test/RemoveColorTest.kt +++ b/src/test/java/at/hannibal2/skyhanni/test/RemoveColorTest.kt @@ -21,7 +21,16 @@ class RemoveColorTest { @Test fun testKeepNonColor() { - Assertions.assertEquals("§k§l§m§n§o§r", "§k§l§m§f§n§o§r".removeColor(true)) + Assertions.assertEquals("§k§l§m", "§f§k§l§m".removeColor(true)) + } + + @Test + fun testColorToResetIfFormatted() { + // Replace color code with §r if a formatting style is being applied + Assertions.assertEquals("§k§l§m§r§o", "§k§l§m§f§o".removeColor(true)) + + // Remove the color code otherwise + Assertions.assertEquals("§m§r§l", "§m§r§f§l".removeColor(true)) } @Test @@ -40,6 +49,13 @@ class RemoveColorTest { "Ancient Necron's Chestplate ✪✪✪✪", "§dAncient Necron's Chestplate §6✪§6✪§6✪§6✪".removeColor() ) + Assertions.assertEquals( + "PROMOTE ➜ [158] Manager", + "§5§o§a§lPROMOTE §8➜ §7[158§7] §5Manager".removeColor() + ) + Assertions.assertEquals( + "§o§r§lPROMOTE §r➜ [158] Manager", + "§5§o§a§lPROMOTE §8➜ §7[158§7] §5Manager".removeColor(true) + ) } - } |