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);
}
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();
}
}
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()));
}
}
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");
}
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
}
}
Aggregations