Search in sources :

Example 6 with Smoke

use of android.test.suitebuilder.annotation.Smoke in project Etar-Calendar by Etar-Group.

the class EditEventHelperTest method testGetAddressesFromList.

@Smoke
@SmallTest
public void testGetAddressesFromList() {
    mActivity = buildTestContext();
    mHelper = new EditEventHelper(mActivity, null);
    LinkedHashSet<Rfc822Token> expected = new LinkedHashSet<Rfc822Token>();
    expected.add(new Rfc822Token(null, "ad1@email.com", ""));
    expected.add(new Rfc822Token("First Last", "first@email.com", "comment"));
    expected.add(new Rfc822Token(null, "one.two.three@email.grue", ""));
    LinkedHashSet<Rfc822Token> actual = mHelper.getAddressesFromList(TEST_ADDRESSES, new Rfc822Validator(null));
    assertEquals(expected, actual);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Rfc822Validator(com.android.common.Rfc822Validator) Rfc822Token(android.text.util.Rfc822Token) SmallTest(android.test.suitebuilder.annotation.SmallTest) Smoke(android.test.suitebuilder.annotation.Smoke)

Example 7 with Smoke

use of android.test.suitebuilder.annotation.Smoke in project Etar-Calendar by Etar-Group.

the class EditEventHelperTest method testIsFirstEventInSeries.

@Smoke
@SmallTest
public void testIsFirstEventInSeries() {
    mModel1 = new CalendarEventModel();
    mModel2 = new CalendarEventModel();
    // It's considered the first event if the original start of the new model matches the
    // start of the old model
    mModel1.mOriginalStart = 100;
    mModel1.mStart = 200;
    mModel2.mOriginalStart = 100;
    mModel2.mStart = 100;
    assertTrue(EditEventHelper.isFirstEventInSeries(mModel1, mModel2));
    mModel1.mOriginalStart = 80;
    assertFalse(EditEventHelper.isFirstEventInSeries(mModel1, mModel2));
}
Also used : CalendarEventModel(com.android.calendar.CalendarEventModel) SmallTest(android.test.suitebuilder.annotation.SmallTest) Smoke(android.test.suitebuilder.annotation.Smoke)

Example 8 with Smoke

use of android.test.suitebuilder.annotation.Smoke in project Etar-Calendar by Etar-Group.

the class EditEventHelperTest method testGetContentValuesFromModel.

@Smoke
@SmallTest
public void testGetContentValuesFromModel() {
    mActivity = buildTestContext();
    mHelper = new EditEventHelper(mActivity, null);
    mExpectedValues = buildTestValues();
    mModel1 = buildTestModel();
    ContentValues values = mHelper.getContentValuesFromModel(mModel1);
    assertEquals(mExpectedValues, values);
    mModel1.mRrule = null;
    mModel1.mEnd = TEST_END;
    mExpectedValues.put(Events.RRULE, (String) null);
    mExpectedValues.put(Events.DURATION, (String) null);
    // UTC time
    mExpectedValues.put(Events.DTEND, TEST_END);
    values = mHelper.getContentValuesFromModel(mModel1);
    assertEquals(mExpectedValues, values);
    mModel1.mAllDay = false;
    mExpectedValues.put(Events.ALL_DAY, 0);
    mExpectedValues.put(Events.DTSTART, TEST_START);
    mExpectedValues.put(Events.DTEND, TEST_END);
    // not an allday event so timezone isn't modified
    mExpectedValues.put(Events.EVENT_TIMEZONE, "UTC");
    values = mHelper.getContentValuesFromModel(mModel1);
    assertEquals(mExpectedValues, values);
}
Also used : ContentValues(android.content.ContentValues) SmallTest(android.test.suitebuilder.annotation.SmallTest) Smoke(android.test.suitebuilder.annotation.Smoke)

Example 9 with Smoke

use of android.test.suitebuilder.annotation.Smoke in project Etar-Calendar by Etar-Group.

the class AsyncQueryServiceTest method testQuery.

@Smoke
@SmallTest
public void testQuery() throws Exception {
    int index = 0;
    final OperationInfo[] work = new OperationInfo[1];
    work[index] = new OperationInfo();
    work[index].op = Operation.EVENT_ARG_QUERY;
    work[index].token = ++mId;
    work[index].cookie = ++mId;
    work[index].uri = Uri.parse(AUTHORITY_URI + "blah");
    work[index].projection = TEST_PROJECTION;
    work[index].selection = TEST_SELECTION;
    work[index].selectionArgs = TEST_SELECTION_ARGS;
    work[index].orderBy = "order";
    work[index].delayMillis = 0;
    work[index].result = new TestCursor();
    TestAsyncQueryService aqs = new TestAsyncQueryService(buildTestContext(work), work);
    aqs.startQuery(work[index].token, work[index].cookie, work[index].uri, work[index].projection, work[index].selection, work[index].selectionArgs, work[index].orderBy);
    Log.d(TAG, "testQuery Waiting >>>>>>>>>>>");
    assertEquals("Not all operations were executed.", work.length, aqs.waitForCompletion(BASE_TEST_WAIT_TIME));
    Log.d(TAG, "testQuery Done <<<<<<<<<<<<<<");
}
Also used : OperationInfo(com.android.calendar.AsyncQueryServiceHelper.OperationInfo) SmallTest(android.test.suitebuilder.annotation.SmallTest) Smoke(android.test.suitebuilder.annotation.Smoke)

Aggregations

SmallTest (android.test.suitebuilder.annotation.SmallTest)9 Smoke (android.test.suitebuilder.annotation.Smoke)9 CalendarEventModel (com.android.calendar.CalendarEventModel)5 ContentValues (android.content.ContentValues)3 ContentProviderOperation (android.content.ContentProviderOperation)1 MatrixCursor (android.database.MatrixCursor)1 Rfc822Token (android.text.util.Rfc822Token)1 OperationInfo (com.android.calendar.AsyncQueryServiceHelper.OperationInfo)1 Rfc822Validator (com.android.common.Rfc822Validator)1 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1