diff options
author | Maurice Lam <yukl@google.com> | 2018-05-10 13:51:26 -0700 |
---|---|---|
committer | Maurice Lam <yukl@google.com> | 2018-05-14 17:09:12 +0000 |
commit | a65273f3bdf0527b101e51b6c5fba0ff51585831 (patch) | |
tree | df968e360ec575fa0d4acd10a427c57d37dd6072 | |
parent | e58194099d9133ce7b2e19fe7c717679b62fddb2 (diff) | |
download | setupwizard-pie-dev.tar.gz |
Fix SwitchItem clippie-dev
Test: ./gradlew test
Bug: 79175394
Change-Id: I3b0824e770b4c0470fc949d0d58f63dec54d7e12
(cherry picked from commit 2c20d03bbd0cb0ad835853f93a00cd509e982836)
-rw-r--r-- | library/gingerbread/res/layout/suw_items_switch.xml | 1 | ||||
-rw-r--r-- | library/gingerbread/test/robotest/src/com/android/setupwizardlib/items/SwitchItemTest.java | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/library/gingerbread/res/layout/suw_items_switch.xml b/library/gingerbread/res/layout/suw_items_switch.xml index 3f101d7..319d7f7 100644 --- a/library/gingerbread/res/layout/suw_items_switch.xml +++ b/library/gingerbread/res/layout/suw_items_switch.xml @@ -20,6 +20,7 @@ style="@style/SuwItemContainer.Verbose" android:layout_width="match_parent" android:layout_height="wrap_content" + android:clipToPadding="false" android:orientation="horizontal"> <FrameLayout 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 fa5bbba..dd26af9 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 @@ -16,12 +16,15 @@ 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; import static org.robolectric.RuntimeEnvironment.application; import android.annotation.TargetApi; +import android.os.Build.VERSION; import android.os.Build.VERSION_CODES; import android.support.v7.widget.SwitchCompat; import android.view.LayoutInflater; @@ -34,6 +37,7 @@ import android.widget.TextView; 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.annotation.Config; @@ -45,6 +49,15 @@ public class SwitchItemTest { 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 testChecked() { SwitchItem item = new SwitchItem(); item.setTitle("TestTitle"); |