Adding more test to MessageOrderManager

Added a case where all the message in the message list is removed.

Change-Id: Iedc2dbdf391978bd67d3bcdc260590d98cc9ef7d
This commit is contained in:
Makoto Onuki 2010-07-14 17:51:28 -07:00
parent d73d8e4839
commit 638c67f4db

View File

@ -16,7 +16,6 @@
package com.android.email.activity;
import com.android.email.Email;
import com.android.email.provider.EmailContent;
import com.android.email.provider.EmailProvider;
@ -216,9 +215,19 @@ public class MessageOrderManagerTest extends ProviderTestCase2<EmailProvider> {
assertEquals(22, mom.getCurrentMessageId());
assertCanMove(mom, false, false); // Can't move either way
// Now the current message is gone... messageNotFound gets called.
mom.updateMessageList(11, 33, 44);
// Delete 22 -- no messages left.
mom.updateMessageList();
mCallback.assertCallbacksCalled(false, true);
// Test for the case where list is not empty, but the current message is gone.
// First, set up a list with 22 as the current message.
mom.updateMessageList(11, 22, 33, 44);
mom.moveTo(22);
assertEquals(22, mom.getCurrentMessageId());
mCallback.assertCallbacksCalled(true, false);
// Then remove the current message.
mom.updateMessageList(11, 33, 44);
mCallback.assertCallbacksCalled(false, true);
}