git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
serial/Exporter: Better zip/noZip choice
[fanfix.git]
/
src
/
be
/
nikiroo
/
utils
/
test
/
StringUtilsTest.java
diff --git
a/src/be/nikiroo/utils/test/StringUtilsTest.java
b/src/be/nikiroo/utils/test/StringUtilsTest.java
index 4be75040b9966106beb932b825f60d2e53a8adeb..29f5bf3d8936b9f9c48637ddbe7af43057fc238c 100644
(file)
--- a/
src/be/nikiroo/utils/test/StringUtilsTest.java
+++ b/
src/be/nikiroo/utils/test/StringUtilsTest.java
@@
-144,6
+144,10
@@
class StringUtilsTest extends TestLauncher {
@Override
public void test() throws Exception {
Map<String, Map<Integer, Entry<Alignment, List<String>>>> source = new HashMap<String, Map<Integer, Entry<Alignment, List<String>>>>();
@Override
public void test() throws Exception {
Map<String, Map<Integer, Entry<Alignment, List<String>>>> source = new HashMap<String, Map<Integer, Entry<Alignment, List<String>>>>();
+ addValue(source, Alignment.LEFT, "testy", -1, "testy");
+ addValue(source, Alignment.RIGHT, "testy", -1, "testy");
+ addValue(source, Alignment.CENTER, "testy", -1, "testy");
+ addValue(source, Alignment.JUSTIFY, "testy", -1, "testy");
addValue(source, Alignment.LEFT, "testy", 5, "testy");
addValue(source, Alignment.LEFT, "testy", 3, "te-", "sty");
addValue(source, Alignment.LEFT,
addValue(source, Alignment.LEFT, "testy", 5, "testy");
addValue(source, Alignment.LEFT, "testy", 3, "te-", "sty");
addValue(source, Alignment.LEFT,
@@
-164,14
+168,15
@@
class StringUtilsTest extends TestLauncher {
" sur ", "plusie-", " urs ", "lignes ");
addValue(source, Alignment.JUSTIFY,
"Un petit texte qui se mettra sur plusieurs lignes", 7,
" sur ", "plusie-", " urs ", "lignes ");
addValue(source, Alignment.JUSTIFY,
"Un petit texte qui se mettra sur plusieurs lignes", 7,
- "Un
", "petit", "texte", "qui se", "mettra", "
sur",
- "plusie-", "urs
", "li
gnes");
+ "Un
pet-", "it tex-", "te qui", "se met-", "tra
sur",
+ "plusie-", "urs
li-", "
gnes");
addValue(source, Alignment.JUSTIFY,
"Un petit texte qui se mettra sur plusieurs lignes",
14, "Un petit", "texte qui se",
"mettra sur", "plusieurs lig-", "nes");
addValue(source, Alignment.JUSTIFY,
"Un petit texte qui se mettra sur plusieurs lignes",
14, "Un petit", "texte qui se",
"mettra sur", "plusieurs lig-", "nes");
+ addValue(source, Alignment.JUSTIFY, "le dash-test", 9,
+ "le dash-", "test");
- System.out.println();
for (String data : source.keySet()) {
for (int size : source.get(data).keySet()) {
Alignment align = source.get(data).get(size).getKey();
for (String data : source.keySet()) {
for (int size : source.get(data).keySet()) {
Alignment align = source.get(data).get(size).getKey();
@@
-181,21
+186,17
@@
class StringUtilsTest extends TestLauncher {
List<String> result = StringUtils.justifyText(data,
size, align);
List<String> result = StringUtils.justifyText(data,
size, align);
- System.out.println("[" + data + " (" + size + ")"
-
+
"] -> [");
- for (int i = 0; i < result.size(); i++) {
-
String resultLine = result.get(i);
-
System.out.println(i + ": " + resultLine);
- }
- System.out.println("]");
+ // System.out.println("[" + data + " (" + size + ")" +
+
//
"] -> [");
+
//
for (int i = 0; i < result.size(); i++) {
+
//
String resultLine = result.get(i);
+
//
System.out.println(i + ": " + resultLine);
+
//
}
+
//
System.out.println("]");
- for (int i = 0; i < result.size() && i < values.size(); i++) {
- assertEquals("The line " + i + " is not correct",
- values.get(i), result.get(i));
- }
+ assertEquals(values, result);
}
}
}
}
- System.out.println();
}
});
}
});