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

Commit f033f46c 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:...

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

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

Change-Id: I1dec3ba28d6211b432f3be46346575a1872062ec
parents 9a844201 41f6671a
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();