mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-11-03 00:59:39 +01:00
a6198586d9
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing BungeeCord Changes: 15b51413 #2908: Don't frame packets for dead connections a0f9333a Bump version to 1.16-R0.4-SNAPSHOT 287e28a7 Release 1.16-R0.3 c1522ab9 #2909: Don't serialise as array for single element contents 0af4bfdb #2905: HoverEvent getValue compat method
58 lines
2.6 KiB
Diff
58 lines
2.6 KiB
Diff
From 914e63b8024182183a313a03f1d72b4bd8bd3681 Mon Sep 17 00:00:00 2001
|
|
From: Tux <write@imaginarycode.com>
|
|
Date: Thu, 19 May 2016 17:36:31 -0600
|
|
Subject: [PATCH] Better unit tests for Chat API
|
|
|
|
|
|
diff --git a/chat/src/test/java/net/md_5/bungee/api/chat/ComponentsTest.java b/chat/src/test/java/net/md_5/bungee/api/chat/ComponentsTest.java
|
|
index 23fa3024..c4a7ee5e 100644
|
|
--- a/chat/src/test/java/net/md_5/bungee/api/chat/ComponentsTest.java
|
|
+++ b/chat/src/test/java/net/md_5/bungee/api/chat/ComponentsTest.java
|
|
@@ -450,6 +450,26 @@ public class ComponentsTest
|
|
Assert.assertEquals( eventRetention[1].getClickEvent(), testClickEvent );
|
|
}
|
|
|
|
+ @Test
|
|
+ public void testBuilderSpecialFormatting()
|
|
+ {
|
|
+ BaseComponent[] components = new ComponentBuilder( "Hello " )
|
|
+ .bold(true).underlined(true).italic(true).strikethrough(true).obfuscated(true)
|
|
+ .append("World").underlined(false).strikethrough(false).create();
|
|
+
|
|
+ Assert.assertTrue( components[0].isBold() );
|
|
+ Assert.assertTrue( components[0].isUnderlined() );
|
|
+ Assert.assertTrue( components[0].isItalic() );
|
|
+ Assert.assertTrue( components[0].isStrikethrough() );
|
|
+ Assert.assertTrue( components[0].isObfuscated() );
|
|
+
|
|
+ Assert.assertTrue( components[1].isBold() );
|
|
+ Assert.assertFalse( components[1].isUnderlined() );
|
|
+ Assert.assertTrue( components[1].isItalic() );
|
|
+ Assert.assertFalse( components[1].isStrikethrough() );
|
|
+ Assert.assertTrue( components[1].isObfuscated() );
|
|
+ }
|
|
+
|
|
@Test(expected = IllegalArgumentException.class)
|
|
public void testLoopSimple()
|
|
{
|
|
diff --git a/chat/src/test/java/net/md_5/bungee/api/chat/TranslatableComponentTest.java b/chat/src/test/java/net/md_5/bungee/api/chat/TranslatableComponentTest.java
|
|
index 9e37eed0..a25a01b8 100644
|
|
--- a/chat/src/test/java/net/md_5/bungee/api/chat/TranslatableComponentTest.java
|
|
+++ b/chat/src/test/java/net/md_5/bungee/api/chat/TranslatableComponentTest.java
|
|
@@ -25,4 +25,12 @@ public class TranslatableComponentTest
|
|
Assert.assertEquals( "Test string with a placeholder", TextComponent.toPlainText( baseComponents ) );
|
|
Assert.assertEquals( "§fTest string with §fa§f placeholder", TextComponent.toLegacyText( baseComponents ) );
|
|
}
|
|
+
|
|
+ @Test
|
|
+ public void testEscapedPercentInPlainText()
|
|
+ {
|
|
+ TranslatableComponent testComponent = new TranslatableComponent( "Test string with %% sign" );
|
|
+ Assert.assertEquals( "Test string with % sign", testComponent.toPlainText() );
|
|
+ Assert.assertEquals( "§fTest string with §f%§f sign", testComponent.toLegacyText() );
|
|
+ }
|
|
}
|
|
--
|
|
2.25.1
|
|
|