Search in sources :

Example 11 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.

the class LinkPropertiesTest method testEqualsNull.

@SmallTest
public void testEqualsNull() {
    LinkProperties source = new LinkProperties();
    LinkProperties target = new LinkProperties();
    assertFalse(source == target);
    assertLinkPropertiesEqual(source, target);
}
Also used : LinkProperties(android.net.LinkProperties) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 12 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.

the class LinkPropertiesTest method testEqualsDuplicated.

@SmallTest
public void testEqualsDuplicated() {
    try {
        LinkProperties source = new LinkProperties();
        // set 3 link addresses, eg, [A, A, B]
        source.addLinkAddress(new LinkAddress(NetworkUtils.numericToInetAddress(ADDRV4), 32));
        source.addLinkAddress(new LinkAddress(NetworkUtils.numericToInetAddress(ADDRV4), 32));
        source.addLinkAddress(new LinkAddress(NetworkUtils.numericToInetAddress(ADDRV6), 128));
        LinkProperties target = new LinkProperties();
        // set 3 link addresses, eg, [A, B, B]
        target.addLinkAddress(new LinkAddress(NetworkUtils.numericToInetAddress(ADDRV4), 32));
        target.addLinkAddress(new LinkAddress(NetworkUtils.numericToInetAddress(ADDRV6), 128));
        target.addLinkAddress(new LinkAddress(NetworkUtils.numericToInetAddress(ADDRV6), 128));
        assertLinkPropertiesEqual(source, target);
    } catch (Exception e) {
        fail();
    }
}
Also used : LinkProperties(android.net.LinkProperties) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 13 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.

the class LinkPropertiesTest method testStackedInterfaces.

@SmallTest
public void testStackedInterfaces() {
    LinkProperties rmnet0 = new LinkProperties();
    rmnet0.setInterfaceName("rmnet0");
    LinkProperties clat4 = new LinkProperties();
    clat4.setInterfaceName("clat4");
    assertEquals(0, rmnet0.getStackedLinks().size());
    rmnet0.addStackedLink(clat4);
    assertEquals(1, rmnet0.getStackedLinks().size());
    rmnet0.addStackedLink(clat4);
    assertEquals(1, rmnet0.getStackedLinks().size());
    assertEquals(0, clat4.getStackedLinks().size());
    // Modify an item in the returned collection to see what happens.
    for (LinkProperties link : rmnet0.getStackedLinks()) {
        if (link.getInterfaceName().equals("clat4")) {
            link.setInterfaceName("newname");
        }
    }
    for (LinkProperties link : rmnet0.getStackedLinks()) {
        assertFalse("newname".equals(link.getInterfaceName()));
    }
}
Also used : LinkProperties(android.net.LinkProperties) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 14 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.

the class HtmlTest method testBlockquote.

@SmallTest
public void testBlockquote() throws Exception {
    SpannableString s;
    s = new SpannableString("Hello world");
    s.setSpan(new QuoteSpan(), 0, s.length(), Spannable.SPAN_PARAGRAPH);
    assertEquals(Html.toHtml(s), "<blockquote><p>Hello world</p>\n</blockquote>\n");
    s = new SpannableString("Hello\n\nworld");
    s.setSpan(new QuoteSpan(), 0, 7, Spannable.SPAN_PARAGRAPH);
    assertEquals(Html.toHtml(s), "<blockquote><p>Hello</p>\n</blockquote>\n<p>world</p>\n");
}
Also used : QuoteSpan(android.text.style.QuoteSpan) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 15 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.

the class TimeTest method testParse33390.

