Lines Matching refs:TextUtils

37  * TextUtilsTest tests {@link TextUtils}.
43 assertEquals("", TextUtils.concat());
44 assertEquals("foo", TextUtils.concat("foo"));
45 assertEquals("foobar", TextUtils.concat("foo", "bar"));
46 assertEquals("foobarbaz", TextUtils.concat("foo", "bar", "baz"));
57 assertEquals("foo", TextUtils.concat(foo).toString());
58 assertEquals("foobar", TextUtils.concat(foo, bar).toString());
59 assertEquals("foobarbaz", TextUtils.concat(foo, bar, baz).toString());
61 assertEquals(1, ((Spanned) TextUtils.concat(foo)).getSpanStart("foo"));
63 assertEquals(1, ((Spanned) TextUtils.concat(foo, bar)).getSpanStart("foo"));
64 assertEquals(4, ((Spanned) TextUtils.concat(foo, bar)).getSpanStart("bar"));
66 assertEquals(1, ((Spanned) TextUtils.concat(foo, bar, baz)).getSpanStart("foo"));
67 assertEquals(4, ((Spanned) TextUtils.concat(foo, bar, baz)).getSpanStart("bar"));
68 assertEquals(7, ((Spanned) TextUtils.concat(foo, bar, baz)).getSpanStart("baz"));
70 assertTrue(TextUtils.concat("foo", "bar") instanceof String);
71 assertTrue(TextUtils.concat(foo, bar) instanceof SpannedString);
78 result = TextUtils.expandTemplate("This is a ^1 of the ^2 broadcast ^3.",
83 result = TextUtils.expandTemplate("^^^1^^^2^3^a^1^^b^^^c",
88 result = TextUtils.expandTemplate("^");
91 result = TextUtils.expandTemplate("^^");
94 result = TextUtils.expandTemplate("^^^");
97 result = TextUtils.expandTemplate("shorter ^1 values ^2.", "a", "");
101 TextUtils.expandTemplate("Only ^1 value given, but ^2 used.", "foo");
107 TextUtils.expandTemplate("^1 value given, and ^0 used.", "foo");
112 result = TextUtils.expandTemplate("^1 value given, and ^9 used.",
118 TextUtils.expandTemplate("^1 value given, and ^10 used.",
127 result = TextUtils.expandTemplate("^2", "foo", "^^");
130 result = TextUtils.expandTemplate("^^2", "foo", "1");
133 result = TextUtils.expandTemplate("^1", "value with ^2 in it", "foo");
164 result = (Spanned) TextUtils.expandTemplate(template, "foo");
178 result = (Spanned) TextUtils.expandTemplate(template, "");
216 TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(',');
231 assertEquals(s.trim().length(), TextUtils.getTrimmedLength(s));
281 TextUtils.TruncateAt kind = null;
285 kind = TextUtils.TruncateAt.START;
289 kind = TextUtils.TruncateAt.END;
293 kind = TextUtils.TruncateAt.MIDDLE;
297 String out1 = TextUtils.ellipsize(s1, p, i, kind).toString();
298 String out2 = TextUtils.ellipsize(s2, p, i, kind).toString();
299 String out3 = TextUtils.ellipsize(s3, p, i, kind).toString();
301 String keep1 = TextUtils.ellipsize(s1, p, i, kind, true, null).toString();
302 String keep2 = TextUtils.ellipsize(s2, p, i, kind, true, null).toString();
303 String keep3 = TextUtils.ellipsize(s3, p, i, kind, true, null).toString();
332 assertFalse(TextUtils.delimitedStringContains("", ',', null));
333 assertFalse(TextUtils.delimitedStringContains(null, ',', ""));
335 assertTrue(TextUtils.delimitedStringContains("gps", ',', "gps"));
337 assertTrue(TextUtils.delimitedStringContains("gps,gpsx,network,mock", ',', "gps"));
338 assertTrue(TextUtils.delimitedStringContains("gps,network,mock", ',', "gps"));
340 assertTrue(TextUtils.delimitedStringContains("network,gps,mock", ',', "gps"));
341 assertTrue(TextUtils.delimitedStringContains("network,gps,gpsx,mock", ',', "gps"));
342 assertTrue(TextUtils.delimitedStringContains("network,gpsx,gps,mock", ',', "gps"));
344 assertTrue(TextUtils.delimitedStringContains("network,mock,gps", ',', "gps"));
345 assertTrue(TextUtils.delimitedStringContains("network,mock,gpsx,gps", ',', "gps"));
347 assertFalse(TextUtils.delimitedStringContains("network,mock,gpsx", ',', "gps"));
353 TextUtils.writeToParcel(null, p, 0);
354 CharSequence text = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(p);
357 TextUtils.writeToParcel("test", p, 0);
359 text = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(p);
368 TextUtils.writeToParcel(null, p, 0);
370 text = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(p);
379 TextUtils.writeToParcel(new SpannableString("test"), p, 0);
381 text = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(p);
390 TextUtils.writeToParcel("test", p, 0);
392 text = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(p);
480 Object[] nonEmpty = TextUtils.removeEmptySpans(allSpans.toArray(), this, Object.class);
527 assertEquals(View.LAYOUT_DIRECTION_LTR, TextUtils.getLayoutDirectionFromLocale(null));
529 TextUtils.getLayoutDirectionFromLocale(Locale.ROOT));
531 TextUtils.getLayoutDirectionFromLocale(Locale.forLanguageTag("en")));
533 TextUtils.getLayoutDirectionFromLocale(Locale.forLanguageTag("en-US")));
535 TextUtils.getLayoutDirectionFromLocale(Locale.forLanguageTag("az")));
537 TextUtils.getLayoutDirectionFromLocale(Locale.forLanguageTag("az-AZ")));
539 TextUtils.getLayoutDirectionFromLocale(Locale.forLanguageTag("az-Latn")));
541 TextUtils.getLayoutDirectionFromLocale(Locale.forLanguageTag("en-EG")));
543 TextUtils.getLayoutDirectionFromLocale(Locale.forLanguageTag("ar-Latn")));
546 TextUtils.getLayoutDirectionFromLocale(Locale.forLanguageTag("ar")));
548 TextUtils.getLayoutDirectionFromLocale(Locale.forLanguageTag("fa")));
550 TextUtils.getLayoutDirectionFromLocale(Locale.forLanguageTag("he")));
552 TextUtils.getLayoutDirectionFromLocale(Locale.forLanguageTag("iw")));
554 TextUtils.getLayoutDirectionFromLocale(Locale.forLanguageTag("ur")));
556 TextUtils.getLayoutDirectionFromLocale(Locale.forLanguageTag("dv")));
558 TextUtils.getLayoutDirectionFromLocale(Locale.forLanguageTag("az-Arab")));
560 TextUtils.getLayoutDirectionFromLocale(Locale.forLanguageTag("az-IR")));
562 TextUtils.getLayoutDirectionFromLocale(Locale.forLanguageTag("fa-US")));
564 TextUtils.getLayoutDirectionFromLocale(Locale.forLanguageTag("tr-Arab")));