mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Fixed unit tests
This commit is contained in:
parent
d3f9633378
commit
e66dd3d521
@ -8,6 +8,7 @@ import com.fsck.k9.activity.misc.SwipeGestureDetector.OnSwipeGestureListener;
|
|||||||
import com.fsck.k9.helper.StringUtils;
|
import com.fsck.k9.helper.StringUtils;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
@ -36,7 +37,7 @@ public class K9ActivityCommon {
|
|||||||
return new K9ActivityCommon(activity);
|
return new K9ActivityCommon(activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setLanguage(Activity activity, String language) {
|
public static void setLanguage(Context context, String language) {
|
||||||
Locale locale;
|
Locale locale;
|
||||||
if (StringUtils.isNullOrEmpty(language)) {
|
if (StringUtils.isNullOrEmpty(language)) {
|
||||||
locale = Locale.getDefault();
|
locale = Locale.getDefault();
|
||||||
@ -49,7 +50,7 @@ public class K9ActivityCommon {
|
|||||||
|
|
||||||
Configuration config = new Configuration();
|
Configuration config = new Configuration();
|
||||||
config.locale = locale;
|
config.locale = locale;
|
||||||
Resources resources = activity.getResources();
|
Resources resources = context.getResources();
|
||||||
resources.updateConfiguration(config, resources.getDisplayMetrics());
|
resources.updateConfiguration(config, resources.getDisplayMetrics());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.fsck.k9;
|
package com.fsck.k9;
|
||||||
|
|
||||||
import com.fsck.k9.activity.K9Activity;
|
import com.fsck.k9.activity.K9ActivityCommon;
|
||||||
import com.fsck.k9.helper.DateFormatter;
|
import com.fsck.k9.helper.DateFormatter;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -29,7 +29,7 @@ public class TranslationTest extends AndroidTestCase {
|
|||||||
String[] languages = res.getStringArray(R.array.supported_languages);
|
String[] languages = res.getStringArray(R.array.supported_languages);
|
||||||
|
|
||||||
for (String lang : languages) {
|
for (String lang : languages) {
|
||||||
K9Activity.setLanguage(mContext, lang);
|
K9ActivityCommon.setLanguage(mContext, lang);
|
||||||
|
|
||||||
action.runWithLanguage(mContext, lang);
|
action.runWithLanguage(mContext, lang);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import java.util.TimeZone;
|
|||||||
import android.test.AndroidTestCase;
|
import android.test.AndroidTestCase;
|
||||||
|
|
||||||
import com.fsck.k9.activity.K9Activity;
|
import com.fsck.k9.activity.K9Activity;
|
||||||
|
import com.fsck.k9.activity.K9ActivityCommon;
|
||||||
import com.fsck.k9.mail.Address;
|
import com.fsck.k9.mail.Address;
|
||||||
import com.fsck.k9.mail.MessagingException;
|
import com.fsck.k9.mail.MessagingException;
|
||||||
import com.fsck.k9.mail.Message.RecipientType;
|
import com.fsck.k9.mail.Message.RecipientType;
|
||||||
@ -109,7 +110,7 @@ public class ViewablesTest extends AndroidTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testTextPlusRfc822Message() throws MessagingException {
|
public void testTextPlusRfc822Message() throws MessagingException {
|
||||||
K9Activity.setLanguage(getContext(), "en");
|
K9ActivityCommon.setLanguage(getContext(), "en");
|
||||||
Locale.setDefault(Locale.US);
|
Locale.setDefault(Locale.US);
|
||||||
TimeZone.setDefault(TimeZone.getTimeZone("GMT+01:00"));
|
TimeZone.setDefault(TimeZone.getTimeZone("GMT+01:00"));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user