Update Robolectric to 3.4.2
Bug: 66693279
Test: m RunSettingsRoboTests
m RunSettingsRoboTests-jacoco
Change-Id: I9df619c3d68f0af2ee2ae944a15998275129f7c2
This commit is contained in:
@@ -31,6 +31,7 @@ import com.android.settings.testutils.shadow.SettingsShadowResources;
|
||||
import com.android.settings.widget.DonutView;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
@@ -48,9 +49,16 @@ public final class DataPlanSummaryPreferenceTest {
|
||||
private static final String TEST_PLAN_USAGE = "Test plan usage";
|
||||
private static final String TEST_PLAN_NAME = "Test plan name";
|
||||
private static final String TEST_PLAN_DESCRIPTION = "Test plan description";
|
||||
private static final int PLAN_USAGE_TEXT_COLOR = Color.parseColor("#FF5C94F1");
|
||||
private static final int METER_BACKGROUND_COLOR = Color.parseColor("#FFDBDCDC");
|
||||
private static final int METER_CONSUMED_COLOR = Color.parseColor("#FF5C94F1");
|
||||
private static int sPlanUsageTextColor;
|
||||
private static int sMeterBackgroundColor;
|
||||
private static int sMeterConsumedColor;
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
sPlanUsageTextColor = Color.parseColor("#FF5C94F1");
|
||||
sMeterBackgroundColor = Color.parseColor("#FFDBDCDC");
|
||||
sMeterConsumedColor = Color.parseColor("#FF5C94F1");
|
||||
}
|
||||
|
||||
private DataPlanSummaryPreference mPreference;
|
||||
private PreferenceViewHolder mHolder;
|
||||
@@ -87,18 +95,18 @@ public final class DataPlanSummaryPreferenceTest {
|
||||
@Test
|
||||
public void shouldRender_withData() {
|
||||
mPreference.setTitle(TEST_PLAN_USAGE);
|
||||
mPreference.setUsageTextColor(PLAN_USAGE_TEXT_COLOR);
|
||||
mPreference.setUsageTextColor(sPlanUsageTextColor);
|
||||
mPreference.setName(TEST_PLAN_NAME);
|
||||
mPreference.setDescription(TEST_PLAN_DESCRIPTION);
|
||||
mPreference.setPercentageUsage(0.25D);
|
||||
mPreference.setMeterBackgroundColor(METER_BACKGROUND_COLOR);
|
||||
mPreference.setMeterConsumedColor(METER_CONSUMED_COLOR);
|
||||
mPreference.setMeterBackgroundColor(sMeterBackgroundColor);
|
||||
mPreference.setMeterConsumedColor(sMeterConsumedColor);
|
||||
|
||||
mPreference.onBindViewHolder(mHolder);
|
||||
|
||||
TextView planUsageTextView = (TextView) mHolder.findViewById(android.R.id.title);
|
||||
assertThat(planUsageTextView.getTextColors().getDefaultColor())
|
||||
.isEqualTo(PLAN_USAGE_TEXT_COLOR);
|
||||
.isEqualTo(sPlanUsageTextColor);
|
||||
assertThat(planUsageTextView.getText()).isEqualTo(TEST_PLAN_USAGE);
|
||||
|
||||
TextView planNameTextView = (TextView) mHolder.findViewById(android.R.id.text1);
|
||||
@@ -108,7 +116,7 @@ public final class DataPlanSummaryPreferenceTest {
|
||||
assertThat(planDescriptionTextView.getText()).isEqualTo(TEST_PLAN_DESCRIPTION);
|
||||
|
||||
DonutView donutView = (DonutView) mHolder.findViewById(R.id.donut);
|
||||
assertThat(donutView.getMeterBackgroundColor()).isEqualTo(METER_BACKGROUND_COLOR);
|
||||
assertThat(donutView.getMeterConsumedColor()).isEqualTo(METER_CONSUMED_COLOR);
|
||||
assertThat(donutView.getMeterBackgroundColor()).isEqualTo(sMeterBackgroundColor);
|
||||
assertThat(donutView.getMeterConsumedColor()).isEqualTo(sMeterConsumedColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ import com.android.settings.R;
|
||||
import com.android.settings.TestConfig;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.testutils.XmlTestUtils;
|
||||
import com.android.settings.testutils.shadow.ShadowConnectivityManager;
|
||||
import com.android.settings.testutils.shadow.ShadowDataUsageUtils;
|
||||
import com.android.settingslib.NetworkPolicyEditor;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -31,17 +31,14 @@ import android.net.wifi.WifiManager;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.TestConfig;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.testutils.XmlTestUtils;
|
||||
import com.android.settings.testutils.shadow.ShadowConnectivityManager;
|
||||
import com.android.settingslib.NetworkPolicyEditor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.robolectric.shadows.ShadowApplication;
|
||||
import org.robolectric.util.ReflectionHelpers;
|
||||
|
||||
Reference in New Issue
Block a user