Lines Matching refs:TextUtils
35 * TextUtilsTest tests {@link TextUtils}.
41 assertEquals("", TextUtils.concat());
42 assertEquals("foo", TextUtils.concat("foo"));
43 assertEquals("foobar", TextUtils.concat("foo", "bar"));
44 assertEquals("foobarbaz", TextUtils.concat("foo", "bar", "baz"));
55 assertEquals("foo", TextUtils.concat(foo).toString());
56 assertEquals("foobar", TextUtils.concat(foo, bar).toString());
57 assertEquals("foobarbaz", TextUtils.concat(foo, bar, baz).toString());
59 assertEquals(1, ((Spanned) TextUtils.concat(foo)).getSpanStart("foo"));
61 assertEquals(1, ((Spanned) TextUtils.concat(foo, bar)).getSpanStart("foo"));
62 assertEquals(4, ((Spanned) TextUtils.concat(foo, bar)).getSpanStart("bar"));
64 assertEquals(1, ((Spanned) TextUtils.concat(foo, bar, baz)).getSpanStart("foo"));
65 assertEquals(4, ((Spanned) TextUtils.concat(foo, bar, baz)).getSpanStart("bar"));
66 assertEquals(7, ((Spanned) TextUtils.concat(foo, bar, baz)).getSpanStart("baz"));
68 assertTrue(TextUtils.concat("foo", "bar") instanceof String);
69 assertTrue(TextUtils.concat(foo, bar) instanceof SpannedString);
76 result = TextUtils.expandTemplate("This is a ^1 of the ^2 broadcast ^3.",
81 result = TextUtils.expandTemplate("^^^1^^^2^3^a^1^^b^^^c",
86 result = TextUtils.expandTemplate("^");
89 result = TextUtils.expandTemplate("^^");
92 result = TextUtils.expandTemplate("^^^");
95 result = TextUtils.expandTemplate("shorter ^1 values ^2.", "a", "");
99 TextUtils.expandTemplate("Only ^1 value given, but ^2 used.", "foo");
105 TextUtils.expandTemplate("^1 value given, and ^0 used.", "foo");
110 result = TextUtils.expandTemplate("^1 value given, and ^9 used.",
116 TextUtils.expandTemplate("^1 value given, and ^10 used.",
125 result = TextUtils.expandTemplate("^2", "foo", "^^");
128 result = TextUtils.expandTemplate("^^2", "foo", "1");
131 result = TextUtils.expandTemplate("^1", "value with ^2 in it", "foo");
162 result = (Spanned) TextUtils.expandTemplate(template, "foo");
176 result = (Spanned) TextUtils.expandTemplate(template, "");
214 TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(',');
229 assertEquals(s.trim().length(), TextUtils.getTrimmedLength(s));
279 TextUtils.TruncateAt kind = null;
283 kind = TextUtils.TruncateAt.START;
287 kind = TextUtils.TruncateAt.END;
291 kind = TextUtils.TruncateAt.MIDDLE;
295 String out1 = TextUtils.ellipsize(s1, p, i, kind).toString();
296 String out2 = TextUtils.ellipsize(s2, p, i, kind).toString();
297 String out3 = TextUtils.ellipsize(s3, p, i, kind).toString();
299 String keep1 = TextUtils.ellipsize(s1, p, i, kind, true, null).toString();
300 String keep2 = TextUtils.ellipsize(s2, p, i, kind, true, null).toString();
301 String keep3 = TextUtils.ellipsize(s3, p, i, kind, true, null).toString();
330 assertFalse(TextUtils.delimitedStringContains("", ',', null));
331 assertFalse(TextUtils.delimitedStringContains(null, ',', ""));
333 assertTrue(TextUtils.delimitedStringContains("gps", ',', "gps"));
335 assertTrue(TextUtils.delimitedStringContains("gps,gpsx,network,mock", ',', "gps"));
336 assertTrue(TextUtils.delimitedStringContains("gps,network,mock", ',', "gps"));
338 assertTrue(TextUtils.delimitedStringContains("network,gps,mock", ',', "gps"));
339 assertTrue(TextUtils.delimitedStringContains("network,gps,gpsx,mock", ',', "gps"));
340 assertTrue(TextUtils.delimitedStringContains("network,gpsx,gps,mock", ',', "gps"));
342 assertTrue(TextUtils.delimitedStringContains("network,mock,gps", ',', "gps"));
343 assertTrue(TextUtils.delimitedStringContains("network,mock,gpsx,gps", ',', "gps"));
345 assertFalse(TextUtils.delimitedStringContains("network,mock,gpsx", ',', "gps"));
351 TextUtils.writeToParcel(null, p, 0);
352 CharSequence text = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(p);
355 TextUtils.writeToParcel("test", p, 0);
356 text = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(p);
365 TextUtils.writeToParcel(null, p, 0);
367 text = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(p);
376 TextUtils.writeToParcel(new SpannableString("test"), p, 0);
378 text = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(p);
387 TextUtils.writeToParcel("test", p, 0);
389 text = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(p);
477 Object[] nonEmpty = TextUtils.removeEmptySpans(allSpans.toArray(), this, Object.class);