Search in sources :

Example 6 with ContextualCard

use of com.android.settings.homepage.contextualcards.ContextualCard in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class HotspotConditionControllerTest method buildContextualCard_hasWifiAp_shouldHaveWifiApSsid.

@Test
public void buildContextualCard_hasWifiAp_shouldHaveWifiApSsid() {
    setupWifiApConfiguration();
    final ContextualCard card = mController.buildContextualCard();
    assertThat(card.getSummaryText()).isEqualTo(WIFI_AP_SSID);
}
Also used : ContextualCard(com.android.settings.homepage.contextualcards.ContextualCard) Test(org.junit.Test)

Example 7 with ContextualCard

use of com.android.settings.homepage.contextualcards.ContextualCard in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class LegacySuggestionContextualCardControllerTest method onDismiss_shouldRemoveSuggestionFromList.

@Test
public void onDismiss_shouldRemoveSuggestionFromList() {
    mController.setCardUpdateListener(mCardUpdateListener);
    mController.mSuggestions.add(buildContextualCard("test1"));
    final ContextualCard card2 = buildContextualCard("test2");
    mController.mSuggestions.add(card2);
    assertThat(mController.mSuggestions).hasSize(2);
    mController.onDismissed(card2);
    assertThat(mController.mSuggestions).hasSize(1);
}
Also used : ContextualCard(com.android.settings.homepage.contextualcards.ContextualCard) Test(org.junit.Test)

Example 8 with ContextualCard

use of com.android.settings.homepage.contextualcards.ContextualCard in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class LegacySuggestionContextualCardControllerTest method onDismiss_shouldCallUpdateAdapter.

@Test
public void onDismiss_shouldCallUpdateAdapter() {
    mController.setCardUpdateListener(mCardUpdateListener);
    final ContextualCard card = buildContextualCard("test1");
    mController.mSuggestions.add(card);
    mController.onDismissed(card);
    verify(mCardUpdateListener).onContextualCardUpdated(anyMap());
}
Also used : ContextualCard(com.android.settings.homepage.contextualcards.ContextualCard) Test(org.junit.Test)

Example 9 with ContextualCard

use of com.android.settings.homepage.contextualcards.ContextualCard in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ConditionContextualCardControllerTest method onConditionsChanged_listenerNotSet_shouldNotUpdateData.

@Test
public void onConditionsChanged_listenerNotSet_shouldNotUpdateData() {
    final ContextualCard fakeConditionalCard = new ConditionalContextualCard.Builder().build();
    final List<ContextualCard> conditionalCards = new ArrayList<>();
    conditionalCards.add(fakeConditionalCard);
    when(mConditionManager.getDisplayableCards()).thenReturn(conditionalCards);
    mController.onConditionsChanged();
    verify(mListener, never()).onContextualCardUpdated(any());
}
Also used : ArrayList(java.util.ArrayList) ContextualCard(com.android.settings.homepage.contextualcards.ContextualCard) Test(org.junit.Test)

Example 10 with ContextualCard

use of com.android.settings.homepage.contextualcards.ContextualCard in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ConditionContextualCardControllerTest method onConditionsChanged_listenerIsSet_shouldUpdateData.

@Test
public void onConditionsChanged_listenerIsSet_shouldUpdateData() {
    final ContextualCard fakeConditionalCard = new ConditionalContextualCard.Builder().build();
    final List<ContextualCard> conditionalCards = new ArrayList<>();
    conditionalCards.add(fakeConditionalCard);
    when(mConditionManager.getDisplayableCards()).thenReturn(conditionalCards);
    mController.setCardUpdateListener(mListener);
    mController.onConditionsChanged();
    verify(mListener).onContextualCardUpdated(any());
}
Also used : ArrayList(java.util.ArrayList) ContextualCard(com.android.settings.homepage.contextualcards.ContextualCard) Test(org.junit.Test)

Aggregations

ContextualCard (com.android.settings.homepage.contextualcards.ContextualCard)35 Test (org.junit.Test)32 RecyclerView (androidx.recyclerview.widget.RecyclerView)21 View (android.view.View)15 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)10 ArrayList (java.util.ArrayList)6 Button (android.widget.Button)4 Cursor (android.database.Cursor)1 Uri (android.net.Uri)1 Suggestion (android.service.settings.suggestions.Suggestion)1 List (java.util.List)1 ExecutionException (java.util.concurrent.ExecutionException)1 Future (java.util.concurrent.Future)1 TimeoutException (java.util.concurrent.TimeoutException)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1