From 3d9fd0cd730460eab476749a439fb7a5f17313cb Mon Sep 17 00:00:00 2001 From: Fan Zhang Date: Mon, 28 Nov 2016 12:38:11 -0800 Subject: [PATCH] Update strings. Bug: 32841662 Test: RunSettingsRoboTests Change-Id: I178070bfd5f20188e580f8a3a8dd442bd17f3632 --- res/values/strings.xml | 8 ++-- .../bluetooth/BluetoothPairingDialogTest.java | 12 ++++++ .../MobilePlanPreferenceControllerTest.java | 43 ++++++++++++++++++++++ 3 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 tests/robotests/src/com/android/settings/network/MobilePlanPreferenceControllerTest.java diff --git a/res/values/strings.xml b/res/values/strings.xml index 3c9a4cca1d..078b646fa3 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -344,7 +344,9 @@ "Phone book access request" - %1$s wants to access your contacts and call history. Give access to %2$s? + + %1$s wants to access your contacts and call history. Give access to %2$s? + Don\u2019t ask again @@ -3032,7 +3034,7 @@ Unknown SIM operator - %1$s has no known provisioning website + %1$s has no known provisioning website Please insert SIM card and restart @@ -4515,7 +4517,7 @@ Never - at %1$s battery + at %1$sbattery diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDialogTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDialogTest.java index 035d29ee4b..90f21063f1 100644 --- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDialogTest.java +++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDialogTest.java @@ -16,20 +16,24 @@ package com.android.settings.bluetooth; import android.app.AlertDialog; +import android.content.Context; import android.text.SpannableStringBuilder; import android.text.TextUtils; import android.view.View; import android.widget.CheckBox; import android.widget.TextView; + import com.android.settings.R; import com.android.settings.SettingsRobolectricTestRunner; import com.android.settings.TestConfig; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.robolectric.annotation.Config; +import org.robolectric.shadows.ShadowApplication; import org.robolectric.util.FragmentTestUtil; import static com.google.common.truth.Truth.assertThat; @@ -330,6 +334,14 @@ public class BluetoothPairingDialogTest { assertThat(message.getVisibility()).isEqualTo(View.GONE); } + @Test + public void pairingStringIsFormattedCorrectly() { + final String device = "test_device"; + final Context context = ShadowApplication.getInstance().getApplicationContext(); + assertThat(context.getString(R.string.bluetooth_pb_acceptance_dialog_text, device, device)) + .contains(device); + } + private BluetoothPairingDialogFragment makeFragment() { BluetoothPairingDialogFragment frag = new BluetoothPairingDialogFragment(); frag.setPairingController(controller); diff --git a/tests/robotests/src/com/android/settings/network/MobilePlanPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/MobilePlanPreferenceControllerTest.java new file mode 100644 index 0000000000..5827c8b45a --- /dev/null +++ b/tests/robotests/src/com/android/settings/network/MobilePlanPreferenceControllerTest.java @@ -0,0 +1,43 @@ +/* + * 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.settings.network; + +import android.content.Context; + +import com.android.settings.R; +import com.android.settings.SettingsRobolectricTestRunner; +import com.android.settings.TestConfig; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.annotation.Config; +import org.robolectric.shadows.ShadowApplication; + +import static com.google.common.truth.Truth.assertThat; + +@RunWith(SettingsRobolectricTestRunner.class) +@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION) +public class MobilePlanPreferenceControllerTest { + + @Test + public void testNoProvisionStringFormattedCorrectly() { + final String operator = "test_operator"; + final Context context = ShadowApplication.getInstance().getApplicationContext(); + assertThat(context.getString(R.string.mobile_no_provisioning_url, operator, operator)) + .contains(operator); + } +} -- 2.11.0