Merge "Update spacing and background color for condition/suggestion."

This commit is contained in:
TreeHugger Robot
2017-07-12 00:25:13 +00:00
committed by Android (Google) Code Review
11 changed files with 110 additions and 116 deletions

View File

@@ -402,7 +402,7 @@ public class DashboardAdapterTest {
new DashboardAdapter.SuggestionAndConditionContainerHolder(itemView);
mDashboardAdapter.onBindConditionAndSuggestion(
holder, DashboardAdapter.SUGGESTION_CONDITION_HEADER_POSITION + 1);
holder, DashboardAdapter.SUGGESTION_CONDITION_HEADER_POSITION);
verify(data).setAdapter(any(SuggestionAdapter.class));
// should not crash

View File

@@ -121,21 +121,17 @@ public class DashboardDataTest {
final List<DashboardData.Item> items = mDashboardDataWithOneConditions.getItemList();
// Header, suggestion, condition, footer, 1 tile
assertThat(items).hasSize(5);
assertThat(items).hasSize(4);
assertThat(items.get(0).id).isEqualTo(STABLE_ID_SUGGESTION_CONDITION_TOP_HEADER);
assertThat(items.get(1).id).isEqualTo(STABLE_ID_SUGGESTION_CONTAINER);
assertThat(items.get(2).id).isEqualTo(STABLE_ID_CONDITION_CONTAINER);
assertThat(items.get(3).id).isEqualTo(STABLE_ID_SUGGESTION_CONDITION_FOOTER);
assertThat(items.get(4).id).isEqualTo(Objects.hash(mTestCategoryTile.title));
assertThat(items.get(0).id).isEqualTo(STABLE_ID_SUGGESTION_CONTAINER);
assertThat(items.get(1).id).isEqualTo(STABLE_ID_CONDITION_CONTAINER);
assertThat(items.get(2).id).isEqualTo(STABLE_ID_SUGGESTION_CONDITION_FOOTER);
assertThat(items.get(3).id).isEqualTo(Objects.hash(mTestCategoryTile.title));
}
@Test
public void testBuildItemsData_containsAllData() {
final DashboardData.SuggestionConditionHeaderData data =
new DashboardData.SuggestionConditionHeaderData(
mDashboardDataWithOneConditions.getConditions(), 0);
final Object[] expectedObjects = {data,
final Object[] expectedObjects = {
mDashboardDataWithOneConditions.getSuggestions(),
mDashboardDataWithOneConditions.getConditions(),
null, mTestCategoryTile};
@@ -206,17 +202,13 @@ public class DashboardDataTest {
}
@Test
public void testDiffUtil_InsertOneCondition_ResultDataTwoChanged() {
public void testDiffUtil_InsertOneCondition_ResultDataOneChanged() {
//Build testResultData
final List<ListUpdateResult.ResultData> testResultData = new ArrayList<>();
// Item in position 1 is the header, which contains the number of conditions, changed from
// 1 to 2
testResultData.add(new ListUpdateResult.ResultData(
ListUpdateResult.ResultData.TYPE_OPERATION_CHANGE, 0, 1));
// Item in position 3 is the condition container containing the list of conditions, which
// Item in position 2 is the condition container containing the list of conditions, which
// gets 1 more item
testResultData.add(new ListUpdateResult.ResultData(
ListUpdateResult.ResultData.TYPE_OPERATION_CHANGE, 2, 1));
ListUpdateResult.ResultData.TYPE_OPERATION_CHANGE, 1, 1));
testDiffUtil(mDashboardDataWithOneConditions,
mDashboardDataWithTwoConditions, testResultData);
@@ -227,7 +219,7 @@ public class DashboardDataTest {
//Build testResultData
final List<ListUpdateResult.ResultData> testResultData = new ArrayList<>();
testResultData.add(new ListUpdateResult.ResultData(
ListUpdateResult.ResultData.TYPE_OPERATION_REMOVE, 0, 5));
ListUpdateResult.ResultData.TYPE_OPERATION_REMOVE, 0, 4));
testDiffUtil(mDashboardDataWithOneConditions, mDashboardDataWithNoItems, testResultData);
}