Allow appending static preferences to RadioButtonPickerFragment
This makes it so that static preferences can also be added after the candidates so they can show up on the bottom of the screen. This is done via a new xml tag for the preference screen that is usually mostly empty that RaiodButtonPickerFragments use Test: robotests Bug: 111450127 Change-Id: I0fe2f480f0ff59b9bf9269e94b33ab4b008b47b8
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.settings.widget;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
@@ -37,7 +38,9 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Answers;
|
||||
import org.mockito.InOrder;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
@@ -98,6 +101,26 @@ public class RadioButtonPickerFragmentTest {
|
||||
assertThat(mFragment.setDefaultKeyCalled).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void staticPreferencesPrepended_addedFirst() {
|
||||
mFragment.mAppendStaticPreferences = false;
|
||||
mFragment.updateCandidates();
|
||||
|
||||
InOrder inOrder = Mockito.inOrder(mFragment);
|
||||
inOrder.verify(mFragment).addStaticPreferences(any());
|
||||
inOrder.verify(mFragment).getRadioButtonPreferenceCustomLayoutResId();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void staticPreferencesAppended_addedLast() {
|
||||
mFragment.mAppendStaticPreferences = true;
|
||||
mFragment.updateCandidates();
|
||||
|
||||
InOrder inOrder = Mockito.inOrder(mFragment);
|
||||
inOrder.verify(mFragment).mayCheckOnlyRadioButton();
|
||||
inOrder.verify(mFragment).addStaticPreferences(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldHaveNoCustomPreferenceLayout() {
|
||||
assertThat(mFragment.getRadioButtonPreferenceCustomLayoutResId()).isEqualTo(0);
|
||||
|
Reference in New Issue
Block a user