use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.
the class StateMachineTest method testStateMachineQuitNow.
@SmallTest
public void testStateMachineQuitNow() throws Exception {
if (WAIT_FOR_DEBUGGER)
Debug.waitForDebugger();
StateMachineQuitNowTest smQuitNowTest = new StateMachineQuitNowTest("smQuitNowTest");
smQuitNowTest.start();
if (smQuitNowTest.isDbg())
tlog("testStateMachineQuitNow E");
synchronized (smQuitNowTest) {
// we send 6 only one will be processed.
for (int i = 1; i <= 6; i++) {
smQuitNowTest.sendMessage(smQuitNowTest.obtainMessage(i));
}
try {
// wait for the messages to be handled
smQuitNowTest.wait();
} catch (InterruptedException e) {
tloge("testStateMachineQuitNow: exception while waiting " + e.getMessage());
}
}
tlog("testStateMachineQuiteNow: logRecs=" + smQuitNowTest.mLogRecs);
assertEquals(3, smQuitNowTest.mLogRecs.size());
Iterator<LogRec> itr = smQuitNowTest.mLogRecs.iterator();
LogRec lr = itr.next();
assertEquals(1, lr.getWhat());
assertEquals(smQuitNowTest.mS1, lr.getState());
assertEquals(smQuitNowTest.mS1, lr.getOriginalState());
lr = itr.next();
assertEquals(EXIT, lr.getInfo());
assertEquals(smQuitNowTest.mS1, lr.getState());
lr = itr.next();
assertEquals(ON_QUITTING, lr.getInfo());
if (smQuitNowTest.isDbg())
tlog("testStateMachineQuitNow X");
}
use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.
the class ColorStateListTest method testStateIsInList.
@SmallTest
public void testStateIsInList() throws Exception {
ColorStateList colorStateList = mResources.getColorStateList(R.color.color1);
int[] focusedState = { android.R.attr.state_focused };
int focusColor = colorStateList.getColorForState(focusedState, R.color.failColor);
assertEquals(mResources.getColor(R.color.testcolor1), focusColor);
}
use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.
the class ColorStateListTest method testEmptyState.
@SmallTest
public void testEmptyState() throws Exception {
ColorStateList colorStateList = mResources.getColorStateList(R.color.color1);
int[] emptyState = {};
int defaultColor = colorStateList.getColorForState(emptyState, mFailureColor);
assertEquals(mResources.getColor(R.color.testcolor2), defaultColor);
}
use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.
the class MediaPlayerMetadataParserTest method testGetDate.
// getDate
@SmallTest
public void testGetDate() throws Exception {
writeDateRecord(Metadata.DATE, 0, "PST");
adjustSize();
assertParse();
assertEquals(new Date(0), mMetadata.getDate(Metadata.DATE));
}
use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ResurrectionRemix.
the class DatabaseLocaleTest method testHoge.
@SmallTest
public void testHoge() throws Exception {
Cursor cursor = null;
try {
String expectedString = new String(new int[] { 0xFE000 }, 0, 1);
mDatabase.execSQL("INSERT INTO test(id, data) VALUES(1, '" + expectedString + "')");
cursor = mDatabase.rawQuery("SELECT data FROM test WHERE id = 1", null);
assertNotNull(cursor);
assertTrue(cursor.moveToFirst());
String actualString = cursor.getString(0);
assertEquals(expectedString.length(), actualString.length());
for (int i = 0; i < expectedString.length(); i++) {
assertEquals((int) expectedString.charAt(i), (int) actualString.charAt(i));
}
assertEquals(expectedString, actualString);
} finally {
if (cursor != null)
cursor.close();
}
}
Aggregations