am dfee3ff2: Fix a crash when you scroll MessageList to junk @ bottom

Merge commit 'dfee3ff278c4f5d9f7b8273c0e6ecab42585213e' into eclair-mr2

* commit 'dfee3ff278c4f5d9f7b8273c0e6ecab42585213e':
  Fix a crash when you scroll MessageList to junk @ bottom
This commit is contained in:
Andrew Stadler 2009-10-07 16:52:05 -07:00 committed by Android Git Automerger
commit 3bacb738c8
2 changed files with 33 additions and 4 deletions

View File

@ -120,6 +120,6 @@
<!-- TYPE_TRASH = 6 --> <!-- TYPE_TRASH = 6 -->
<item>@drawable/ic_list_trash</item> <item>@drawable/ic_list_trash</item>
<!-- TYPE_JUNK = 7 --> <!-- TYPE_JUNK = 7 -->
<item></item> <item>@drawable/ic_list_spam</item>
</array> </array>
</resources> </resources>

View File

@ -17,14 +17,14 @@
package com.android.email; package com.android.email;
import com.android.email.provider.EmailContent.Mailbox; import com.android.email.provider.EmailContent.Mailbox;
import com.android.email.R;
import com.android.email.Utility;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest; import android.test.suitebuilder.annotation.SmallTest;
import junit.framework.TestCase; import java.util.HashSet;
import java.util.Set;
/** /**
* This is a series of unit tests for the Utility class. These tests must be locally * This is a series of unit tests for the Utility class. These tests must be locally
@ -83,4 +83,33 @@ public class UtilityUnitTests extends AndroidTestCase {
name = Utility.FolderProperties.getInstance(context).getDisplayName(8); name = Utility.FolderProperties.getInstance(context).getDisplayName(8);
assertEquals(expect, name); assertEquals(expect, name);
} }
/**
* Confirm that all of the special icons are available and unique
*/
public void testSpecialIcons() {
Utility.FolderProperties fp = Utility.FolderProperties.getInstance(mContext);
// Make sure they're available
Drawable inbox = fp.getIconIds(Mailbox.TYPE_INBOX);
Drawable mail = fp.getIconIds(Mailbox.TYPE_MAIL);
Drawable parent = fp.getIconIds(Mailbox.TYPE_PARENT);
Drawable drafts = fp.getIconIds(Mailbox.TYPE_DRAFTS);
Drawable outbox = fp.getIconIds(Mailbox.TYPE_OUTBOX);
Drawable sent = fp.getIconIds(Mailbox.TYPE_SENT);
Drawable trash = fp.getIconIds(Mailbox.TYPE_TRASH);
Drawable junk = fp.getIconIds(Mailbox.TYPE_JUNK);
// Make sure they're unique
Set<Drawable> set = new HashSet<Drawable>();
set.add(inbox);
set.add(mail);
set.add(parent);
set.add(drafts);
set.add(outbox);
set.add(sent);
set.add(trash);
set.add(junk);
assertEquals(8, set.size());
}
} }