HtmlTestpublic class HtmlTest extends android.test.InstrumentationTestCase
Methods Summary |
---|
public void | testBadHtml()Tests that the parser can handle mal-formed HTML.
Spanned spanned = Html.fromHtml("Hello <b>b<i>bi</b>i</i>");
Object[] spans = spanned.getSpans(0, 100, Object.class);
assertEquals(Typeface.ITALIC, ((StyleSpan) spans[0]).getStyle());
assertEquals(7, spanned.getSpanStart(spans[0]));
assertEquals(9, spanned.getSpanEnd(spans[0]));
assertEquals(Typeface.BOLD, ((StyleSpan) spans[1]).getStyle());
assertEquals(6, spanned.getSpanStart(spans[1]));
assertEquals(9, spanned.getSpanEnd(spans[1]));
assertEquals(Typeface.ITALIC, ((StyleSpan) spans[2]).getStyle());
assertEquals(9, spanned.getSpanStart(spans[2]));
assertEquals(10, spanned.getSpanEnd(spans[2]));
| public void | testEmptyFontTag()
Spanned spanned = Html.fromHtml("Hello <font color=\"#ff00ff00\"></font>");
Object[] spans = spanned.getSpans(0, 100, Object.class);
// TODO: figure out what the spans should be after the crashes are fixed and assert them.
| public void | testSingleTagOnWhileString()
Spanned spanned = Html.fromHtml("<b>hello</b>");
Object[] spans = spanned.getSpans(-1, 100, Object.class);
assertEquals(1, spans.length);
Object span = spans[0];
assertEquals(0, spanned.getSpanStart(span));
assertEquals(5, spanned.getSpanEnd(span));
| public void | testSymbols()
String spanned = Html.fromHtml("© > <").toString();
assertEquals("\u00a9 > <", spanned);
|
|