Merge "Add summary and footer message for the ScreenResolutionFragment." into tm-dev

This commit is contained in:
Amy Hsu
2022-03-04 06:24:08 +00:00
committed by Android (Google) Code Review
3 changed files with 58 additions and 5 deletions

View File

@@ -18,6 +18,7 @@ package com.android.settings.display;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
@@ -28,6 +29,8 @@ import androidx.test.annotation.UiThreadTest;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.android.settingslib.widget.SelectorWithWidgetPreference;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -87,4 +90,19 @@ public class ScreenResolutionFragmentTest {
verify(mFragment).setDisplayMode(QHD_WIDTH);
}
@Test
@UiThreadTest
public void bindPreferenceExtra_setSummary() {
mFragment.onAttach(mContext);
SelectorWithWidgetPreference preference = new SelectorWithWidgetPreference(mContext);
ScreenResolutionFragment.ScreenResolutionCandidateInfo candidates =
mock(ScreenResolutionFragment.ScreenResolutionCandidateInfo.class);
CharSequence summary = "test summary";
doReturn(summary).when(candidates).loadSummary();
mFragment.bindPreferenceExtra(preference, "com.example.test", candidates, null, null);
assertThat(preference.getSummary().toString().contentEquals(summary)).isTrue();
}
}