summaryrefslogtreecommitdiff
path: root/library/gingerbread/test
diff options
context:
space:
mode:
authorMaurice Lam <yukl@google.com>2018-05-10 13:51:26 -0700
committerMaurice Lam <yukl@google.com>2018-05-10 14:13:46 -0700
commit2c20d03bbd0cb0ad835853f93a00cd509e982836 (patch)
tree6522476c20a87249a0a1c64af5d7b5ec4c82ff6b /library/gingerbread/test
parent9cea0a47e4c496c475056ec6286c5c4c4dd02963 (diff)
downloadsetupwizard-2c20d03bbd0cb0ad835853f93a00cd509e982836.tar.gz
Fix SwitchItem clip
Test: ./gradlew test Bug: 79175394 Change-Id: I3b0824e770b4c0470fc949d0d58f63dec54d7e12
Diffstat (limited to 'library/gingerbread/test')
-rw-r--r--library/gingerbread/test/robotest/src/com/android/setupwizardlib/items/SwitchItemTest.java13
1 files changed, 13 insertions, 0 deletions
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 693901e..05d6e5b 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.view.LayoutInflater;
import android.view.View;
@@ -35,6 +38,7 @@ 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.annotation.Config;
@@ -46,6 +50,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");