Search in sources :

Example 36 with Tile

use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by LineageOS.

the class SuggestionsChecksTest method testFingerprintEnrollmentIntroductionIsCompleteWhenFingerprintAdded.

@Test
public void testFingerprintEnrollmentIntroductionIsCompleteWhenFingerprintAdded() {
    stubFingerprintSupported(true);
    when(mFingerprintManager.hasEnrolledFingerprints()).thenReturn(true);
    when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
    Tile tile = createFingerprintTile();
    assertThat(mSuggestionsChecks.isSuggestionComplete(tile)).isTrue();
}
Also used : Tile(com.android.settingslib.drawer.Tile) Test(org.junit.Test)

Example 37 with Tile

use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by LineageOS.

the class SuggestionsChecksTest method testFingerprintEnrollmentIntroductionIsCompleteWhenHardwareNotDetected.

@Test
public void testFingerprintEnrollmentIntroductionIsCompleteWhenHardwareNotDetected() {
    stubFingerprintSupported(true);
    when(mFingerprintManager.hasEnrolledFingerprints()).thenReturn(false);
    when(mFingerprintManager.isHardwareDetected()).thenReturn(false);
    Tile tile = createFingerprintTile();
    assertThat(mSuggestionsChecks.isSuggestionComplete(tile)).isTrue();
}
Also used : Tile(com.android.settingslib.drawer.Tile) Test(org.junit.Test)

Example 38 with Tile

use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by omnirom.

the class DashboardFragmentTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    FakeFeatureFactory.setupForTest(mContext);
    mFakeFeatureFactory = (FakeFeatureFactory) FeatureFactory.getFactory(mContext);
    mDashboardCategory.tiles = new ArrayList<>();
    mDashboardCategory.tiles.add(new Tile());
    mTestFragment = new TestFragment(ShadowApplication.getInstance().getApplicationContext());
    when(mFakeFeatureFactory.dashboardFeatureProvider.getProgressiveDisclosureMixin(nullable(Context.class), eq(mTestFragment), nullable(Bundle.class))).thenReturn(mDisclosureMixin);
    when(mFakeFeatureFactory.dashboardFeatureProvider.getTilesForCategory(nullable(String.class))).thenReturn(mDashboardCategory);
    mTestFragment.onAttach(ShadowApplication.getInstance().getApplicationContext());
    when(mContext.getPackageName()).thenReturn("TestPackage");
}
Also used : Context(android.content.Context) Bundle(android.os.Bundle) Tile(com.android.settingslib.drawer.Tile) Before(org.junit.Before)

Example 39 with Tile

use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by omnirom.

the class DashboardFragmentTest method tintTileIcon_hasMetadata_shouldReturnIconTintableMetadata.

@Test
public void tintTileIcon_hasMetadata_shouldReturnIconTintableMetadata() {
    final Tile tile = new Tile();
    tile.icon = mock(Icon.class);
    final Bundle metaData = new Bundle();
    tile.metaData = metaData;
    metaData.putBoolean(TileUtils.META_DATA_PREFERENCE_ICON_TINTABLE, false);
    assertThat(mTestFragment.tintTileIcon(tile)).isFalse();
    metaData.putBoolean(TileUtils.META_DATA_PREFERENCE_ICON_TINTABLE, true);
    assertThat(mTestFragment.tintTileIcon(tile)).isTrue();
}
Also used : Bundle(android.os.Bundle) Tile(com.android.settingslib.drawer.Tile) Icon(android.graphics.drawable.Icon) Test(org.junit.Test)

Example 40 with Tile

use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by omnirom.

the class DashboardItemAnimatorTest method SetUp.

@Before
public void SetUp() {
    final Context context = ShadowApplication.getInstance().getApplicationContext();
    mDashboardItemAnimator = new DashboardItemAnimator();
    mViewHolder = new ViewHolder(new TextView(context));
    mViewHolder.itemView.setTag(new Tile());
}
Also used : Context(android.content.Context) ViewHolder(com.android.settings.dashboard.SupportItemAdapter.ViewHolder) Tile(com.android.settingslib.drawer.Tile) TextView(android.widget.TextView) Before(org.junit.Before)

Aggregations

Tile (com.android.settingslib.drawer.Tile)466 Test (org.junit.Test)309 Intent (android.content.Intent)158 Bundle (android.os.Bundle)117 Preference (android.support.v7.preference.Preference)108 DashboardCategory (com.android.settingslib.drawer.DashboardCategory)102 ComponentName (android.content.ComponentName)98 ArrayList (java.util.ArrayList)79 Context (android.content.Context)71 UserHandle (android.os.UserHandle)32 Activity (android.app.Activity)31 RecyclerView (android.support.v7.widget.RecyclerView)31 View (android.view.View)31 Icon (android.graphics.drawable.Icon)30 VisibleForTesting (android.support.annotation.VisibleForTesting)30 PackageManager (android.content.pm.PackageManager)25 TypedArray (android.content.res.TypedArray)24 ViewGroup (android.view.ViewGroup)24 RemoteViews (android.widget.RemoteViews)24 SettingsActivity (com.android.settings.SettingsActivity)24