Loading packages/SystemUI/tests/src/com/android/systemui/qs/carrier/QSCarrierTest.java +15 −3 Original line number Diff line number Diff line Loading @@ -21,10 +21,13 @@ import static org.junit.Assert.assertTrue; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.util.FeatureFlagUtils; import android.view.LayoutInflater; import androidx.test.filters.SmallTest; import com.android.settingslib.graph.SignalDrawable; import com.android.settingslib.mobile.TelephonyIcons; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; Loading @@ -39,6 +42,7 @@ public class QSCarrierTest extends SysuiTestCase { private QSCarrier mQSCarrier; private TestableLooper mTestableLooper; private int mSignalIconId; @Before public void setUp() throws Exception { Loading @@ -46,18 +50,26 @@ public class QSCarrierTest extends SysuiTestCase { LayoutInflater inflater = LayoutInflater.from(mContext); mTestableLooper.runWithLooper(() -> mQSCarrier = (QSCarrier) inflater.inflate(R.layout.qs_carrier, null)); if (FeatureFlagUtils.isEnabled(mContext, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) { // In this case, the id is an actual drawable id mSignalIconId = TelephonyIcons.MOBILE_CALL_STRENGTH_ICONS[0]; } else { // In this case, the id is a level mSignalIconId = SignalDrawable.getEmptyState(5); } } @Test public void testUpdateState_first() { CellSignalState c = new CellSignalState(true, 0, "", "", false); CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false); assertTrue(mQSCarrier.updateState(c)); } @Test public void testUpdateState_same() { CellSignalState c = new CellSignalState(true, 0, "", "", false); CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false); assertTrue(mQSCarrier.updateState(c)); assertFalse(mQSCarrier.updateState(c)); Loading @@ -65,7 +77,7 @@ public class QSCarrierTest extends SysuiTestCase { @Test public void testUpdateState_changed() { CellSignalState c = new CellSignalState(true, 0, "", "", false); CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false); assertTrue(mQSCarrier.updateState(c)); Loading Loading
packages/SystemUI/tests/src/com/android/systemui/qs/carrier/QSCarrierTest.java +15 −3 Original line number Diff line number Diff line Loading @@ -21,10 +21,13 @@ import static org.junit.Assert.assertTrue; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.util.FeatureFlagUtils; import android.view.LayoutInflater; import androidx.test.filters.SmallTest; import com.android.settingslib.graph.SignalDrawable; import com.android.settingslib.mobile.TelephonyIcons; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; Loading @@ -39,6 +42,7 @@ public class QSCarrierTest extends SysuiTestCase { private QSCarrier mQSCarrier; private TestableLooper mTestableLooper; private int mSignalIconId; @Before public void setUp() throws Exception { Loading @@ -46,18 +50,26 @@ public class QSCarrierTest extends SysuiTestCase { LayoutInflater inflater = LayoutInflater.from(mContext); mTestableLooper.runWithLooper(() -> mQSCarrier = (QSCarrier) inflater.inflate(R.layout.qs_carrier, null)); if (FeatureFlagUtils.isEnabled(mContext, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) { // In this case, the id is an actual drawable id mSignalIconId = TelephonyIcons.MOBILE_CALL_STRENGTH_ICONS[0]; } else { // In this case, the id is a level mSignalIconId = SignalDrawable.getEmptyState(5); } } @Test public void testUpdateState_first() { CellSignalState c = new CellSignalState(true, 0, "", "", false); CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false); assertTrue(mQSCarrier.updateState(c)); } @Test public void testUpdateState_same() { CellSignalState c = new CellSignalState(true, 0, "", "", false); CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false); assertTrue(mQSCarrier.updateState(c)); assertFalse(mQSCarrier.updateState(c)); Loading @@ -65,7 +77,7 @@ public class QSCarrierTest extends SysuiTestCase { @Test public void testUpdateState_changed() { CellSignalState c = new CellSignalState(true, 0, "", "", false); CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false); assertTrue(mQSCarrier.updateState(c)); Loading