summaryrefslogtreecommitdiff
path: root/library/gingerbread/test/robotest/src/com/android/setupwizardlib
diff options
context:
space:
mode:
Diffstat (limited to 'library/gingerbread/test/robotest/src/com/android/setupwizardlib')
-rw-r--r--library/gingerbread/test/robotest/src/com/android/setupwizardlib/items/ExpandableSwitchItemTest.java247
-rw-r--r--library/gingerbread/test/robotest/src/com/android/setupwizardlib/items/SwitchItemTest.java312
-rw-r--r--library/gingerbread/test/robotest/src/com/android/setupwizardlib/util/DimensionConsistencyTest.java51
3 files changed, 312 insertions, 298 deletions
diff --git a/library/gingerbread/test/robotest/src/com/android/setupwizardlib/items/ExpandableSwitchItemTest.java b/library/gingerbread/test/robotest/src/com/android/setupwizardlib/items/ExpandableSwitchItemTest.java
index 6192061..c43b4ab 100644
--- a/library/gingerbread/test/robotest/src/com/android/setupwizardlib/items/ExpandableSwitchItemTest.java
+++ b/library/gingerbread/test/robotest/src/com/android/setupwizardlib/items/ExpandableSwitchItemTest.java
@@ -17,7 +17,6 @@
package com.android.setupwizardlib.items;
import static com.google.common.truth.Truth.assertThat;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -27,133 +26,139 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
-
import com.android.setupwizardlib.R;
-import com.android.setupwizardlib.robolectric.SuwLibRobolectricTestRunner;
import com.android.setupwizardlib.view.CheckableLinearLayout;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
-@RunWith(SuwLibRobolectricTestRunner.class)
-@Config(sdk = { Config.OLDEST_SDK, Config.NEWEST_SDK })
+@RunWith(RobolectricTestRunner.class)
+@Config(sdk = {Config.OLDEST_SDK, Config.NEWEST_SDK})
public class ExpandableSwitchItemTest {
- private TextView mSummaryView;
- private ExpandableSwitchItem mItem;
-
- @Before
- public void setUp() {
- mItem = new ExpandableSwitchItem();
- mItem.setTitle("TestTitle");
- mItem.setCollapsedSummary("TestSummary");
- mItem.setExpandedSummary("TestSummaryExpanded");
- }
-
- @Test
- public void testInitialState() {
- View view = createLayout();
- mItem.onBindView(view);
-
- assertEquals("Collapsed summary should be TestSummary",
- "TestSummary", mItem.getCollapsedSummary());
- assertEquals("Expanded summary should be TestSummaryExpanded",
- "TestSummaryExpanded", mItem.getExpandedSummary());
-
- assertEquals("Should be collapsed initially", "TestSummary", mItem.getSummary());
- assertEquals("Summary view should display collapsed summary",
- "TestSummary", mSummaryView.getText());
-
- assertFalse("Expandable switch item itself should not be focusable", view.isFocusable());
-
- View switchContent = view.findViewById(R.id.suw_items_expandable_switch_content);
- assertThat(switchContent).isInstanceOf(CheckableLinearLayout.class);
- assertThat(switchContent.isFocusable())
- .named("expandable content focusable")
- .isTrue();
- }
-
- @Test
- public void testExpanded() {
- View view = createLayout();
- mItem.onBindView(view);
-
- mItem.setExpanded(true);
-
- assertEquals("Collapsed summary should be TestSummary",
- "TestSummary", mItem.getCollapsedSummary());
- assertEquals("Expanded summary should be TestSummaryExpanded",
- "TestSummaryExpanded", mItem.getExpandedSummary());
-
- assertTrue("Should be expanded", mItem.isExpanded());
- assertEquals("getSummary should be expanded summary",
- "TestSummaryExpanded", mItem.getSummary());
- }
-
- @Test
- public void testCollapsed() {
- View view = createLayout();
- mItem.onBindView(view);
-
- mItem.setExpanded(true);
- assertTrue("Should be expanded", mItem.isExpanded());
-
- mItem.setExpanded(false);
-
- assertEquals("Collapsed summary should be TestSummary",
- "TestSummary", mItem.getCollapsedSummary());
- assertEquals("Expanded summary should be TestSummaryExpanded",
- "TestSummaryExpanded", mItem.getExpandedSummary());
-
- assertFalse("Should be expanded", mItem.isExpanded());
- assertEquals("getSummary should be collapsed summary",
- "TestSummary", mItem.getSummary());
- }
-
- @Test
- public void testClick() {
- View view = createLayout();
- mItem.onBindView(view);
-
- assertFalse("Should not be expanded initially", mItem.isExpanded());
-
- final View content = view.findViewById(R.id.suw_items_expandable_switch_content);
- content.performClick();
- assertTrue("Should be expanded after clicking", mItem.isExpanded());
-
- content.performClick();
- assertFalse("Should be collapsed again after clicking", mItem.isExpanded());
- }
-
- @Test
- public void testDrawableState() {
- final View view =
- LayoutInflater.from(application).inflate(mItem.getLayoutResource(), null);
- mItem.onBindView(view);
-
- final View titleView = view.findViewById(R.id.suw_items_title);
- assertThat(titleView.getDrawableState()).asList().named("Drawable state")
- .doesNotContain(android.R.attr.state_checked);
-
- mItem.setExpanded(true);
- mItem.onBindView(view);
- assertThat(titleView.getDrawableState()).asList().named("Drawable state")
- .contains(android.R.attr.state_checked);
-
- mItem.setExpanded(false);
- mItem.onBindView(view);
- assertThat(titleView.getDrawableState()).asList().named("Drawable state")
- .doesNotContain(android.R.attr.state_checked);
- }
-
- private ViewGroup createLayout() {
- ViewGroup root =
- (ViewGroup) LayoutInflater.from(application)
- .inflate(R.layout.suw_items_expandable_switch, null);
- mSummaryView = root.findViewById(R.id.suw_items_summary);
-
- return root;
- }
+ private TextView mSummaryView;
+ private ExpandableSwitchItem mItem;
+
+ @Before
+ public void setUp() {
+ mItem = new ExpandableSwitchItem();
+ mItem.setTitle("TestTitle");
+ mItem.setCollapsedSummary("TestSummary");
+ mItem.setExpandedSummary("TestSummaryExpanded");
+ }
+
+ @Test
+ public void testInitialState() {
+ View view = createLayout();
+ mItem.onBindView(view);
+
+ assertEquals(
+ "Collapsed summary should be TestSummary", "TestSummary", mItem.getCollapsedSummary());
+ assertEquals(
+ "Expanded summary should be TestSummaryExpanded",
+ "TestSummaryExpanded",
+ mItem.getExpandedSummary());
+
+ assertEquals("Should be collapsed initially", "TestSummary", mItem.getSummary());
+ assertEquals(
+ "Summary view should display collapsed summary", "TestSummary", mSummaryView.getText());
+
+ assertFalse("Expandable switch item itself should not be focusable", view.isFocusable());
+
+ View switchContent = view.findViewById(R.id.suw_items_expandable_switch_content);
+ assertThat(switchContent).isInstanceOf(CheckableLinearLayout.class);
+ assertThat(switchContent.isFocusable()).named("expandable content focusable").isTrue();
+ }
+
+ @Test
+ public void testExpanded() {
+ View view = createLayout();
+ mItem.onBindView(view);
+
+ mItem.setExpanded(true);
+
+ assertEquals(
+ "Collapsed summary should be TestSummary", "TestSummary", mItem.getCollapsedSummary());
+ assertEquals(
+ "Expanded summary should be TestSummaryExpanded",
+ "TestSummaryExpanded",
+ mItem.getExpandedSummary());
+
+ assertTrue("Should be expanded", mItem.isExpanded());
+ assertEquals(
+ "getSummary should be expanded summary", "TestSummaryExpanded", mItem.getSummary());
+ }
+
+ @Test
+ public void testCollapsed() {
+ View view = createLayout();
+ mItem.onBindView(view);
+
+ mItem.setExpanded(true);
+ assertTrue("Should be expanded", mItem.isExpanded());
+
+ mItem.setExpanded(false);
+
+ assertEquals(
+ "Collapsed summary should be TestSummary", "TestSummary", mItem.getCollapsedSummary());
+ assertEquals(
+ "Expanded summary should be TestSummaryExpanded",
+ "TestSummaryExpanded",
+ mItem.getExpandedSummary());
+
+ assertFalse("Should be expanded", mItem.isExpanded());
+ assertEquals("getSummary should be collapsed summary", "TestSummary", mItem.getSummary());
+ }
+
+ @Test
+ public void testClick() {
+ View view = createLayout();
+ mItem.onBindView(view);
+
+ assertFalse("Should not be expanded initially", mItem.isExpanded());
+
+ final View content = view.findViewById(R.id.suw_items_expandable_switch_content);
+ content.performClick();
+ assertTrue("Should be expanded after clicking", mItem.isExpanded());
+
+ content.performClick();
+ assertFalse("Should be collapsed again after clicking", mItem.isExpanded());
+ }
+
+ @Test
+ public void testDrawableState() {
+ final View view = LayoutInflater.from(application).inflate(mItem.getLayoutResource(), null);
+ mItem.onBindView(view);
+
+ final View titleView = view.findViewById(R.id.suw_items_title);
+ assertThat(titleView.getDrawableState())
+ .asList()
+ .named("Drawable state")
+ .doesNotContain(android.R.attr.state_checked);
+
+ mItem.setExpanded(true);
+ mItem.onBindView(view);
+ assertThat(titleView.getDrawableState())
+ .asList()
+ .named("Drawable state")
+ .contains(android.R.attr.state_checked);
+
+ mItem.setExpanded(false);
+ mItem.onBindView(view);
+ assertThat(titleView.getDrawableState())
+ .asList()
+ .named("Drawable state")
+ .doesNotContain(android.R.attr.state_checked);
+ }
+
+ private ViewGroup createLayout() {
+ ViewGroup root =
+ (ViewGroup)
+ LayoutInflater.from(application).inflate(R.layout.suw_items_expandable_switch, null);
+ mSummaryView = root.findViewById(R.id.suw_items_summary);
+
+ return root;
+ }
}
diff --git a/library/gingerbread/test/robotest/src/com/android/setupwizardlib/items/SwitchItemTest.java b/library/gingerbread/test/robotest/src/com/android/setupwizardlib/items/SwitchItemTest.java
index 05d6e5b..422d979 100644
--- a/library/gingerbread/test/robotest/src/com/android/setupwizardlib/items/SwitchItemTest.java
+++ b/library/gingerbread/test/robotest/src/com/android/setupwizardlib/items/SwitchItemTest.java
@@ -17,7 +17,6 @@
package com.android.setupwizardlib.items;
import static com.google.common.truth.Truth.assertThat;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -26,219 +25,232 @@ import static org.robolectric.RuntimeEnvironment.application;
import android.annotation.TargetApi;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
+import androidx.appcompat.widget.SwitchCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
+import android.widget.LinearLayout;
import android.widget.TextView;
-
-import androidx.appcompat.widget.SwitchCompat;
-
import com.android.setupwizardlib.R;
-import com.android.setupwizardlib.robolectric.SuwLibRobolectricTestRunner;
-
import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.robolectric.Robolectric;
+import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
-@RunWith(SuwLibRobolectricTestRunner.class)
-@Config(sdk = { Config.OLDEST_SDK, Config.NEWEST_SDK })
+@RunWith(RobolectricTestRunner.class)
+@Config(sdk = {Config.OLDEST_SDK, Config.NEWEST_SDK})
public class SwitchItemTest {
- private SwitchCompat mSwitch;
+ private SwitchCompat mSwitch;
- @Test
- public void testLayout() {
- Assume.assumeTrue(VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP);
- SwitchItem item = new SwitchItem();
- LayoutInflater inflater = LayoutInflater.from(application);
- ViewGroup layout = (ViewGroup) inflater.inflate(item.getDefaultLayoutResource(), null);
- assertThat(layout.getClipToPadding()).isFalse();
- }
+ @Test
+ public void defaultLayout_baselineAligned_shouldBeFalse() {
+ Assume.assumeTrue(VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP);
+ LayoutInflater inflater = LayoutInflater.from(application);
+ SwitchItem item = new SwitchItem();
+ LinearLayout layout = (LinearLayout) inflater.inflate(item.getDefaultLayoutResource(), null);
+ assertThat(layout.isBaselineAligned()).isFalse();
+ }
+
+ @Test
+ public void verboseLayout_clipPadding_shouldBeFalse() {
+ Assume.assumeTrue(VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP);
+ LayoutInflater inflater = LayoutInflater.from(application);
+ SwitchItem item =
+ new SwitchItem(
+ application,
+ Robolectric.buildAttributeSet()
+ .addAttribute(android.R.attr.layout, "@layout/suw_items_switch_verbose")
+ .build());
+ ViewGroup layout = (ViewGroup) inflater.inflate(item.getLayoutResource(), null);
+ assertThat(layout.getClipToPadding()).isFalse();
+ }
- @Test
- public void testChecked() {
- SwitchItem item = new SwitchItem();
- item.setTitle("TestTitle");
- item.setSummary("TestSummary");
- View view = createLayout();
+ @Test
+ public void testChecked() {
+ SwitchItem item = new SwitchItem();
+ item.setTitle("TestTitle");
+ item.setSummary("TestSummary");
+ View view = createLayout();
- item.setChecked(true);
+ item.setChecked(true);
- item.onBindView(view);
+ item.onBindView(view);
- assertTrue("Switch should be checked", mSwitch.isChecked());
- }
+ assertTrue("Switch should be checked", mSwitch.isChecked());
+ }
- @Test
- public void testNotChecked() {
- SwitchItem item = new SwitchItem();
- item.setTitle("TestTitle");
- item.setSummary("TestSummary");
- View view = createLayout();
+ @Test
+ public void testNotChecked() {
+ SwitchItem item = new SwitchItem();
+ item.setTitle("TestTitle");
+ item.setSummary("TestSummary");
+ View view = createLayout();
- item.setChecked(false);
+ item.setChecked(false);
- item.onBindView(view);
+ item.onBindView(view);
- assertFalse("Switch should be unchecked", mSwitch.isChecked());
- }
+ assertFalse("Switch should be unchecked", mSwitch.isChecked());
+ }
- @Test
- public void testListener() {
- SwitchItem item = new SwitchItem();
- item.setTitle("TestTitle");
- item.setSummary("TestSummary");
- View view = createLayout();
+ @Test
+ public void testListener() {
+ SwitchItem item = new SwitchItem();
+ item.setTitle("TestTitle");
+ item.setSummary("TestSummary");
+ View view = createLayout();
- item.setChecked(true);
+ item.setChecked(true);
- final TestOnCheckedChangeListener listener = new TestOnCheckedChangeListener();
- item.setOnCheckedChangeListener(listener);
+ final TestOnCheckedChangeListener listener = new TestOnCheckedChangeListener();
+ item.setOnCheckedChangeListener(listener);
- item.onBindView(view);
+ item.onBindView(view);
- assertTrue("Switch should be checked", mSwitch.isChecked());
- mSwitch.setChecked(false);
+ assertTrue("Switch should be checked", mSwitch.isChecked());
+ mSwitch.setChecked(false);
- assertTrue("Listener should be called", listener.mCalled);
- assertFalse("Listener should not be checked", listener.mChecked);
+ assertTrue("Listener should be called", listener.mCalled);
+ assertFalse("Listener should not be checked", listener.mChecked);
- mSwitch.setChecked(true);
+ mSwitch.setChecked(true);
- assertTrue("Listener should be called", listener.mCalled);
- assertTrue("Listener should be checked", listener.mChecked);
- }
+ assertTrue("Listener should be called", listener.mCalled);
+ assertTrue("Listener should be checked", listener.mChecked);
+ }
- @Test
- public void testRebind() {
- SwitchItem item1 = new SwitchItem();
- item1.setTitle("TestTitle1");
- item1.setSummary("TestSummary1");
- item1.setChecked(false);
+ @Test
+ public void testRebind() {
+ SwitchItem item1 = new SwitchItem();
+ item1.setTitle("TestTitle1");
+ item1.setSummary("TestSummary1");
+ item1.setChecked(false);
- SwitchItem item2 = new SwitchItem();
- item2.setTitle("TestTitle2");
- item2.setSummary("TestSummary2");
- item2.setChecked(true);
+ SwitchItem item2 = new SwitchItem();
+ item2.setTitle("TestTitle2");
+ item2.setSummary("TestSummary2");
+ item2.setChecked(true);
- View view = createLayout();
+ View view = createLayout();
- item1.onBindView(view);
- item2.onBindView(view);
+ item1.onBindView(view);
+ item2.onBindView(view);
- // Switch should be bound to item2, and therefore checked
- assertTrue("Switch should be checked", mSwitch.isChecked());
+ // Switch should be bound to item2, and therefore checked
+ assertTrue("Switch should be checked", mSwitch.isChecked());
- // Switching the switch to false should change the checked state of item 2 only
- mSwitch.setChecked(false);
- assertFalse("Item1 should still be unchecked", item1.isChecked());
- assertFalse("Item2 should not be checked", item2.isChecked());
+ // Switching the switch to false should change the checked state of item 2 only
+ mSwitch.setChecked(false);
+ assertFalse("Item1 should still be unchecked", item1.isChecked());
+ assertFalse("Item2 should not be checked", item2.isChecked());
- // Switching the switch to true should change the checked state of item 2 only
- mSwitch.setChecked(true);
- assertFalse("Item1 should still be unchecked", item1.isChecked());
- assertTrue("Item2 should be checked", item2.isChecked());
- }
+ // Switching the switch to true should change the checked state of item 2 only
+ mSwitch.setChecked(true);
+ assertFalse("Item1 should still be unchecked", item1.isChecked());
+ assertTrue("Item2 should be checked", item2.isChecked());
+ }
- @Test
- public void testListenerSetChecked() {
- // Check that calling setChecked on the item will also call the listener.
+ @Test
+ public void testListenerSetChecked() {
+ // Check that calling setChecked on the item will also call the listener.
- SwitchItem item = new SwitchItem();
- item.setTitle("TestTitle");
- item.setSummary("TestSummary");
- View view = createLayout();
+ SwitchItem item = new SwitchItem();
+ item.setTitle("TestTitle");
+ item.setSummary("TestSummary");
+ View view = createLayout();
- item.setChecked(true);
+ item.setChecked(true);
- final TestOnCheckedChangeListener listener = new TestOnCheckedChangeListener();
- item.setOnCheckedChangeListener(listener);
+ final TestOnCheckedChangeListener listener = new TestOnCheckedChangeListener();
+ item.setOnCheckedChangeListener(listener);
- item.onBindView(view);
+ item.onBindView(view);
- assertTrue("Switch should be checked", mSwitch.isChecked());
- item.setChecked(false);
+ assertTrue("Switch should be checked", mSwitch.isChecked());
+ item.setChecked(false);
- assertTrue("Listener should be called", listener.mCalled);
- assertFalse("Listener should not be checked", listener.mChecked);
+ assertTrue("Listener should be called", listener.mCalled);
+ assertFalse("Listener should not be checked", listener.mChecked);
- item.setChecked(true);
+ item.setChecked(true);
- assertTrue("Listener should be called", listener.mCalled);
- assertTrue("Listener should be checked", listener.mChecked);
- }
+ assertTrue("Listener should be called", listener.mCalled);
+ assertTrue("Listener should be checked", listener.mChecked);
+ }
- @Test
- public void testToggle() {
- SwitchItem item = new SwitchItem();
- item.setTitle("TestTitle");
- item.setSummary("TestSummary");
- View view = createLayout();
+ @Test
+ public void testToggle() {
+ SwitchItem item = new SwitchItem();
+ item.setTitle("TestTitle");
+ item.setSummary("TestSummary");
+ View view = createLayout();
- item.setChecked(true);
- item.onBindView(view);
+ item.setChecked(true);
+ item.onBindView(view);
- assertTrue("Switch should be checked", mSwitch.isChecked());
+ assertTrue("Switch should be checked", mSwitch.isChecked());
- item.toggle(view);
+ item.toggle(view);
- assertFalse("Switch should be unchecked", mSwitch.isChecked());
- }
+ assertFalse("Switch should be unchecked", mSwitch.isChecked());
+ }
- @TargetApi(VERSION_CODES.JELLY_BEAN_MR1)
- @Config(minSdk = VERSION_CODES.JELLY_BEAN_MR1)
- @Test
- public void testAccessibility() {
- SwitchItem item = new SwitchItem();
- item.setTitle("TestTitle");
- item.setSummary("TestSummary");
+ @TargetApi(VERSION_CODES.JELLY_BEAN_MR1)
+ @Config(minSdk = VERSION_CODES.JELLY_BEAN_MR1)
+ @Test
+ public void testAccessibility() {
+ SwitchItem item = new SwitchItem();
+ item.setTitle("TestTitle");
+ item.setSummary("TestSummary");
- View view = LayoutInflater.from(application).inflate(R.layout.suw_items_switch, null);
- item.onBindView(view);
+ View view = LayoutInflater.from(application).inflate(R.layout.suw_items_switch, null);
+ item.onBindView(view);
- final View titleView = view.findViewById(R.id.suw_items_title);
- assertEquals("Title view should label for switch",
- R.id.suw_items_switch, titleView.getLabelFor());
- }
+ final View titleView = view.findViewById(R.id.suw_items_title);
+ assertEquals(
+ "Title view should label for switch", R.id.suw_items_switch, titleView.getLabelFor());
+ }
- private ViewGroup createLayout() {
- ViewGroup root = new FrameLayout(application);
+ private ViewGroup createLayout() {
+ ViewGroup root = new FrameLayout(application);
- TextView titleView = new TextView(application);
- titleView.setId(R.id.suw_items_title);
- root.addView(titleView);
+ TextView titleView = new TextView(application);
+ titleView.setId(R.id.suw_items_title);
+ root.addView(titleView);
- TextView summaryView = new TextView(application);
- summaryView.setId(R.id.suw_items_summary);
- root.addView(summaryView);
+ TextView summaryView = new TextView(application);
+ summaryView.setId(R.id.suw_items_summary);
+ root.addView(summaryView);
- FrameLayout iconContainer = new FrameLayout(application);
- iconContainer.setId(R.id.suw_items_icon_container);
- root.addView(iconContainer);
+ FrameLayout iconContainer = new FrameLayout(application);
+ iconContainer.setId(R.id.suw_items_icon_container);
+ root.addView(iconContainer);
- ImageView iconView = new ImageView(application);
- iconView.setId(R.id.suw_items_icon);
- iconContainer.addView(iconView);
+ ImageView iconView = new ImageView(application);
+ iconView.setId(R.id.suw_items_icon);
+ iconContainer.addView(iconView);
- mSwitch = new SwitchCompat(application);
- mSwitch.setId(R.id.suw_items_switch);
- root.addView(mSwitch);
+ mSwitch = new SwitchCompat(application);
+ mSwitch.setId(R.id.suw_items_switch);
+ root.addView(mSwitch);
- return root;
- }
+ return root;
+ }
- private static class TestOnCheckedChangeListener implements SwitchItem.OnCheckedChangeListener {
+ private static class TestOnCheckedChangeListener implements SwitchItem.OnCheckedChangeListener {
- boolean mCalled = false;
- boolean mChecked = false;
+ boolean mCalled = false;
+ boolean mChecked = false;
- @Override
- public void onCheckedChange(SwitchItem item, boolean isChecked) {
- mCalled = true;
- mChecked = isChecked;
- }
+ @Override
+ public void onCheckedChange(SwitchItem item, boolean isChecked) {
+ mCalled = true;
+ mChecked = isChecked;
}
+ }
}
diff --git a/library/gingerbread/test/robotest/src/com/android/setupwizardlib/util/DimensionConsistencyTest.java b/library/gingerbread/test/robotest/src/com/android/setupwizardlib/util/DimensionConsistencyTest.java
index 7a08235..1f76d35 100644
--- a/library/gingerbread/test/robotest/src/com/android/setupwizardlib/util/DimensionConsistencyTest.java
+++ b/library/gingerbread/test/robotest/src/com/android/setupwizardlib/util/DimensionConsistencyTest.java
@@ -24,45 +24,42 @@ import android.content.res.Resources;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.ContextThemeWrapper;
-
import com.android.setupwizardlib.R;
-import com.android.setupwizardlib.robolectric.SuwLibRobolectricTestRunner;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
-@RunWith(SuwLibRobolectricTestRunner.class)
+@RunWith(RobolectricTestRunner.class)
@Config(sdk = Config.ALL_SDKS)
public class DimensionConsistencyTest {
- // Visual height of the framework switch widget
- private static final int SWTICH_HEIGHT_DP = 26;
+ // Visual height of the framework switch widget
+ private static final int SWTICH_HEIGHT_DP = 26;
- private Context mContext;
+ private Context mContext;
- @Before
- public void setUp() {
- mContext = new ContextThemeWrapper(application, R.style.SuwThemeGlif_Light);
- }
+ @Before
+ public void setUp() {
+ mContext = new ContextThemeWrapper(application, R.style.SuwThemeGlif_Light);
+ }
- @Test
- public void testSwitchPaddingTop() {
- final Resources res = mContext.getResources();
+ @Test
+ public void testSwitchPaddingTop() {
+ final Resources res = mContext.getResources();
- assertEquals(
- "Switch and divider should be aligned at center vertically: "
- + "suw_switch_padding_top + SWITCH_HEIGHT / 2 = "
- + "suw_switch_divider_padding_top + suw_switch_divider_height / 2",
- res.getDimensionPixelSize(R.dimen.suw_switch_divider_padding_top)
- + (res.getDimensionPixelSize(R.dimen.suw_switch_divider_height) / 2),
- res.getDimensionPixelSize(R.dimen.suw_switch_padding_top)
- + (dp2Px(SWTICH_HEIGHT_DP) / 2));
- }
+ assertEquals(
+ "Switch and divider should be aligned at center vertically: "
+ + "suw_switch_padding_top + SWITCH_HEIGHT / 2 = "
+ + "suw_switch_divider_padding_top + suw_switch_divider_height / 2",
+ res.getDimensionPixelSize(R.dimen.suw_switch_divider_padding_top)
+ + (res.getDimensionPixelSize(R.dimen.suw_switch_divider_height) / 2),
+ res.getDimensionPixelSize(R.dimen.suw_switch_padding_top) + (dp2Px(SWTICH_HEIGHT_DP) / 2));
+ }
- private int dp2Px(float dp) {
- DisplayMetrics displayMetrics = mContext.getResources().getDisplayMetrics();
- return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, displayMetrics);
- }
+ private int dp2Px(float dp) {
+ DisplayMetrics displayMetrics = mContext.getResources().getDisplayMetrics();
+ return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, displayMetrics);
+ }
}