FileDocCategorySizeDatePackage
WeekNumberTest.javaAPI DocAndroid 1.5 API10109Wed May 06 22:42:42 BST 2009com.android.calendar

WeekNumberTest

public class WeekNumberTest extends android.test.AndroidTestCase
Unit tests for {@link android.text.format.Time#getWeekNumber}.

Fields Summary
DateAndWeekNumber[]
tests
Constructors Summary
Methods Summary
protected voidsetUp()


    
         
        super.setUp();
    
public voidtestAll()

        int len = tests.length;
        for (int index = 0; index < len; index++) {
            DateAndWeekNumber test = tests[index];
            int weekNumber = test.date.getWeekNumber();
            if (weekNumber != test.expectedWeekNumber) {
                long millis = test.date.toMillis(false /* use isDst */);
                int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NUMERIC_DATE;
                String output = DateUtils.formatDateTime(mContext, millis, flags);
                Log.i("WeekNumberTest", "index " + index
                        + " date: " + output
                        + " expected: " + test.expectedWeekNumber
                        + " actual: " + weekNumber);
            }
            assertEquals(weekNumber, test.expectedWeekNumber);

            weekNumber = test.allDayDate.getWeekNumber();
            if (weekNumber != test.expectedWeekNumber) {
                long millis = test.date.toMillis(false /* use isDst */);
                int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NUMERIC_DATE;
                String output = DateUtils.formatDateTime(mContext, millis, flags);
                Log.i("WeekNumberTest", "(all-day) index " + index
                        + " date: " + output
                        + " expected: " + test.expectedWeekNumber
                        + " actual: " + weekNumber);
            }
            assertEquals(weekNumber, test.expectedWeekNumber);
        }