summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2017-09-18 20:46:38 +1000
committermd_5 <git@md-5.net>2017-09-18 20:46:38 +1000
commit4f16bdbabbad82b6130b19bcc0a4621dee83e86e (patch)
tree71fd3a46ae21a6824147fee3baa9888177e2fee2 /src/test
parent06355ab54732ff648a69bdb72aa242ff46e11e34 (diff)
downloadbukkit-4f16bdbabbad82b6130b19bcc0a4621dee83e86e.tar
bukkit-4f16bdbabbad82b6130b19bcc0a4621dee83e86e.tar.gz
bukkit-4f16bdbabbad82b6130b19bcc0a4621dee83e86e.tar.lz
bukkit-4f16bdbabbad82b6130b19bcc0a4621dee83e86e.tar.xz
bukkit-4f16bdbabbad82b6130b19bcc0a4621dee83e86e.zip
SPIGOT-3568: Fix single letter pagination edge case
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/bukkit/ChatPaginatorTest.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/test/java/org/bukkit/ChatPaginatorTest.java b/src/test/java/org/bukkit/ChatPaginatorTest.java
index 0a8acae9..a644b150 100644
--- a/src/test/java/org/bukkit/ChatPaginatorTest.java
+++ b/src/test/java/org/bukkit/ChatPaginatorTest.java
@@ -7,14 +7,12 @@ import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
-/**
- */
public class ChatPaginatorTest {
@Test
public void testWordWrap1() {
String rawString = ChatColor.RED + "123456789 123456789 123456789";
String[] lines = ChatPaginator.wordWrap(rawString, 19);
-
+
assertThat(lines.length, is(2));
assertThat(lines[0], is(ChatColor.RED + "123456789 123456789"));
assertThat(lines[1], is(ChatColor.RED.toString() + "123456789"));
@@ -128,12 +126,22 @@ public class ChatPaginatorTest {
assertThat(lines.length, is(1));
assertThat(lines[0], is(ChatColor.RED + "a a a " + ChatColor.BLUE + "a a"));
}
-
+
+ @Test
+ public void testWordWrap12() {
+ String rawString = "123 1 123";
+ String[] lines = ChatPaginator.wordWrap(rawString, 5);
+
+ assertThat(lines.length, is(2));
+ assertThat(lines[0], is(ChatColor.WHITE.toString() + "123 1"));
+ assertThat(lines[1], is(ChatColor.WHITE.toString() + "123"));
+ }
+
@Test
public void testPaginate1() {
String rawString = "1234 123456789 123456789 123456789";
ChatPaginator.ChatPage page = ChatPaginator.paginate(rawString, 1, 6, 2);
-
+
assertThat(page.getPageNumber(), is(1));
assertThat(page.getTotalPages(), is(4));
assertThat(page.getLines().length, is(2));