Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 242f200f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "The MainSwitch should has the accessibility label." into sc-dev am: 8253fe8c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14660734

Change-Id: I2dde5618a7e01c41001f252fe4aae1d922779449
parents 5c28b369 8253fe8c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -150,6 +150,9 @@ public class MainSwitchBar extends LinearLayout implements CompoundButton.OnChec
    public void setTitle(CharSequence text) {
        if (mTextView != null) {
            mTextView.setText(text);
            if (mSwitch != null) {
                mSwitch.setContentDescription(mTextView.getText());
            }
        }
    }

+10 −0
Original line number Diff line number Diff line
@@ -58,6 +58,16 @@ public class MainSwitchBarTest {
        assertThat(textView.getText()).isEqualTo(title);
    }

    @Test
    public void setTitle_switchShouldHasContentDescription() {
        final String title = "title";

        mBar.setTitle(title);

        final Switch switchObj = mBar.getSwitch();
        assertThat(switchObj.getContentDescription()).isEqualTo(title);
    }

    @Test
    public void getSwitch_shouldNotNull() {
        final Switch switchObj = mBar.getSwitch();