1package io.flutter.plugin.editing;
3import static org.junit.Assert.assertEquals;
5import androidx.test.ext.junit.runners.AndroidJUnit4;
6import org.junit.Before;
8import org.junit.runner.RunWith;
9import org.mockito.MockitoAnnotations;
10import org.robolectric.annotation.Config;
13@RunWith(AndroidJUnit4.class)
17 MockitoAnnotations.openMocks(
this);
22 final CharSequence oldText =
"hell";
23 final CharSequence textAfterChange =
"hello";
25 final int oldComposingStart = 0;
26 final int oldComposingEnd = 4;
28 final int startOfReplacementText = 0;
29 final int endOfReplacementText = textAfterChange.length();
31 final int newSelectionStart = 5;
32 final int newSelectionEnd = 5;
33 final int newComposingStart = 0;
34 final int newComposingEnd = 5;
47 assertEquals(oldText,
delta.getOldText());
48 assertEquals(textAfterChange,
delta.getDeltaText());
49 assertEquals(oldComposingStart,
delta.getDeltaStart());
50 assertEquals(oldComposingEnd,
delta.getDeltaEnd());
51 assertEquals(newSelectionStart,
delta.getNewSelectionStart());
52 assertEquals(newSelectionEnd,
delta.getNewSelectionEnd());
53 assertEquals(newComposingStart,
delta.getNewComposingStart());
54 assertEquals(newComposingEnd,
delta.getNewComposingEnd());
59 final CharSequence oldText =
"hello";
61 final int newSelectionStart = 3;
62 final int newSelectionEnd = 3;
63 final int newComposingStart = 0;
64 final int newComposingEnd = 5;
68 oldText, newSelectionStart, newSelectionEnd, newComposingStart, newComposingEnd);
70 assertEquals(oldText,
delta.getOldText());
71 assertEquals(
"",
delta.getDeltaText());
72 assertEquals(-1,
delta.getDeltaStart());
73 assertEquals(-1,
delta.getDeltaEnd());
74 assertEquals(newSelectionStart,
delta.getNewSelectionStart());
75 assertEquals(newSelectionEnd,
delta.getNewSelectionEnd());
76 assertEquals(newComposingStart,
delta.getNewComposingStart());
77 assertEquals(newComposingEnd,
delta.getNewComposingEnd());
void testNonTextUpdateConstructorTextEditingDelta()
void testConstructorTextEditingDelta()