@SmallTest
public void testParse33390() throws Exception {
    Time t = new Time(Time.TIMEZONE_UTC);
    t.parse3339("1980-05-23");
    if (!t.allDay || t.year != 1980 || t.month != 04 || t.monthDay != 23) {
        fail("Did not parse all-day date correctly");
    }
    t.parse3339("1980-05-23T09:50:50");
    if (t.allDay || t.year != 1980 || t.month != 04 || t.monthDay != 23 || t.hour != 9 || t.minute != 50 || t.second != 50 || t.gmtoff != 0) {
        fail("Did not parse timezone-offset-less date correctly");
    }
    t.parse3339("1980-05-23T09:50:50Z");
    if (t.allDay || t.year != 1980 || t.month != 04 || t.monthDay != 23 || t.hour != 9 || t.minute != 50 || t.second != 50 || t.gmtoff != 0) {
        fail("Did not parse UTC date correctly");
    }
    t.parse3339("1980-05-23T09:50:50.0Z");
    if (t.allDay || t.year != 1980 || t.month != 04 || t.monthDay != 23 || t.hour != 9 || t.minute != 50 || t.second != 50 || t.gmtoff != 0) {
        fail("Did not parse UTC date correctly");
    }
    t.parse3339("1980-05-23T09:50:50.12Z");
    if (t.allDay || t.year != 1980 || t.month != 04 || t.monthDay != 23 || t.hour != 9 || t.minute != 50 || t.second != 50 || t.gmtoff != 0) {
        fail("Did not parse UTC date correctly");
    }
    t.parse3339("1980-05-23T09:50:50.123Z");
    if (t.allDay || t.year != 1980 || t.month != 04 || t.monthDay != 23 || t.hour != 9 || t.minute != 50 || t.second != 50 || t.gmtoff != 0) {
        fail("Did not parse UTC date correctly");
    }
    // The time should be normalized to UTC
    t.parse3339("1980-05-23T09:50:50-01:05");
    if (t.allDay || t.year != 1980 || t.month != 04 || t.monthDay != 23 || t.hour != 10 || t.minute != 55 || t.second != 50 || t.gmtoff != 0) {
        fail("Did not parse timezone-offset date correctly");
    }
    // The time should be normalized to UTC
    t.parse3339("1980-05-23T09:50:50.123-01:05");
    if (t.allDay || t.year != 1980 || t.month != 04 || t.monthDay != 23 || t.hour != 10 || t.minute != 55 || t.second != 50 || t.gmtoff != 0) {
        fail("Did not parse timezone-offset date correctly");
    }
    try {
        t.parse3339("1980");
        fail("Did not throw error on truncated input length");
    } catch (TimeFormatException e) {
    // Successful
    }
    try {
        t.parse3339("1980-05-23T09:50:50.123+");
        fail("Did not throw error on truncated timezone offset");
    } catch (TimeFormatException e1) {
    // Successful
    }
    try {
        t.parse3339("1980-05-23T09:50:50.123+05:0");
        fail("Did not throw error on truncated timezone offset");
    } catch (TimeFormatException e1) {
    // Successful
    }
}
Also used : Time(android.text.format.Time) TimeFormatException(android.util.TimeFormatException) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

SmallTest (android.test.suitebuilder.annotation.SmallTest)1764 Parcel (android.os.Parcel)143 Time (android.text.format.Time)97 Rect (android.graphics.Rect)94 ByteBuffer (java.nio.ByteBuffer)71 Bundle (android.os.Bundle)68 LinkProperties (android.net.LinkProperties)66 ArrayList (java.util.ArrayList)63 SpannableString (android.text.SpannableString)60 DhcpPacket (android.net.dhcp.DhcpPacket)52 Rational (android.util.Rational)50 File (java.io.File)47 RouteInfo (android.net.RouteInfo)45 NetworkRequest (android.net.NetworkRequest)44 ParcelUuid (android.os.ParcelUuid)43 MenuItem (android.view.MenuItem)42 BitwiseInputStream (com.android.internal.util.BitwiseInputStream)42 BitwiseOutputStream (com.android.internal.util.BitwiseOutputStream)42 CaptureRequest (android.hardware.camera2.CaptureRequest)40 IpPrefix (android.net.IpPrefix)40