Add payload for condition card to reuse the viewholder
Bug: 30319913 Test: make RunSettingsRoboTests Change-Id: Ib08a301203f4075f0553386f7db1a68d69bde436
This commit is contained in:
@@ -196,6 +196,31 @@ public class DashboardDataTest {
|
||||
testDiffUtil(mDashboardDataWithOneConditions, mDashboardDataWithNoItems, testResultData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPayload_ItemConditionCard_returnNotNull() {
|
||||
final DashboardData.ItemsDataDiffCallback callback = new DashboardData
|
||||
.ItemsDataDiffCallback(
|
||||
mDashboardDataWithOneConditions.getItemList(),
|
||||
mDashboardDataWithOneConditions.getItemList());
|
||||
|
||||
// Item in position 0 is condition card, which payload should not be null
|
||||
assertThat(callback.getChangePayload(0, 0)).isNotEqualTo(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPayload_ItemNotConditionCard_returnNull() {
|
||||
final DashboardData.ItemsDataDiffCallback callback = new DashboardData
|
||||
.ItemsDataDiffCallback(
|
||||
mDashboardDataWithOneConditions.getItemList(),
|
||||
mDashboardDataWithOneConditions.getItemList());
|
||||
|
||||
// Only item in position 0 is condition card, so others' payload should be null
|
||||
for (int i = 1; i < mDashboardDataWithOneConditions.getItemList().size(); i++) {
|
||||
assertThat(callback.getChangePayload(i, i)).isEqualTo(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test when using the
|
||||
* {@link com.android.settings.dashboard.DashboardData.ItemsDataDiffCallback}
|
||||
|
Reference in New Issue
Block a user