Set preference invisible when no anomaly
In the previous code path, we will create an invisible anomaly preference and update it to visible if it contains any anomaly. However, when anomaly is dismissed we don't reset preference to invisible. So, this cl adds code to set it to invisible explicitly when anomaly list is empty. Bug: 64617126 Test: RunSettingsRoboTests Change-Id: Ie7a3498da91243f05f4c47fb1cc5f67b177d04b1
This commit is contained in:
@@ -102,6 +102,8 @@ public class AnomalySummaryPreferenceController {
|
||||
|
||||
mAnomalyPreference.setTitle(title);
|
||||
mAnomalyPreference.setSummary(summary);
|
||||
} else {
|
||||
mAnomalyPreference.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -106,6 +106,16 @@ public class AnomalySummaryPreferenceControllerTest {
|
||||
assertThat(mPreference.getSummary()).isEqualTo("Keeping device awake");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateAnomalySummaryPreference_emptyAnomaly_preferenceInvisible() {
|
||||
mPreference.setVisible(true);
|
||||
mAnomalyList.clear();
|
||||
|
||||
mAnomalySummaryPreferenceController.updateAnomalySummaryPreference(mAnomalyList);
|
||||
|
||||
assertThat(mPreference.isVisible()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateAnomalySummaryPreference_multipleAnomalies_showCorrectSummary() {
|
||||
mAnomalyList.add(createTestAnomaly());
|
||||
|
Reference in New Issue
Block a user