Merge "Fix accessibility labels for icon buttons" into tm-qpr-dev am: c3a40b4925
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21506624 Change-Id: I71ca567ef76d961731afef433c58e7d258349e25 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -110,7 +110,7 @@ public class SeekBarWithIconButtonsView extends LinearLayout {
|
|||||||
|
|
||||||
mSeekbar.setOnSeekBarChangeListener(mSeekBarListener);
|
mSeekbar.setOnSeekBarChangeListener(mSeekBarListener);
|
||||||
|
|
||||||
mIconStart.setOnClickListener((view) -> {
|
mIconStartFrame.setOnClickListener((view) -> {
|
||||||
final int progress = mSeekbar.getProgress();
|
final int progress = mSeekbar.getProgress();
|
||||||
if (progress > 0) {
|
if (progress > 0) {
|
||||||
mSeekbar.setProgress(progress - 1);
|
mSeekbar.setProgress(progress - 1);
|
||||||
@@ -118,7 +118,7 @@ public class SeekBarWithIconButtonsView extends LinearLayout {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mIconEnd.setOnClickListener((view) -> {
|
mIconEndFrame.setOnClickListener((view) -> {
|
||||||
final int progress = mSeekbar.getProgress();
|
final int progress = mSeekbar.getProgress();
|
||||||
if (progress < mSeekbar.getMax()) {
|
if (progress < mSeekbar.getMax()) {
|
||||||
mSeekbar.setProgress(progress + 1);
|
mSeekbar.setProgress(progress + 1);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import android.os.Handler
|
|||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.testing.AndroidTestingRunner
|
import android.testing.AndroidTestingRunner
|
||||||
import android.testing.TestableLooper
|
import android.testing.TestableLooper
|
||||||
import android.widget.ImageView
|
import android.view.ViewGroup
|
||||||
import android.widget.SeekBar
|
import android.widget.SeekBar
|
||||||
import androidx.test.filters.SmallTest
|
import androidx.test.filters.SmallTest
|
||||||
import com.android.systemui.R
|
import com.android.systemui.R
|
||||||
@@ -68,14 +68,14 @@ class FontScalingDialogTest : SysuiTestCase() {
|
|||||||
fun progressIsZero_clickIconEnd_seekBarProgressIncreaseOne_fontSizeScaled() {
|
fun progressIsZero_clickIconEnd_seekBarProgressIncreaseOne_fontSizeScaled() {
|
||||||
fontScalingDialog.show()
|
fontScalingDialog.show()
|
||||||
|
|
||||||
val iconEnd: ImageView = fontScalingDialog.findViewById(R.id.icon_end)!!
|
val iconEndFrame: ViewGroup = fontScalingDialog.findViewById(R.id.icon_end_frame)!!
|
||||||
val seekBarWithIconButtonsView: SeekBarWithIconButtonsView =
|
val seekBarWithIconButtonsView: SeekBarWithIconButtonsView =
|
||||||
fontScalingDialog.findViewById(R.id.font_scaling_slider)!!
|
fontScalingDialog.findViewById(R.id.font_scaling_slider)!!
|
||||||
val seekBar: SeekBar = fontScalingDialog.findViewById(R.id.seekbar)!!
|
val seekBar: SeekBar = fontScalingDialog.findViewById(R.id.seekbar)!!
|
||||||
|
|
||||||
seekBarWithIconButtonsView.setProgress(0)
|
seekBarWithIconButtonsView.setProgress(0)
|
||||||
|
|
||||||
iconEnd.performClick()
|
iconEndFrame.performClick()
|
||||||
|
|
||||||
val currentScale = systemSettings.getFloat(Settings.System.FONT_SCALE, /* def = */ 1.0f)
|
val currentScale = systemSettings.getFloat(Settings.System.FONT_SCALE, /* def = */ 1.0f)
|
||||||
assertThat(seekBar.getProgress()).isEqualTo(1)
|
assertThat(seekBar.getProgress()).isEqualTo(1)
|
||||||
@@ -88,14 +88,14 @@ class FontScalingDialogTest : SysuiTestCase() {
|
|||||||
fun progressIsMax_clickIconStart_seekBarProgressDecreaseOne_fontSizeScaled() {
|
fun progressIsMax_clickIconStart_seekBarProgressDecreaseOne_fontSizeScaled() {
|
||||||
fontScalingDialog.show()
|
fontScalingDialog.show()
|
||||||
|
|
||||||
val iconStart: ImageView = fontScalingDialog.findViewById(R.id.icon_start)!!
|
val iconStartFrame: ViewGroup = fontScalingDialog.findViewById(R.id.icon_start_frame)!!
|
||||||
val seekBarWithIconButtonsView: SeekBarWithIconButtonsView =
|
val seekBarWithIconButtonsView: SeekBarWithIconButtonsView =
|
||||||
fontScalingDialog.findViewById(R.id.font_scaling_slider)!!
|
fontScalingDialog.findViewById(R.id.font_scaling_slider)!!
|
||||||
val seekBar: SeekBar = fontScalingDialog.findViewById(R.id.seekbar)!!
|
val seekBar: SeekBar = fontScalingDialog.findViewById(R.id.seekbar)!!
|
||||||
|
|
||||||
seekBarWithIconButtonsView.setProgress(fontSizeValueArray.size - 1)
|
seekBarWithIconButtonsView.setProgress(fontSizeValueArray.size - 1)
|
||||||
|
|
||||||
iconStart.performClick()
|
iconStartFrame.performClick()
|
||||||
|
|
||||||
val currentScale = systemSettings.getFloat(Settings.System.FONT_SCALE, /* def = */ 1.0f)
|
val currentScale = systemSettings.getFloat(Settings.System.FONT_SCALE, /* def = */ 1.0f)
|
||||||
assertThat(seekBar.getProgress()).isEqualTo(fontSizeValueArray.size - 2)
|
assertThat(seekBar.getProgress()).isEqualTo(fontSizeValueArray.size - 2)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import static com.google.common.truth.Truth.assertThat;
|
|||||||
|
|
||||||
import android.testing.AndroidTestingRunner;
|
import android.testing.AndroidTestingRunner;
|
||||||
import android.testing.TestableLooper;
|
import android.testing.TestableLooper;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
|
|
||||||
@@ -42,6 +43,8 @@ public class SeekBarWithIconButtonsViewTest extends SysuiTestCase {
|
|||||||
|
|
||||||
private ImageView mIconStart;
|
private ImageView mIconStart;
|
||||||
private ImageView mIconEnd;
|
private ImageView mIconEnd;
|
||||||
|
private ViewGroup mIconStartFrame;
|
||||||
|
private ViewGroup mIconEndFrame;
|
||||||
private SeekBar mSeekbar;
|
private SeekBar mSeekbar;
|
||||||
private SeekBarWithIconButtonsView mIconDiscreteSliderLinearLayout;
|
private SeekBarWithIconButtonsView mIconDiscreteSliderLinearLayout;
|
||||||
|
|
||||||
@@ -50,6 +53,8 @@ public class SeekBarWithIconButtonsViewTest extends SysuiTestCase {
|
|||||||
mIconDiscreteSliderLinearLayout = new SeekBarWithIconButtonsView(mContext);
|
mIconDiscreteSliderLinearLayout = new SeekBarWithIconButtonsView(mContext);
|
||||||
mIconStart = mIconDiscreteSliderLinearLayout.findViewById(R.id.icon_start);
|
mIconStart = mIconDiscreteSliderLinearLayout.findViewById(R.id.icon_start);
|
||||||
mIconEnd = mIconDiscreteSliderLinearLayout.findViewById(R.id.icon_end);
|
mIconEnd = mIconDiscreteSliderLinearLayout.findViewById(R.id.icon_end);
|
||||||
|
mIconStartFrame = mIconDiscreteSliderLinearLayout.findViewById(R.id.icon_start_frame);
|
||||||
|
mIconEndFrame = mIconDiscreteSliderLinearLayout.findViewById(R.id.icon_end_frame);
|
||||||
mSeekbar = mIconDiscreteSliderLinearLayout.findViewById(R.id.seekbar);
|
mSeekbar = mIconDiscreteSliderLinearLayout.findViewById(R.id.seekbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,6 +64,8 @@ public class SeekBarWithIconButtonsViewTest extends SysuiTestCase {
|
|||||||
|
|
||||||
assertThat(mIconStart.isEnabled()).isFalse();
|
assertThat(mIconStart.isEnabled()).isFalse();
|
||||||
assertThat(mIconEnd.isEnabled()).isTrue();
|
assertThat(mIconEnd.isEnabled()).isTrue();
|
||||||
|
assertThat(mIconStartFrame.isEnabled()).isFalse();
|
||||||
|
assertThat(mIconEndFrame.isEnabled()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -67,6 +74,8 @@ public class SeekBarWithIconButtonsViewTest extends SysuiTestCase {
|
|||||||
|
|
||||||
assertThat(mIconEnd.isEnabled()).isFalse();
|
assertThat(mIconEnd.isEnabled()).isFalse();
|
||||||
assertThat(mIconStart.isEnabled()).isTrue();
|
assertThat(mIconStart.isEnabled()).isTrue();
|
||||||
|
assertThat(mIconEndFrame.isEnabled()).isFalse();
|
||||||
|
assertThat(mIconStartFrame.isEnabled()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -77,12 +86,15 @@ public class SeekBarWithIconButtonsViewTest extends SysuiTestCase {
|
|||||||
|
|
||||||
assertThat(mIconStart.isEnabled()).isTrue();
|
assertThat(mIconStart.isEnabled()).isTrue();
|
||||||
assertThat(mIconEnd.isEnabled()).isTrue();
|
assertThat(mIconEnd.isEnabled()).isTrue();
|
||||||
|
assertThat(mIconStartFrame.isEnabled()).isTrue();
|
||||||
|
assertThat(mIconEndFrame.isEnabled()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void clickIconEnd_currentProgressIsOneToMax_reachesMax() {
|
public void clickIconEnd_currentProgressIsOneToMax_reachesMax() {
|
||||||
mIconDiscreteSliderLinearLayout.setProgress(mSeekbar.getMax() - 1);
|
mIconDiscreteSliderLinearLayout.setProgress(mSeekbar.getMax() - 1);
|
||||||
mIconEnd.performClick();
|
|
||||||
|
mIconEndFrame.performClick();
|
||||||
|
|
||||||
assertThat(mSeekbar.getProgress()).isEqualTo(mSeekbar.getMax());
|
assertThat(mSeekbar.getProgress()).isEqualTo(mSeekbar.getMax());
|
||||||
}
|
}
|
||||||
@@ -90,7 +102,8 @@ public class SeekBarWithIconButtonsViewTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void clickIconStart_currentProgressIsOne_reachesZero() {
|
public void clickIconStart_currentProgressIsOne_reachesZero() {
|
||||||
mIconDiscreteSliderLinearLayout.setProgress(1);
|
mIconDiscreteSliderLinearLayout.setProgress(1);
|
||||||
mIconStart.performClick();
|
|
||||||
|
mIconStartFrame.performClick();
|
||||||
|
|
||||||
assertThat(mSeekbar.getProgress()).isEqualTo(0);
|
assertThat(mSeekbar.getProgress()).isEqualTo(0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user