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

Commit 8253fe8c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "The MainSwitch should has the accessibility label." into sc-dev

parents 3c01aa0f f984db4b
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();