|
@@ -24,17 +24,17 @@ package com.dmdirc.ui.messages;
|
24
|
24
|
|
25
|
25
|
import java.util.Arrays;
|
26
|
26
|
import java.util.List;
|
27
|
|
-
|
28
|
27
|
import org.junit.Test;
|
29
|
28
|
import org.junit.runner.RunWith;
|
30
|
29
|
import org.junit.runners.Parameterized;
|
31
|
30
|
|
32
|
|
-import static org.junit.Assert.*;
|
|
31
|
+import static org.junit.Assert.assertEquals;
|
33
|
32
|
|
34
|
33
|
@RunWith(Parameterized.class)
|
35
|
34
|
public class StyliserIndicesTest {
|
36
|
35
|
|
37
|
36
|
private String input, output;
|
|
37
|
+
|
38
|
38
|
private int start, end;
|
39
|
39
|
|
40
|
40
|
public StyliserIndicesTest(final String input, final int start, final int end, final String output) {
|
|
@@ -52,22 +52,21 @@ public class StyliserIndicesTest {
|
52
|
52
|
@Parameterized.Parameters
|
53
|
53
|
public static List<Object[]> data() {
|
54
|
54
|
final Object[][] tests = {
|
55
|
|
- // No style
|
56
|
|
- {"Blah blah blah", 0, 1, "B"},
|
57
|
|
- {"Blah blah blah", 0, 4, "Blah"},
|
58
|
|
- {IRCControlCodes.BOLD + "Blah blah blah", 0, 4, IRCControlCodes.BOLD + "Blah"},
|
59
|
|
- {IRCControlCodes.BOLD + "Bl" + IRCControlCodes.BOLD + "ah blah blah",
|
60
|
|
- 0, 4, IRCControlCodes.BOLD + "Bl" + IRCControlCodes.BOLD + "ah"},
|
61
|
|
- {"Blah" + IRCControlCodes.BOLD + " blah blah",
|
62
|
|
- 0, 4, "Blah"},
|
63
|
|
- {"Blah" + IRCControlCodes.COLOUR + "4,0RED blah blah",
|
64
|
|
- 4, 7, IRCControlCodes.COLOUR + "4,0RED"},
|
65
|
|
- {"Blah" + IRCControlCodes.COLOUR + "4,0RED blah blah",
|
66
|
|
- 5, 7, "ED"},
|
67
|
|
- {Styliser.CODE_TOOLTIP + "Annoying internal tooltip text"
|
68
|
|
- + Styliser.CODE_TOOLTIP + "Blah" + Styliser.CODE_TOOLTIP + "Blah",
|
69
|
|
- 2, 6, "ahBl"},
|
70
|
|
- };
|
|
55
|
+ // No style
|
|
56
|
+ {"Blah blah blah", 0, 1, "B"}, {"Blah blah blah", 0, 4, "Blah"},
|
|
57
|
+ {IRCControlCodes.BOLD + "Blah blah blah", 0, 4, IRCControlCodes.BOLD + "Blah"},
|
|
58
|
+ {IRCControlCodes.BOLD + "Bl" + IRCControlCodes.BOLD + "ah blah blah", 0, 4,
|
|
59
|
+ IRCControlCodes.BOLD + "Bl" + IRCControlCodes.BOLD + "ah"},
|
|
60
|
+ {"Blah" + IRCControlCodes.BOLD + " blah blah", 0, 4, "Blah"},
|
|
61
|
+ {"Blah" + IRCControlCodes.UNDERLINE + " blah blah", 0, 6, "Blah" + IRCControlCodes.UNDERLINE + " b"},
|
|
62
|
+ {"Blah" + IRCControlCodes.STOP + " blah blah", 0, 6, "Blah" + IRCControlCodes.STOP + " b"},
|
|
63
|
+ {"Blah" + IRCControlCodes.COLOUR + "4,0RED blah blah", 4, 7, IRCControlCodes.COLOUR + "4,0RED"},
|
|
64
|
+ {"Blah" + IRCControlCodes.COLOUR + "4,0RED blah blah", 5, 7, "ED"},
|
|
65
|
+ {Styliser.CODE_TOOLTIP + "Annoying internal tooltip text" + Styliser.CODE_TOOLTIP + "Blah"
|
|
66
|
+ + Styliser.CODE_TOOLTIP + "Blah", 2, 6, "ahBl"},
|
|
67
|
+ {Styliser.CODE_NICKNAME + "Annoying internal tooltip text" + Styliser.CODE_NICKNAME
|
|
68
|
+ + IRCControlCodes.BOLD + "Blah" + IRCControlCodes.BOLD + Styliser.CODE_NICKNAME + "Blah", 2, 6,
|
|
69
|
+ "ah" + IRCControlCodes.BOLD + "Bl"},};
|
71
|
70
|
|
72
|
71
|
return Arrays.asList(tests);
|
73
|
72
|
}
|