From dfee3ff278c4f5d9f7b8273c0e6ecab42585213e Mon Sep 17 00:00:00 2001 From: Andrew Stadler Date: Wed, 7 Oct 2009 16:30:41 -0700 Subject: [PATCH] Fix a crash when you scroll MessageList to junk @ bottom * Add missing reference to spam/junk folder icon * Unit tests for Utility.FolderProperties.getIconIds() Fixes http://b/issue?id=2173907 --- res/values/arrays.xml | 2 +- .../com/android/email/UtilityUnitTests.java | 35 +++++++++++++++++-- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/res/values/arrays.xml b/res/values/arrays.xml index a10d720be..a3764cbb9 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -120,6 +120,6 @@ @drawable/ic_list_trash - + @drawable/ic_list_spam diff --git a/tests/src/com/android/email/UtilityUnitTests.java b/tests/src/com/android/email/UtilityUnitTests.java index 63b30dd51..7b75c911d 100644 --- a/tests/src/com/android/email/UtilityUnitTests.java +++ b/tests/src/com/android/email/UtilityUnitTests.java @@ -17,14 +17,14 @@ package com.android.email; import com.android.email.provider.EmailContent.Mailbox; -import com.android.email.R; -import com.android.email.Utility; import android.content.Context; +import android.graphics.drawable.Drawable; import android.test.AndroidTestCase; 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 @@ -83,4 +83,33 @@ public class UtilityUnitTests extends AndroidTestCase { name = Utility.FolderProperties.getInstance(context).getDisplayName(8); 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 set = new HashSet(); + 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()); + } }