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

Commit f984db4b authored by Stanley Wang's avatar Stanley Wang
Browse files

The MainSwitch should has the accessibility label.

Add the title to the content description of Switch.

Fix: 182228819
Fix: 182227784
Test: robotest and manually test the UI
Change-Id: I3cad922e903df783ee7eaf727b82f16f3345ff30
parent e74cc356
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();