Home
last modified time | relevance | path

Searched refs:spans (Results 1 – 25 of 60) sorted by relevance

123

/frameworks/base/tools/aapt2/compile/
DPseudolocaleGenerator_test.cpp30 original_style.spans = {Span{"i", 1, 10}, Span{"b", 2, 3}, Span{"b", 6, 7}}; in TEST()
37 ASSERT_EQ(original_style.spans.size(), new_string->value->spans.size()); in TEST()
39 EXPECT_EQ(std::string("i"), *new_string->value->spans[0].name); in TEST()
40 EXPECT_EQ(std::u16string(u"H").size(), new_string->value->spans[0].first_char); in TEST()
41 EXPECT_EQ(std::u16string(u"Hello worl").size(), new_string->value->spans[0].last_char); in TEST()
43 EXPECT_EQ(std::string("b"), *new_string->value->spans[1].name); in TEST()
44 EXPECT_EQ(std::u16string(u"He").size(), new_string->value->spans[1].first_char); in TEST()
45 EXPECT_EQ(std::u16string(u"Hel").size(), new_string->value->spans[1].last_char); in TEST()
47 EXPECT_EQ(std::string("b"), *new_string->value->spans[2].name); in TEST()
48 EXPECT_EQ(std::u16string(u"Hello ").size(), new_string->value->spans[2].first_char); in TEST()
[all …]
/frameworks/base/core/tests/coretests/src/android/text/
DSpannedStringNoCopyTest.java45 final Object[] spans = copied.getSpans(0, copied.length(), Object.class); in testCopyConstructor_copyNoCopySpans_SpannableStringInternalImpl() local
46 assertNotNull(spans); in testCopyConstructor_copyNoCopySpans_SpannableStringInternalImpl()
47 assertEquals(3, spans.length); in testCopyConstructor_copyNoCopySpans_SpannableStringInternalImpl()
59 final Object[] spans = copied.getSpans(0, copied.length(), Object.class); in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl() local
60 assertNotNull(spans); in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl()
61 assertEquals(2, spans.length); in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl()
63 for (int i = 0; i < spans.length; i++) { in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl()
64 assertFalse(spans[i] instanceof NoCopySpan); in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl()
77 final Object[] spans = copied.getSpans(0, copied.length(), Object.class); in testCopyConstructor_copyNoCopySpans_OtherSpannedImpl() local
78 assertNotNull(spans); in testCopyConstructor_copyNoCopySpans_OtherSpannedImpl()
[all …]
DSpannableStringNoCopyTest.java45 final Object[] spans = copied.getSpans(0, copied.length(), Object.class); in testCopyConstructor_copyNoCopySpans_SpannableStringInternalImpl() local
46 assertNotNull(spans); in testCopyConstructor_copyNoCopySpans_SpannableStringInternalImpl()
47 assertEquals(3, spans.length); in testCopyConstructor_copyNoCopySpans_SpannableStringInternalImpl()
59 final Object[] spans = copied.getSpans(0, copied.length(), Object.class); in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl() local
60 assertNotNull(spans); in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl()
61 assertEquals(2, spans.length); in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl()
63 for (int i = 0; i < spans.length; i++) { in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl()
64 assertFalse(spans[i] instanceof NoCopySpan); in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl()
77 final Object[] spans = copied.getSpans(0, copied.length(), Object.class); in testCopyConstructor_copyNoCopySpans_OtherSpannableImpl() local
78 assertNotNull(spans); in testCopyConstructor_copyNoCopySpans_OtherSpannableImpl()
[all …]
DSpannableTest.java47 Object[] spans; in testGetSpans() local
52 spans = spannable.getSpans(0, 1, Object.class); in testGetSpans()
53 MoreAsserts.assertEquals(new Object[]{emptySpan}, spans); in testGetSpans()
54 spans = spannable.getSpans(0, 2, Object.class); in testGetSpans()
55 MoreAsserts.assertEquals(new Object[]{emptySpan, unemptySpan}, spans); in testGetSpans()
56 spans = spannable.getSpans(1, 2, Object.class); in testGetSpans()
57 MoreAsserts.assertEquals(new Object[]{emptySpan, unemptySpan}, spans); in testGetSpans()
58 spans = spannable.getSpans(2, 2, Object.class); in testGetSpans()
59 MoreAsserts.assertEquals(new Object[]{unemptySpan}, spans); in testGetSpans()
DSpannableStringBuilderTest.java57 Object[] spans = builder.getSpans(0, text.length(), Object.class, false); in testGetSpans_sortsByPriorityEvenWhenSortParamIsFalse() local
59 assertNotNull(spans); in testGetSpans_sortsByPriorityEvenWhenSortParamIsFalse()
60 assertEquals(4, spans.length); in testGetSpans_sortsByPriorityEvenWhenSortParamIsFalse()
62 assertEquals(fourth, spans[0]); in testGetSpans_sortsByPriorityEvenWhenSortParamIsFalse()
63 assertEquals(third, spans[1]); in testGetSpans_sortsByPriorityEvenWhenSortParamIsFalse()
65 assertEquals(second, spans[2]); in testGetSpans_sortsByPriorityEvenWhenSortParamIsFalse()
66 assertEquals(first, spans[3]); in testGetSpans_sortsByPriorityEvenWhenSortParamIsFalse()
DTextLineTest.java199 final Object[] spans = { new TabStopSpan.Standard(100) }; in testMeasure_Tab_LTR() local
200 final TabStops stops = new TabStops(100, spans); in testMeasure_Tab_LTR()
214 final Object[] spans = { new TabStopSpan.Standard(100) }; in testMeasure_Tab_RTL() local
215 final TabStops stops = new TabStops(100, spans); in testMeasure_Tab_RTL()
229 final Object[] spans = { new TabStopSpan.Standard(100) }; in testMeasure_Tab_BiDi() local
230 final TabStops stops = new TabStops(100, spans); in testMeasure_Tab_BiDi()
244 final Object[] spans = { new TabStopSpan.Standard(100) }; in testMeasure_Tab_BiDi2() local
245 final TabStops stops = new TabStops(100, spans); in testMeasure_Tab_BiDi2()
DTextUtilsTest.java155 private void checkContains(Spanned text, String[] spans, String spanName, in checkContains() argument
157 for (String i: spans) { in checkContains()
171 String[] spans; in testTemplateSpan() local
183 spans = result.getSpans(0, result.length(), String.class); in testTemplateSpan()
186 assertEquals(4, spans.length); in testTemplateSpan()
187 checkContains(result, spans, "before", 0, 1); in testTemplateSpan()
188 checkContains(result, spans, "during", 1, 4); in testTemplateSpan()
189 checkContains(result, spans, "after", 4, 5); in testTemplateSpan()
190 checkContains(result, spans, "during+after", 1, 5); in testTemplateSpan()
197 spans = result.getSpans(0, result.length(), String.class); in testTemplateSpan()
[all …]
/frameworks/base/core/tests/coretests/src/android/text/util/
DLinkifyTest.java114 URLSpan[] spans = spannable.getSpans(0, spannable.length(), URLSpan.class); in testAddLinks_addsLinksWhenDefaultSchemeIsNull() local
115 assertEquals("android.com and https://android.com should be linkified", 2, spans.length); in testAddLinks_addsLinksWhenDefaultSchemeIsNull()
116 assertEquals("https://android.com", spans[0].getURL()); in testAddLinks_addsLinksWhenDefaultSchemeIsNull()
117 assertEquals("android.com", spans[1].getURL()); in testAddLinks_addsLinksWhenDefaultSchemeIsNull()
125 URLSpan[] spans = spannable.getSpans(0, spannable.length(), URLSpan.class); in testAddLinks_addsLinksWhenSchemesArrayIsNull() local
126 assertEquals("android.com and https://android.com should be linkified", 2, spans.length); in testAddLinks_addsLinksWhenSchemesArrayIsNull()
128 assertEquals("http://https://android.com", spans[0].getURL()); in testAddLinks_addsLinksWhenSchemesArrayIsNull()
129 assertEquals("http://android.com", spans[1].getURL()); in testAddLinks_addsLinksWhenSchemesArrayIsNull()
138 URLSpan[] spans = spannable.getSpans(0, spannable.length(), URLSpan.class); in testAddLinks_prependsDefaultSchemeToBeginingOfLink() local
139 assertEquals("android.com should be linkified", 1, spans.length); in testAddLinks_prependsDefaultSchemeToBeginingOfLink()
[all …]
/frameworks/opt/setupwizard/library/test/robotest/src/com/android/setupwizardlib/view/
DRichTextViewTest.java63 Object[] spans = ((Spanned) text).getSpans(0, text.length(), Annotation.class); in testLinkAnnotation() local
64 assertThat(spans).isEmpty(); in testLinkAnnotation()
66 spans = ((Spanned) text).getSpans(0, text.length(), LinkSpan.class); in testLinkAnnotation()
67 assertThat(spans).hasLength(1); in testLinkAnnotation()
68 assertThat(spans[0]).isInstanceOf(LinkSpan.class); in testLinkAnnotation()
70 .that(((LinkSpan) spans[0]).getId()) in testLinkAnnotation()
89 LinkSpan[] spans = ((Spanned) text).getSpans(0, text.length(), LinkSpan.class); in testOnLinkClickListener() local
90 spans[0].onClick(textView); in testOnLinkClickListener()
92 verify(listener).onLinkClick(eq(spans[0])); in testOnLinkClickListener()
108 LinkSpan[] spans = ((Spanned) text).getSpans(0, text.length(), LinkSpan.class); in testLegacyContextOnClickListener() local
[all …]
/frameworks/base/core/java/android/text/
DSpanSet.java39 E[] spans; field in SpanSet
54 if (length > 0 && (spans == null || spans.length < length)) { in init()
56 spans = (E[]) Array.newInstance(classType, length); in init()
73 spans[numberOfSpans] = span; in init()
84 Arrays.fill(spans, numberOfSpans, prevNumberOfSpans, null); in init()
118 if (spans != null) { in recycle()
119 Arrays.fill(spans, 0, numberOfSpans, null); in recycle()
DSpannableStringInternal.java72 Object[] spans = src.getSpans(start, end, Object.class); in copySpansFromSpanned() local
74 for (int i = 0; i < spans.length; i++) { in copySpansFromSpanned()
75 if (ignoreNoCopySpan && spans[i] instanceof NoCopySpan) { in copySpansFromSpanned()
78 int st = src.getSpanStart(spans[i]); in copySpansFromSpanned()
79 int en = src.getSpanEnd(spans[i]); in copySpansFromSpanned()
80 int fl = src.getSpanFlags(spans[i]); in copySpansFromSpanned()
87 setSpan(spans[i], st - start, en - start, fl, false/*enforceParagraph*/); in copySpansFromSpanned()
222 Object[] spans = mSpans; in setSpan() local
226 if (spans[i] == what) { in setSpan()
271 Object[] spans = mSpans; in removeSpan() local
[all …]
DMeasuredParagraph.java359 MetricAffectingSpan[] spans = mt.mSpanned.getSpans(spanStart, spanEnd, in buildForMeasurement() local
361 spans = TextUtils.removeEmptySpans(spans, mt.mSpanned, MetricAffectingSpan.class); in buildForMeasurement()
363 paint, spans, spanStart, spanEnd, null /* native builder ptr */); in buildForMeasurement()
423 MetricAffectingSpan[] spans = mt.mSpanned.getSpans(spanStart, spanEnd, in buildForStaticLayout() local
425 spans = TextUtils.removeEmptySpans(spans, mt.mSpanned, in buildForStaticLayout()
427 mt.applyMetricsAffectingSpan(paint, spans, spanStart, spanEnd, builder); in buildForStaticLayout()
461 ReplacementSpan[] spans = mSpanned.getSpans(start, end, ReplacementSpan.class); in resetAndAnalyzeBidi() local
463 for (int i = 0; i < spans.length; i++) { in resetAndAnalyzeBidi()
464 int startInPara = mSpanned.getSpanStart(spans[i]) - start; in resetAndAnalyzeBidi()
465 int endInPara = mSpanned.getSpanEnd(spans[i]) - start; in resetAndAnalyzeBidi()
[all …]
DLayout.java342 ParagraphStyle[] spans = NO_PARA_SPANS; in getJustifyWidth() local
352 spans = getParagraphSpans(sp, start, spanEnd, ParagraphStyle.class); in getJustifyWidth()
354 for (int n = spans.length - 1; n >= 0; n--) { in getJustifyWidth()
355 if (spans[n] instanceof AlignmentSpan) { in getJustifyWidth()
356 paraAlign = ((AlignmentSpan) spans[n]).getAlignment(); in getJustifyWidth()
362 final int length = spans.length; in getJustifyWidth()
365 if (spans[n] instanceof LeadingMarginSpan2) { in getJustifyWidth()
366 int count = ((LeadingMarginSpan2) spans[n]).getLeadingMarginLineCount(); in getJustifyWidth()
367 int startLine = getLineForOffset(sp.getSpanStart(spans[n])); in getJustifyWidth()
375 if (spans[n] instanceof LeadingMarginSpan) { in getJustifyWidth()
[all …]
/frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/widget/
DUsageProgressBarPreferenceTest.java78 final AbsoluteSizeSpan[] spans = summary in setUsageSummary_integerNumber_findAbsoluteSizeSpan() local
80 assertThat(spans.length).isEqualTo(1); in setUsageSummary_integerNumber_findAbsoluteSizeSpan()
81 assertThat(summary.getSpanStart(spans[0])).isEqualTo(0); in setUsageSummary_integerNumber_findAbsoluteSizeSpan()
82 assertThat(summary.getSpanEnd(spans[0])).isEqualTo(2); in setUsageSummary_integerNumber_findAbsoluteSizeSpan()
93 final AbsoluteSizeSpan[] spans = summary in setUsageSummary_floatingPointNumber_findAbsoluteSizeSpan() local
95 assertThat(spans.length).isEqualTo(1); in setUsageSummary_floatingPointNumber_findAbsoluteSizeSpan()
96 assertThat(summary.getSpanStart(spans[0])).isEqualTo(0); in setUsageSummary_floatingPointNumber_findAbsoluteSizeSpan()
97 assertThat(summary.getSpanEnd(spans[0])).isEqualTo(4); in setUsageSummary_floatingPointNumber_findAbsoluteSizeSpan()
108 final AbsoluteSizeSpan[] spans = summary in setUsageSummary_commaFloatingPointNumber_findAbsoluteSizeSpan() local
110 assertThat(spans.length).isEqualTo(1); in setUsageSummary_commaFloatingPointNumber_findAbsoluteSizeSpan()
[all …]
/frameworks/base/core/jni/
Dandroid_util_StringBlock.cpp101 auto spans = osb->styleAt(idx); in android_content_StringBlock_nativeGetStyle() local
102 if (!spans.has_value()) { in android_content_StringBlock_nativeGetStyle()
109 auto pos = *spans; in android_content_StringBlock_nativeGetStyle()
133 while ((*spans)->name.index != ResStringPool_span::END) { in android_content_StringBlock_nativeGetStyle()
134 env->SetIntArrayRegion(array, num * numInts, numInts, (jint*)spans->unsafe_ptr()); in android_content_StringBlock_nativeGetStyle()
135 (*spans)++; in android_content_StringBlock_nativeGetStyle()
/frameworks/base/tools/aapt/
DStringPool.h75 entry_style(const entry_style& o) : offset(o.offset), spans(o.spans) { } in entry_style()
78 Vector<entry_style_span> spans; member
98 ssize_t add(const String16& value, const Vector<entry_style_span>& spans,
103 status_t addStyleSpans(size_t idx, const Vector<entry_style_span>& spans);
DStringPool.cpp123 ssize_t StringPool::add(const String16& value, const Vector<entry_style_span>& spans, in add() argument
128 addStyleSpans(res, spans); in add()
186 mEntryStyleArray[pos].spans.size() : 0; in add()
214 status_t StringPool::addStyleSpans(size_t idx, const Vector<entry_style_span>& spans) in addStyleSpans() argument
216 const size_t N=spans.size(); in addStyleSpans()
218 status_t err = addStyleSpan(idx, spans[i]); in addStyleSpans()
234 style.spans.add(span); in addStyleSpan()
343 if (style.spans.size() > 0) { in sortByConfig()
412 const size_t N = style.spans.size(); in writeStringBlock()
414 entry_style_span& span = style.spans.editItemAt(i); in writeStringBlock()
[all …]
/frameworks/opt/setupwizard/library/test/instrumentation/src/com/android/setupwizardlib/test/
DSpanHelperTest.java43 final Object[] spans = ssb.getSpans(0, ssb.length(), Object.class); in testReplaceSpan() local
44 assertEquals("There should be one span in the builder", 1, spans.length); in testReplaceSpan()
45 assertSame("The span should be newSpan", newSpan, spans[0]); in testReplaceSpan()
/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/notification/
DTextViewTransformState.java69 Object[] spans = ownSpanned.getSpans(0, ownSpanned.length(), Object.class); in hasSameSpans() local
72 if (spans.length != otherSpans.length) { in hasSameSpans()
75 for (int i = 0; i < spans.length; i++) { in hasSameSpans()
76 Object span = spans[i]; in hasSameSpans()
/frameworks/opt/setupwizard/library/platform/src/com/android/setupwizardlib/view/
DRichTextView.java67 final Annotation[] spans = spannable.getSpans(0, spannable.length(), Annotation.class); in getRichText() local
68 for (Annotation span : spans) { in getRichText()
135 final ClickableSpan[] spans = in hasLinks() local
137 return spans.length > 0; in hasLinks()
/frameworks/base/core/java/android/view/textservice/
DTextInfo.java76 final SpellCheckSpan[] spans = spannableString.getSpans(0, spannableString.length(), in TextInfo() local
78 for (int i = 0; i < spans.length; ++i) { in TextInfo()
79 spannableString.removeSpan(spans[i]); in TextInfo()
/frameworks/base/tools/aapt2/
DStringPool.cpp129 if (entry_->spans.size() != rhs.entry_->spans.size()) { in operator ==()
133 auto rhs_iter = rhs.entry_->spans.begin(); in operator ==()
134 for (const Span& span : entry_->spans) { in operator ==()
213 for (const aapt::Span& span : str.spans) { in MakeRef()
214 entry->spans.emplace_back(Span{MakeRef(span.name), span.first_char, span.last_char}); in MakeRef()
228 for (const Span& span : ref.entry_->spans) { in MakeRef()
229 entry->spans.emplace_back(Span{MakeRef(*span.name), span.first_char, span.last_char}); in MakeRef()
474 if (!entry->spans.empty()) { in Flatten()
476 out->NextBlock<android::ResStringPool_span>(entry->spans.size()); in Flatten()
477 for (const Span& s : entry->spans) { in Flatten()
DResourceParser_test.cpp143 EXPECT_THAT(str->value->spans, SizeIs(2)); in TEST_F()
146 EXPECT_THAT(*str->value->spans[0].name, StrEq("b")); in TEST_F()
147 EXPECT_THAT(str->value->spans[0].first_char, Eq(18u)); in TEST_F()
148 EXPECT_THAT(str->value->spans[0].last_char, Eq(30u)); in TEST_F()
150 EXPECT_THAT(*str->value->spans[1].name, StrEq("small")); in TEST_F()
151 EXPECT_THAT(str->value->spans[1].first_char, Eq(25u)); in TEST_F()
152 EXPECT_THAT(str->value->spans[1].last_char, Eq(30u)); in TEST_F()
212 ASSERT_THAT(str->value->spans, SizeIs(2u)); in TEST_F()
213 EXPECT_THAT(*str->value->spans[0].name, StrEq("b")); in TEST_F()
214 EXPECT_THAT(str->value->spans[0].first_char, Eq(1u)); in TEST_F()
[all …]
/frameworks/opt/setupwizard/library/gingerbread/src/com/android/setupwizardlib/view/
DRichTextView.java67 final Annotation[] spans = spannable.getSpans(0, spannable.length(), Annotation.class); in getRichText() local
68 for (Annotation span : spans) { in getRichText()
149 final ClickableSpan[] spans = in hasLinks() local
151 return spans.length > 0; in hasLinks()
/frameworks/base/packages/SettingsLib/FooterPreference/src/com/android/settingslib/widget/
DLinkTextView.java44 final ClickableSpan[] spans = in setText() local
46 if (spans.length > 0) { in setText()

123