Search in sources :

Example 6 with StyledString

use of com.android.aapt.Resources.StyledString in project bundletool by google.

the class XmlProtoPrintUtilsTest method processStyledString_emptyString.

@Test
public void processStyledString_emptyString() {
    StyledString styledString = StyledString.newBuilder().setValue("").build();
    String processedString = XmlProtoPrintUtils.processStyledString(styledString);
    assertThat(processedString).isEmpty();
}
Also used : StyledString(com.android.aapt.Resources.StyledString) StyledString(com.android.aapt.Resources.StyledString) Test(org.junit.Test)

Example 7 with StyledString

use of com.android.aapt.Resources.StyledString in project bundletool by google.

the class XmlProtoPrintUtilsTest method processStyledString_multipleTagsAtSamePosition.

@Test
public void processStyledString_multipleTagsAtSamePosition() {
    StyledString styledString = StyledString.newBuilder().setValue("hello").addSpan(Span.newBuilder().setTag("a").setFirstChar(0).setLastChar(4)).addSpan(Span.newBuilder().setTag("c").setFirstChar(0).setLastChar(4)).addSpan(Span.newBuilder().setTag("b").setFirstChar(0).setLastChar(4)).build();
    String processedString = XmlProtoPrintUtils.processStyledString(styledString);
    assertThat(processedString).isEqualTo("<a><b><c>hello</c></b></a>");
}
Also used : StyledString(com.android.aapt.Resources.StyledString) StyledString(com.android.aapt.Resources.StyledString) Test(org.junit.Test)

Example 8 with StyledString

use of com.android.aapt.Resources.StyledString in project bundletool by google.

the class XmlProtoPrintUtilsTest method processStyledString_startAndEnd.

@Test
public void processStyledString_startAndEnd() {
    StyledString styledString = StyledString.newBuilder().setValue("hello").addSpan(Span.newBuilder().setTag("a").setFirstChar(0).setLastChar(4)).build();
    String processedString = XmlProtoPrintUtils.processStyledString(styledString);
    assertThat(processedString).isEqualTo("<a>hello</a>");
}
Also used : StyledString(com.android.aapt.Resources.StyledString) StyledString(com.android.aapt.Resources.StyledString) Test(org.junit.Test)

Example 9 with StyledString

use of com.android.aapt.Resources.StyledString in project bundletool by google.

the class XmlProtoPrintUtilsTest method processStyledString_withAttributeValueContainingEqualSign.

@Test
public void processStyledString_withAttributeValueContainingEqualSign() {
    StyledString styledString = StyledString.newBuilder().setValue("hello").addSpan(Span.newBuilder().setTag("a;href=https://support.google.com?topic=123").setFirstChar(0).setLastChar(4)).build();
    String processedString = XmlProtoPrintUtils.processStyledString(styledString);
    assertThat(processedString).isEqualTo("<a href=\"https://support.google.com?topic=123\">hello</a>");
}
Also used : StyledString(com.android.aapt.Resources.StyledString) StyledString(com.android.aapt.Resources.StyledString) Test(org.junit.Test)

Aggregations

StyledString (com.android.aapt.Resources.StyledString)9 Test (org.junit.Test)9