mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-10-24 05:35:56 +03:00
Add unit test for Toggle italic for last bold + italic in a row of multiple marked elements
Signed-off-by: Stefan Niedermann <info@niedermann.it>
This commit is contained in:
parent
4d7260464c
commit
11d878fac9
1 changed files with 29 additions and 0 deletions
|
@ -98,53 +98,77 @@ public class MarkdownUtilTest extends TestCase {
|
|||
final Map<String, Boolean> lines = new HashMap<>();
|
||||
lines.put(" - [ ] a", true);
|
||||
lines.put(" - [x] a", true);
|
||||
lines.put(" - [X] a", true);
|
||||
lines.put(" * [ ] a", true);
|
||||
lines.put(" * [x] a", true);
|
||||
lines.put(" * [X] a", true);
|
||||
lines.put(" + [ ] a", true);
|
||||
lines.put(" + [x] a", true);
|
||||
lines.put(" + [X] a", true);
|
||||
lines.put("- [ ] a", true);
|
||||
lines.put("- [x] a", true);
|
||||
lines.put("- [X] a", true);
|
||||
lines.put("* [ ] a", true);
|
||||
lines.put("* [x] a", true);
|
||||
lines.put("* [X] a", true);
|
||||
lines.put("+ [ ] a", true);
|
||||
lines.put("+ [x] a", true);
|
||||
lines.put("+ [X] a", true);
|
||||
lines.put(" - [ ] ", true);
|
||||
lines.put(" - [x] ", true);
|
||||
lines.put(" - [X] ", true);
|
||||
lines.put(" * [ ] ", true);
|
||||
lines.put(" * [x] ", true);
|
||||
lines.put(" * [X] ", true);
|
||||
lines.put(" + [ ] ", true);
|
||||
lines.put(" + [x] ", true);
|
||||
lines.put(" + [X] ", true);
|
||||
lines.put(" - [ ]", true);
|
||||
lines.put(" - [x]", true);
|
||||
lines.put(" - [X]", true);
|
||||
lines.put(" * [ ]", true);
|
||||
lines.put(" * [x]", true);
|
||||
lines.put(" * [X]", true);
|
||||
lines.put(" + [ ]", true);
|
||||
lines.put(" + [x]", true);
|
||||
lines.put(" + [X]", true);
|
||||
lines.put("- [ ] ", true);
|
||||
lines.put("- [x] ", true);
|
||||
lines.put("- [X] ", true);
|
||||
lines.put("* [ ] ", true);
|
||||
lines.put("* [x] ", true);
|
||||
lines.put("* [X] ", true);
|
||||
lines.put("+ [ ] ", true);
|
||||
lines.put("+ [x] ", true);
|
||||
lines.put("+ [X] ", true);
|
||||
lines.put("- [ ]", true);
|
||||
lines.put("- [x]", true);
|
||||
lines.put("- [X]", true);
|
||||
lines.put("* [ ]", true);
|
||||
lines.put("* [x]", true);
|
||||
lines.put("* [X]", true);
|
||||
lines.put("+ [ ]", true);
|
||||
lines.put("+ [x]", true);
|
||||
lines.put("+ [X]", true);
|
||||
|
||||
lines.put("-[ ] ", false);
|
||||
lines.put("-[x] ", false);
|
||||
lines.put("-[X] ", false);
|
||||
lines.put("*[ ] ", false);
|
||||
lines.put("*[x] ", false);
|
||||
lines.put("*[X] ", false);
|
||||
lines.put("+[ ] ", false);
|
||||
lines.put("+[x] ", false);
|
||||
lines.put("+[X] ", false);
|
||||
lines.put("-[ ]", false);
|
||||
lines.put("-[x]", false);
|
||||
lines.put("-[X]", false);
|
||||
lines.put("*[ ]", false);
|
||||
lines.put("*[x]", false);
|
||||
lines.put("*[X]", false);
|
||||
lines.put("+[ ]", false);
|
||||
lines.put("+[x]", false);
|
||||
lines.put("+[X]", false);
|
||||
|
||||
lines.put("- [] ", false);
|
||||
lines.put("* [] ", false);
|
||||
|
@ -331,6 +355,11 @@ public class MarkdownUtilTest extends TestCase {
|
|||
assertEquals(24, MarkdownUtil.togglePunctuation(builder, 18, 23, "*"));
|
||||
assertEquals("Lorem **Ipsum** ***Dolor***", builder.toString());
|
||||
|
||||
// Toggle italic for last bold + italic in a row of multiple marked elements
|
||||
builder = new SpannableStringBuilder("Lorem **Ipsum** ***Dolor***");
|
||||
assertEquals(23, MarkdownUtil.togglePunctuation(builder, 19, 24, "*"));
|
||||
assertEquals("Lorem **Ipsum** **Dolor**", builder.toString());
|
||||
|
||||
// Multiline
|
||||
|
||||
builder = new SpannableStringBuilder("**Bold**\nItalic");
|
||||
|
|
Loading…
Reference in a new issue