Home
last modified time | relevance | path

Searched refs:spannable (Results 1 – 18 of 18) sorted by relevance

/cts/tests/tests/text/src/android/text/cts/
DSelectionParagraphTest.java55 private void assertSelection(Spannable spannable, int start, int end) { in assertSelection() argument
57 Selection.getSelectionStart(spannable), Selection.getSelectionEnd(spannable)) in assertSelection()
64 final SpannableString spannable = new SpannableString(TEST_STRING); in testMoveParagraphNext_from_beginning_cursor() local
65 final Layout layout = getSixLineLayout(spannable, PAINT); in testMoveParagraphNext_from_beginning_cursor()
67 Selection.setSelection(spannable, 0); in testMoveParagraphNext_from_beginning_cursor()
69 assertThat(Selection.moveToParagraphEnd(spannable, layout)).isTrue(); in testMoveParagraphNext_from_beginning_cursor()
70 assertSelection(spannable, LOREM_IPSUM.length(), LOREM_IPSUM.length()); in testMoveParagraphNext_from_beginning_cursor()
72 assertThat(Selection.moveToParagraphEnd(spannable, layout)).isTrue(); in testMoveParagraphNext_from_beginning_cursor()
74 assertSelection(spannable, LOREM_IPSUM.length() * 2 + 1, LOREM_IPSUM.length() * 2 + 1); in testMoveParagraphNext_from_beginning_cursor()
80 final SpannableString spannable = new SpannableString(TEST_STRING); in testMoveParagraphNext_from_middle_cursor() local
[all …]
DSpannableStringTest.java62 SpannableString spannable = SpannableString.valueOf(text); in testValueOf() local
63 assertNotNull(spannable); in testValueOf()
64 assertEquals(text, spannable.toString()); in testValueOf()
66 spannable = new SpannableString(text); in testValueOf()
67 assertSame(spannable, SpannableString.valueOf(spannable)); in testValueOf()
79 SpannableString spannable = new SpannableString(text); in testSetSpan() local
81 spannable.setSpan(null, 1, 4, SpannableString.SPAN_POINT_POINT); in testSetSpan()
82 assertEquals(1, spannable.getSpanStart(null)); in testSetSpan()
83 assertEquals(4, spannable.getSpanEnd(null)); in testSetSpan()
84 assertEquals(SpannableString.SPAN_POINT_POINT, spannable.getSpanFlags(null)); in testSetSpan()
[all …]
DSpannableStringBuilderSpanTest.java139 private void verifySpanPositions(Spannable spannable, int replaceStart, int replaceEnd, in verifySpanPositions() argument
150 int start = spannable.getSpanStart(span); in verifySpanPositions()
151 int end = spannable.getSpanEnd(span); in verifySpanPositions()
371 void initSpans(Spannable spannable, int rangeStart, int rangeEnd, int flag) { in initSpans() argument
379 mPositionSet.addPosition((rangeEnd + spannable.length()) / 2); in initSpans()
380 mPositionSet.addPosition(spannable.length()); in initSpans()
388 spannable.setSpan(mSpans[count], start, end, flag); in initSpans()
397 spannable.setSpan(mRecorder, 0, spannable.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE); in initSpans()
398 mRecorder.reset(spannable); in initSpans()
437 public void reset(Spannable spannable) { in reset() argument
[all …]
DSpannable_FactoryTest.java42 Spannable spannable = factory.newSpannable(text); in testNewSpannable() local
43 assertNotNull(spannable); in testNewSpannable()
44 assertTrue(spannable instanceof SpannableString); in testNewSpannable()
45 assertEquals(text, spannable.toString()); in testNewSpannable()
DSpannableStringBuilderTest.java851 final SpannableStringBuilder spannable = new SpannableStringBuilder(text); in testReplace_shouldNotThrowIndexOutOfBoundsExceptionForLongText() local
852 Selection.setSelection(spannable, text.length()); in testReplace_shouldNotThrowIndexOutOfBoundsExceptionForLongText()
854 spannable.replace(0, text.length(), copiedText); in testReplace_shouldNotThrowIndexOutOfBoundsExceptionForLongText()
856 assertEquals(copiedText.length(), spannable.length()); in testReplace_shouldNotThrowIndexOutOfBoundsExceptionForLongText()
DSelectionTest.java979 Spannable spannable = new SpannableStringBuilder("abcdef"); in testRemoveSelectionOnlyTriggersOneSpanRemoved() local
980 Selection.setSelection(spannable, 0, 2); in testRemoveSelectionOnlyTriggersOneSpanRemoved()
996 spannable.setSpan(watcher, 0, 2, 0); in testRemoveSelectionOnlyTriggersOneSpanRemoved()
998 Selection.removeSelection(spannable); in testRemoveSelectionOnlyTriggersOneSpanRemoved()
DStaticLayoutTest.java1277 final SpannableString spannable = new SpannableString(text);
1278 spannable.setSpan(new Object(), 0, text.length(), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
1279 final Layout layout = StaticLayout.Builder.obtain(spannable, 0, spannable.length(),
/cts/tests/tests/text/src/android/text/method/cts/
DLinkMovementMethodTest.java130 Spannable spannable = new SpannableString("test sequence"); in testOnTakeFocus() local
131 Selection.setSelection(spannable, 0, spannable.length()); in testOnTakeFocus()
133 assertSelection(spannable, 0, spannable.length()); in testOnTakeFocus()
135 2 <= spannable.getSpans(0, spannable.length(), Object.class).length); in testOnTakeFocus()
136 method.onTakeFocus(null, spannable, View.FOCUS_UP); in testOnTakeFocus()
137 assertSelection(spannable, -1); in testOnTakeFocus()
138 assertEquals(1, spannable.getSpans(0, spannable.length(), Object.class).length); in testOnTakeFocus()
139 Object span = spannable.getSpans(0, spannable.length(), Object.class)[0]; in testOnTakeFocus()
140 assertEquals(0, spannable.getSpanStart(span)); in testOnTakeFocus()
141 assertEquals(0, spannable.getSpanEnd(span)); in testOnTakeFocus()
[all …]
DTouchTest.java143 final SpannableString spannable = new SpannableString(finalText); in testOnTouchEvent() local
163 () -> mReturnFromTouchEvent = Touch.onTouchEvent(mTextView, spannable, event1)); in testOnTouchEvent()
169 assertEquals(0, Touch.getInitialScrollX(mTextView, spannable)); in testOnTouchEvent()
170 assertEquals(0, Touch.getInitialScrollY(mTextView, spannable)); in testOnTouchEvent()
174 () -> mReturnFromTouchEvent = Touch.onTouchEvent(mTextView, spannable, event2)); in testOnTouchEvent()
180 assertEquals(0, Touch.getInitialScrollX(mTextView, spannable)); in testOnTouchEvent()
181 assertEquals(0, Touch.getInitialScrollY(mTextView, spannable)); in testOnTouchEvent()
185 () -> mReturnFromTouchEvent = Touch.onTouchEvent(mTextView, spannable, event3)); in testOnTouchEvent()
191 assertEquals(-1, Touch.getInitialScrollX(mTextView, spannable)); in testOnTouchEvent()
192 assertEquals(-1, Touch.getInitialScrollY(mTextView, spannable)); in testOnTouchEvent()
DBaseMovementMethodTest.java213 SpannableString spannable = new SpannableString(mTextView.getText()); in testCallPreviousParagraph() local
214 mMovementMethod.previousParagraph(mTextView, spannable); in testCallPreviousParagraph()
222 SpannableString spannable = new SpannableString(mTextView.getText()); in testCallNextParagraph() local
223 mMovementMethod.nextParagraph(mTextView, spannable); in testCallNextParagraph()
231 SpannableString spannable = new SpannableString(view.getText()); in previousParagraphCall() local
238 method.onKeyDown(view, spannable, event.getKeyCode(), event); in previousParagraphCall()
247 SpannableString spannable = new SpannableString(view.getText()); in nextParagraphCall() local
254 method.onKeyDown(view, spannable, event.getKeyCode(), event); in nextParagraphCall()
DEditorState.java157 final Spannable spannable = new SpannableString(sb.toString()); in setByString() local
172 spannable.setSpan(new MockReplacementSpan(), replacementSpanStart, replacementSpanEnd, in setByString()
175 mText = Editable.Factory.getInstance().newEditable(spannable); in setByString()
DArrowKeyMovementMethodTest.java975 Spannable spannable = new SpannableString("test content"); in testInitialize() local
978 assertEquals(-1, Selection.getSelectionStart(spannable)); in testInitialize()
979 assertEquals(-1, Selection.getSelectionEnd(spannable)); in testInitialize()
980 method.initialize(null, spannable); in testInitialize()
981 assertEquals(0, Selection.getSelectionStart(spannable)); in testInitialize()
982 assertEquals(0, Selection.getSelectionEnd(spannable)); in testInitialize()
984 Selection.setSelection(spannable, 2); in testInitialize()
985 assertEquals(2, Selection.getSelectionStart(spannable)); in testInitialize()
986 assertEquals(2, Selection.getSelectionEnd(spannable)); in testInitialize()
987 method.initialize(null, spannable); in testInitialize()
[all …]
DScrollingMovementMethodTest.java624 final SpannableString spannable = new SpannableString("Test Content"); in testOnKeyUp() local
629 assertFalse(method.onKeyUp(view, spannable, KeyEvent.KEYCODE_0, event)); in testOnKeyUp()
631 assertFalse(method.onKeyUp(null, spannable, KeyEvent.KEYCODE_0, event)); in testOnKeyUp()
633 assertFalse(method.onKeyUp(view, spannable, 0, event)); in testOnKeyUp()
634 assertFalse(method.onKeyUp(view, spannable, KeyEvent.KEYCODE_0, null)); in testOnKeyUp()
/cts/tests/tests/text/src/android/text/util/cts/
DLinkifyTest.java108 SpannableString spannable = new SpannableString("name@gmail.com, " in testAddLinksToSpannable() local
115 assertTrue(Linkify.addLinks(spannable, Linkify.WEB_URLS)); in testAddLinksToSpannable()
116 URLSpan[] spans = spannable.getSpans(0, spannable.length(), URLSpan.class); in testAddLinksToSpannable()
123 assertTrue(Linkify.addLinks(spannable, Linkify.EMAIL_ADDRESSES)); in testAddLinksToSpannable()
124 spans = spannable.getSpans(0, spannable.length(), URLSpan.class); in testAddLinksToSpannable()
148 SpannableString spannable = SpannableString.valueOf(text); in testAddLinksToTextView() local
149 tv.setText(spannable); in testAddLinksToTextView()
266 SpannableString spannable = new SpannableString(text); in testAddLinksToSpannableWithScheme() local
267 Linkify.addLinks(spannable, LINKIFY_TEST_PATTERN, "Test:"); in testAddLinksToSpannableWithScheme()
268 URLSpan[] spans = (spannable.getSpans(0, spannable.length(), URLSpan.class)); in testAddLinksToSpannableWithScheme()
[all …]
/cts/apps/CtsVerifier/src/com/android/cts/verifier/controls/
DControlsPanelTestUtils.java32 Spannable spannable = Spannable.Factory.getInstance().newSpannable(text); in addImage() local
36 spannable.setSpan( in addImage()
42 return spannable; in addImage()
/cts/tests/tests/telephony/current/src/android/telephony/cts/
DPhoneNumberUtilsTest.java396 Spannable spannable = new SpannableString("Hello 6502223333"); in testAddPhoneTtsSpan() local
398 PhoneNumberUtils.addTtsSpan(spannable, 5, spannable.length()); in testAddPhoneTtsSpan()
400 TtsSpan[] ttsSpans = spannable.getSpans(5, spannable.length() - 1, TtsSpan.class); in testAddPhoneTtsSpan()
411 Spannable spannable = (Spannable) PhoneNumberUtils.createTtsSpannable(phoneNumber); in testGetPhoneTtsSpannable() local
413 TtsSpan[] ttsSpans = spannable.getSpans(0, spannable.length() - 1, TtsSpan.class); in testGetPhoneTtsSpannable()
/cts/tests/tests/content/src/android/content/cts/
DClipDescriptionTest.java119 SpannableString spannable = new SpannableString("Hello this is some text"); in testIsStyledText() local
120 spannable.setSpan(new UnderlineSpan(), 6, 10, 0); in testIsStyledText()
121 ClipData clipData = new ClipData(clipDescription, new ClipData.Item(spannable)); in testIsStyledText()
131 ClipData clipData2 = ClipData.newPlainText("label", spannable); in testIsStyledText()
/cts/tests/tests/widget/src/android/widget/cts/
DTextViewTest.java2611 final Spannable spannable = (Spannable)textView.getText(); in hasSpansAtMiddleOfText() local
2612 final int at = spannable.length() / 2; in hasSpansAtMiddleOfText()
2613 return spannable.getSpans(at, at, type).length > 0; in hasSpansAtMiddleOfText()
2625 final Spannable spannable = (Spannable) mTextView.getText(); in testCutAndPaste_withAndWithoutStyle() local
2626 spannable.setSpan(new URLSpan("http://example.com"), 0, spannable.length(), 0); in testCutAndPaste_withAndWithoutStyle()
4900 SpannableString spannable = new SpannableString(string); in testGetUrls() local
4901 spannable.setSpan(new URLSpan(url), 0, url.length(), 0); in testGetUrls()
4902 mTextView.setText(spannable, BufferType.SPANNABLE); in testGetUrls()
4907 spannable.setSpan(new URLSpan(email), 0, email.length(), 0); in testGetUrls()
4908 mTextView.setText(spannable, BufferType.SPANNABLE); in testGetUrls()
[all …]