From e66dd3d5215ab9be540f0290f58608d09f7dfa64 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 8 Oct 2012 14:43:34 +0200 Subject: [PATCH] Fixed unit tests --- src/com/fsck/k9/activity/K9ActivityCommon.java | 5 +++-- tests/src/com/fsck/k9/TranslationTest.java | 4 ++-- tests/src/com/fsck/k9/mail/internet/ViewablesTest.java | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/com/fsck/k9/activity/K9ActivityCommon.java b/src/com/fsck/k9/activity/K9ActivityCommon.java index 2dd65e9b7..251ef02b7 100644 --- a/src/com/fsck/k9/activity/K9ActivityCommon.java +++ b/src/com/fsck/k9/activity/K9ActivityCommon.java @@ -8,6 +8,7 @@ import com.fsck.k9.activity.misc.SwipeGestureDetector.OnSwipeGestureListener; import com.fsck.k9.helper.StringUtils; import android.app.Activity; +import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; @@ -36,7 +37,7 @@ public class K9ActivityCommon { return new K9ActivityCommon(activity); } - public static void setLanguage(Activity activity, String language) { + public static void setLanguage(Context context, String language) { Locale locale; if (StringUtils.isNullOrEmpty(language)) { locale = Locale.getDefault(); @@ -49,7 +50,7 @@ public class K9ActivityCommon { Configuration config = new Configuration(); config.locale = locale; - Resources resources = activity.getResources(); + Resources resources = context.getResources(); resources.updateConfiguration(config, resources.getDisplayMetrics()); } diff --git a/tests/src/com/fsck/k9/TranslationTest.java b/tests/src/com/fsck/k9/TranslationTest.java index 2cd39ed26..2bcf51d4f 100644 --- a/tests/src/com/fsck/k9/TranslationTest.java +++ b/tests/src/com/fsck/k9/TranslationTest.java @@ -1,6 +1,6 @@ package com.fsck.k9; -import com.fsck.k9.activity.K9Activity; +import com.fsck.k9.activity.K9ActivityCommon; import com.fsck.k9.helper.DateFormatter; import android.content.Context; @@ -29,7 +29,7 @@ public class TranslationTest extends AndroidTestCase { String[] languages = res.getStringArray(R.array.supported_languages); for (String lang : languages) { - K9Activity.setLanguage(mContext, lang); + K9ActivityCommon.setLanguage(mContext, lang); action.runWithLanguage(mContext, lang); } diff --git a/tests/src/com/fsck/k9/mail/internet/ViewablesTest.java b/tests/src/com/fsck/k9/mail/internet/ViewablesTest.java index e25ceca1d..4aae4531f 100644 --- a/tests/src/com/fsck/k9/mail/internet/ViewablesTest.java +++ b/tests/src/com/fsck/k9/mail/internet/ViewablesTest.java @@ -6,6 +6,7 @@ import java.util.TimeZone; import android.test.AndroidTestCase; import com.fsck.k9.activity.K9Activity; +import com.fsck.k9.activity.K9ActivityCommon; import com.fsck.k9.mail.Address; import com.fsck.k9.mail.MessagingException; import com.fsck.k9.mail.Message.RecipientType; @@ -109,7 +110,7 @@ public class ViewablesTest extends AndroidTestCase { } public void testTextPlusRfc822Message() throws MessagingException { - K9Activity.setLanguage(getContext(), "en"); + K9ActivityCommon.setLanguage(getContext(), "en"); Locale.setDefault(Locale.US); TimeZone.setDefault(TimeZone.getTimeZone("GMT+01:00"));