Allow theme to be fixed during tests

This commit is contained in:
2016-04-30 19:13:36 -04:00
parent dbca3238f6
commit 677a643e5b
4 changed files with 29 additions and 16 deletions

View File

@@ -25,6 +25,7 @@ import android.os.Looper;
import android.support.test.InstrumentationRegistry;
import org.isoron.uhabits.helpers.DateHelper;
import org.isoron.uhabits.helpers.UIHelper;
import org.isoron.uhabits.tasks.BaseTask;
import org.junit.Before;
@@ -48,10 +49,9 @@ public class BaseTest
}
targetContext = InstrumentationRegistry.getTargetContext();
targetContext.setTheme(R.style.AppBaseTheme);
testContext = InstrumentationRegistry.getContext();
UIHelper.setFixedTheme(R.style.AppBaseTheme);
DateHelper.setFixedLocalTime(FIXED_LOCAL_TIME);
}

View File

@@ -22,7 +22,9 @@ package org.isoron.uhabits.unit.views;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.SmallTest;
import org.isoron.uhabits.R;
import org.isoron.uhabits.helpers.DateHelper;
import org.isoron.uhabits.helpers.UIHelper;
import org.isoron.uhabits.models.Habit;
import org.isoron.uhabits.unit.HabitFixtures;
import org.isoron.uhabits.views.CheckmarkWidgetView;
@@ -43,6 +45,7 @@ public class CheckmarkWidgetViewTest extends ViewTest
public void setup()
{
super.setup();
UIHelper.setFixedTheme(R.style.TransparentWidgetTheme);
habit = HabitFixtures.createShortHabit();
view = new CheckmarkWidgetView(targetContext);