Loading packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java +2 −2 Original line number Diff line number Diff line Loading @@ -358,8 +358,8 @@ public class AccessPoint implements Comparable<AccessPoint> { } public CharSequence getSsid() { SpannableString str = new SpannableString(ssid); str.setSpan(new TtsSpan.VerbatimBuilder(ssid).build(), 0, ssid.length(), final SpannableString str = new SpannableString(ssid); str.setSpan(new TtsSpan.TelephoneBuilder(ssid).build(), 0, ssid.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE); return str; } Loading packages/SettingsLib/tests/src/com/android/settingslib/wifi/AccessPointTest.java 0 → 100644 +51 −0 Original line number Diff line number Diff line /* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License */ package com.android.settingslib.wifi; import android.os.Bundle; import android.support.test.InstrumentationRegistry; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; import android.text.SpannableString; import android.text.style.TtsSpan; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @SmallTest @RunWith(AndroidJUnit4.class) public class AccessPointTest { private static final String TEST_SSID = "test_ssid"; @Test public void testSsidIsTelephoneSpan() { final Bundle bundle = new Bundle(); bundle.putString("key_ssid", TEST_SSID); final AccessPoint ap = new AccessPoint(InstrumentationRegistry.getTargetContext(), bundle); final CharSequence ssid = ap.getSsid(); assertTrue(ssid instanceof SpannableString); TtsSpan[] spans = ((SpannableString) ssid).getSpans(0, TEST_SSID.length(), TtsSpan.class); assertEquals(1, spans.length); assertEquals(TtsSpan.TYPE_TELEPHONE, spans[0].getType()); } } Loading
packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java +2 −2 Original line number Diff line number Diff line Loading @@ -358,8 +358,8 @@ public class AccessPoint implements Comparable<AccessPoint> { } public CharSequence getSsid() { SpannableString str = new SpannableString(ssid); str.setSpan(new TtsSpan.VerbatimBuilder(ssid).build(), 0, ssid.length(), final SpannableString str = new SpannableString(ssid); str.setSpan(new TtsSpan.TelephoneBuilder(ssid).build(), 0, ssid.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE); return str; } Loading
packages/SettingsLib/tests/src/com/android/settingslib/wifi/AccessPointTest.java 0 → 100644 +51 −0 Original line number Diff line number Diff line /* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License */ package com.android.settingslib.wifi; import android.os.Bundle; import android.support.test.InstrumentationRegistry; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; import android.text.SpannableString; import android.text.style.TtsSpan; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @SmallTest @RunWith(AndroidJUnit4.class) public class AccessPointTest { private static final String TEST_SSID = "test_ssid"; @Test public void testSsidIsTelephoneSpan() { final Bundle bundle = new Bundle(); bundle.putString("key_ssid", TEST_SSID); final AccessPoint ap = new AccessPoint(InstrumentationRegistry.getTargetContext(), bundle); final CharSequence ssid = ap.getSsid(); assertTrue(ssid instanceof SpannableString); TtsSpan[] spans = ((SpannableString) ssid).getSpans(0, TEST_SSID.length(), TtsSpan.class); assertEquals(1, spans.length); assertEquals(TtsSpan.TYPE_TELEPHONE, spans[0].getType()); } }