use of com.android.aapt.Resources.StyledString in project bundletool by google.
the class XmlProtoPrintUtilsTest method processStyledString_startAtSamePositionEndAtDifferentPosition.
@Test
public void processStyledString_startAtSamePositionEndAtDifferentPosition() {
StyledString styledString = StyledString.newBuilder().setValue("hello").addSpan(Span.newBuilder().setTag("a").setFirstChar(0).setLastChar(2)).addSpan(Span.newBuilder().setTag("b").setFirstChar(0).setLastChar(4)).build();
String processedString = XmlProtoPrintUtils.processStyledString(styledString);
assertThat(processedString).isEqualTo("<b><a>hel</a>lo</b>");
}
use of com.android.aapt.Resources.StyledString in project bundletool by google.
the class XmlProtoPrintUtilsTest method processStyledString_nestedTags.
@Test
public void processStyledString_nestedTags() {
StyledString styledString = StyledString.newBuilder().setValue("hello").addSpan(Span.newBuilder().setTag("a").setFirstChar(0).setLastChar(4)).addSpan(Span.newBuilder().setTag("b").setFirstChar(1).setLastChar(3)).addSpan(Span.newBuilder().setTag("c").setFirstChar(2).setLastChar(2)).build();
String processedString = XmlProtoPrintUtils.processStyledString(styledString);
assertThat(processedString).isEqualTo("<a>h<b>e<c>l</c>l</b>o</a>");
}
use of com.android.aapt.Resources.StyledString in project bundletool by google.
the class XmlProtoPrintUtilsTest method processStyledString_differentTagsStartAndEndAtSamePosition.
@Test
public void processStyledString_differentTagsStartAndEndAtSamePosition() {
StyledString styledString = StyledString.newBuilder().setValue("hello").addSpan(Span.newBuilder().setTag("a").setFirstChar(0).setLastChar(2)).addSpan(Span.newBuilder().setTag("b").setFirstChar(3).setLastChar(4)).build();
String processedString = XmlProtoPrintUtils.processStyledString(styledString);
assertThat(processedString).isEqualTo("<a>hel</a><b>lo</b>");
}
use of com.android.aapt.Resources.StyledString in project bundletool by google.
the class XmlProtoPrintUtilsTest method processStyledString_withAttributes.
@Test
public void processStyledString_withAttributes() {
StyledString styledString = StyledString.newBuilder().setValue("hello").addSpan(Span.newBuilder().setTag("a;attr1=value1;attr2=value2").setFirstChar(0).setLastChar(4)).build();
String processedString = XmlProtoPrintUtils.processStyledString(styledString);
assertThat(processedString).isEqualTo("<a attr1=\"value1\" attr2=\"value2\">hello</a>");
}
use of com.android.aapt.Resources.StyledString in project bundletool by google.
the class XmlProtoPrintUtilsTest method processStyledString_startAtDifferentPositionEndAtSamePosition.
@Test
public void processStyledString_startAtDifferentPositionEndAtSamePosition() {
StyledString styledString = StyledString.newBuilder().setValue("hello").addSpan(Span.newBuilder().setTag("a").setFirstChar(0).setLastChar(4)).addSpan(Span.newBuilder().setTag("b").setFirstChar(3).setLastChar(4)).build();
String processedString = XmlProtoPrintUtils.processStyledString(styledString);
assertThat(processedString).isEqualTo("<a>hel<b>lo</b></a>");
}
Aggregations