From f97da47c024f01fddc466db4efb3200d0b37ae49 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Tue, 22 May 2018 10:31:28 -0700 Subject: Opensource a test tool called EditTextVariations This CL opensouces a testing tool called EditTextVariations that has been used internally to test IME behaviors on various EditorInfo#inputType and EditorInfo#imeOptions. Bug: 80039502 Test: Manually verified as follows. 1. tapas EditTextVariations 2. make -j 3. adb install -r $ANDROID_TARGET_OUT_TESTCASES/EditTextVariations/EditTextVariations.apk Change-Id: Ia87e655573c2fd1fc09d56e4af90bfb1dfd65f9b --- tools/EditTextVariations/Android.mk | 26 ++ tools/EditTextVariations/AndroidManifest.xml | 44 ++ tools/EditTextVariations/assets/Theme.css | 56 +++ tools/EditTextVariations/assets/Theme_Black.css | 56 +++ tools/EditTextVariations/assets/Theme_Holo.css | 56 +++ .../EditTextVariations/assets/Theme_Holo_Light.css | 56 +++ tools/EditTextVariations/assets/Theme_Light.css | 56 +++ tools/EditTextVariations/assets/Theme_Material.css | 56 +++ .../assets/Theme_Material_Light.css | 56 +++ tools/EditTextVariations/assets/webview.html | 96 +++++ .../res/drawable-hdpi/ic_launcher.png | Bin 0 -> 4111 bytes .../res/drawable-mdpi/ic_launcher.png | Bin 0 -> 2258 bytes .../res/drawable-xhdpi/ic_launcher.png | Bin 0 -> 5963 bytes .../res/drawable-xxhdpi/ic_launcher.png | Bin 0 -> 10916 bytes tools/EditTextVariations/res/layout/main.xml | 298 +++++++++++++ .../res/values-v11/donottranslate.xml | 23 + tools/EditTextVariations/res/values-v14/themes.xml | 23 + tools/EditTextVariations/res/values-v27/themes.xml | 27 ++ tools/EditTextVariations/res/values/countries.xml | 263 ++++++++++++ tools/EditTextVariations/res/values/strings.xml | 38 ++ tools/EditTextVariations/res/values/themes.xml | 23 + .../edittextvariations/EchoingTextWatcher.java | 86 ++++ .../edittextvariations/EditTextVariations.java | 473 +++++++++++++++++++++ .../tools/edittextvariations/FinalClassField.java | 64 +++ .../tools/edittextvariations/InstanceMethod.java | 83 ++++ .../MultiLineShortMessageEditText.java | 46 ++ .../tools/edittextvariations/ThemeItem.java | 68 +++ 27 files changed, 2073 insertions(+) create mode 100644 tools/EditTextVariations/Android.mk create mode 100644 tools/EditTextVariations/AndroidManifest.xml create mode 100644 tools/EditTextVariations/assets/Theme.css create mode 100644 tools/EditTextVariations/assets/Theme_Black.css create mode 100644 tools/EditTextVariations/assets/Theme_Holo.css create mode 100644 tools/EditTextVariations/assets/Theme_Holo_Light.css create mode 100644 tools/EditTextVariations/assets/Theme_Light.css create mode 100644 tools/EditTextVariations/assets/Theme_Material.css create mode 100644 tools/EditTextVariations/assets/Theme_Material_Light.css create mode 100644 tools/EditTextVariations/assets/webview.html create mode 100644 tools/EditTextVariations/res/drawable-hdpi/ic_launcher.png create mode 100644 tools/EditTextVariations/res/drawable-mdpi/ic_launcher.png create mode 100644 tools/EditTextVariations/res/drawable-xhdpi/ic_launcher.png create mode 100644 tools/EditTextVariations/res/drawable-xxhdpi/ic_launcher.png create mode 100644 tools/EditTextVariations/res/layout/main.xml create mode 100644 tools/EditTextVariations/res/values-v11/donottranslate.xml create mode 100644 tools/EditTextVariations/res/values-v14/themes.xml create mode 100644 tools/EditTextVariations/res/values-v27/themes.xml create mode 100644 tools/EditTextVariations/res/values/countries.xml create mode 100644 tools/EditTextVariations/res/values/strings.xml create mode 100644 tools/EditTextVariations/res/values/themes.xml create mode 100644 tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/EchoingTextWatcher.java create mode 100644 tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/EditTextVariations.java create mode 100644 tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/FinalClassField.java create mode 100644 tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/InstanceMethod.java create mode 100644 tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/MultiLineShortMessageEditText.java create mode 100644 tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/ThemeItem.java (limited to 'tools') diff --git a/tools/EditTextVariations/Android.mk b/tools/EditTextVariations/Android.mk new file mode 100644 index 000000000..1f49aa4a7 --- /dev/null +++ b/tools/EditTextVariations/Android.mk @@ -0,0 +1,26 @@ +# Copyright (C) 2013 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. + +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := tests + +LOCAL_SRC_FILES := $(call all-java-files-under, src) + +LOCAL_PACKAGE_NAME := EditTextVariations + +LOCAL_SDK_VERSION := current + +include $(BUILD_PACKAGE) diff --git a/tools/EditTextVariations/AndroidManifest.xml b/tools/EditTextVariations/AndroidManifest.xml new file mode 100644 index 000000000..7694f4db9 --- /dev/null +++ b/tools/EditTextVariations/AndroidManifest.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + diff --git a/tools/EditTextVariations/assets/Theme.css b/tools/EditTextVariations/assets/Theme.css new file mode 100644 index 000000000..b7aa514bf --- /dev/null +++ b/tools/EditTextVariations/assets/Theme.css @@ -0,0 +1,56 @@ + + +body { + background-color: black; +} +div.placeholder { + color: #a0a0a0; + font-size: 18px; + margin: 0px 0px -34px 0px; + padding: 4px 0px 4px 0px +} +div.input { + border: none; + margin: 4px 0px 4px -8px; +} +input { + color: black; + background-color: white; + font-size: 18px; + line-height: 200%; + vertical-align: center; + padding-left: 8px; + border-top: none; + border-right: none; + border-bottom: none; + border-left: none; +} +textarea { + color: black; + background-color: white; + font-size: 18px; + line-height: 150%; + vertical-align: center; + padding-left: 8px; + border-top: none; + border-right: none; + border-bottom: none; + border-left: none; +} diff --git a/tools/EditTextVariations/assets/Theme_Black.css b/tools/EditTextVariations/assets/Theme_Black.css new file mode 100644 index 000000000..ce663a180 --- /dev/null +++ b/tools/EditTextVariations/assets/Theme_Black.css @@ -0,0 +1,56 @@ + + +body { + background-color: black; +} +div.placeholder { + color: #a0a0a0; + font-size: 18px; + margin: 0px 0px -34px 0px; + padding: 4px 0px 4px 0px +} +div.input { + border: none; + margin: 4px 0px 4px -8px; +} +input { + color: black; + background-color: white; + font-size: 18px; + line-height: 200%; + vertical-align: center; + padding-left: 8px; + border-top: none; + border-right: none; + border-bottom: none; + border-left: none; +} +textarea { + color: black; + background-color: white; + font-size: 18px; + line-height: 150%; + vertical-align: center; + padding-left: 8px; + border-top: none; + border-right: none; + border-bottom: none; + border-left: none; +} diff --git a/tools/EditTextVariations/assets/Theme_Holo.css b/tools/EditTextVariations/assets/Theme_Holo.css new file mode 100644 index 000000000..a3afe2e00 --- /dev/null +++ b/tools/EditTextVariations/assets/Theme_Holo.css @@ -0,0 +1,56 @@ + + +body { + background-color: #16191C; +} +div.placeholder { + color: #808080; + font-size: 18px; + margin: 0px 0px -34px 0px; + padding: 4px 0px 4px 0px +} +div.input { + border: none; + margin: 4px 0px 4px -8px; +} +input { + color: white; + background-color: rgba(0, 0, 0, 0.0); + font-size: 18px; + line-height: 180%; + vertical-align: center; + padding-left: 8px; + border-top: none; + border-right: none; + border-bottom: 1px solid #5E6063; + border-left: none; +} +textarea { + color: white; + background-color: rgba(0, 0, 0, 0.0); + font-size: 18px; + line-height: 150%; + vertical-align: center; + padding-left: 8px; + border-top: none; + border-right: none; + border-bottom: 1px solid #5E6063; + border-left: none; +} diff --git a/tools/EditTextVariations/assets/Theme_Holo_Light.css b/tools/EditTextVariations/assets/Theme_Holo_Light.css new file mode 100644 index 000000000..fb3a83c69 --- /dev/null +++ b/tools/EditTextVariations/assets/Theme_Holo_Light.css @@ -0,0 +1,56 @@ + + +body { + background-color: #F2F2F2; +} +div.placeholder { + color: #808080; + font-size: 18px; + margin: 0px 0px -34px 0px; + padding: 4px 0px 4px 0px +} +div.input { + border: none; + margin: 4px 0px 4px -8px; +} +input { + color: black; + background-color: rgba(0, 0, 0, 0.0); + font-size: 18px; + line-height: 150%; + vertical-align: center; + padding-left: 8px; + border-top: none; + border-right: none; + border-bottom: 1px solid #808080; + border-left: none; +} +textarea { + color: black; + background-color: rgba(0, 0, 0, 0.0); + font-size: 18px; + line-height: 150%; + vertical-align: center; + padding-left: 8px; + border-top: none; + border-right: none; + border-bottom: 1px solid #808080; + border-left: none; +} diff --git a/tools/EditTextVariations/assets/Theme_Light.css b/tools/EditTextVariations/assets/Theme_Light.css new file mode 100644 index 000000000..4cce0a002 --- /dev/null +++ b/tools/EditTextVariations/assets/Theme_Light.css @@ -0,0 +1,56 @@ + + +body { + background-color: #f3f3f3; +} +div.placeholder { + color: #a0a0a0; + font-size: 18px; + margin: 0px 0px -34px 0px; + padding: 4px 0px 4px 0px +} +div.input { + border: none; + margin: 4px 0px 4px -8px; +} +input { + color: black; + background-color: rgba(0, 0, 0, 0.0); + font-size: 18px; + line-height: 200%; + vertical-align: center; + padding-left: 8px; + border-top: 1px solid #808080; + border-right: 1px solid rgba(0, 0, 0, 0.5); + border-bottom: 1px solid #808080; + border-left: 1px solid rgba(0, 0, 0, 0.5); +} +textarea { + color: black; + background-color: rgba(0, 0, 0, 0.0); + font-size: 18px; + line-height: 150%; + vertical-align: center; + padding-left: 8px; + border-top: 1px solid #808080; + border-right: 1px solid rgba(0, 0, 0, 0.5); + border-bottom: 1px solid #808080; + border-left: 1px solid rgba(0, 0, 0, 0.5); +} diff --git a/tools/EditTextVariations/assets/Theme_Material.css b/tools/EditTextVariations/assets/Theme_Material.css new file mode 100644 index 000000000..3581a8824 --- /dev/null +++ b/tools/EditTextVariations/assets/Theme_Material.css @@ -0,0 +1,56 @@ + + +body { + background-color: #212121; +} +div.placeholder { + color: #909090; + font-size: 18px; + margin: 0px 0px -34px 0px; + padding: 4px 0px 4px 0px +} +div.input { + border: none; + margin: 4px 0px 4px -8px; +} +input { + color: white; + background-color: rgba(0, 0, 0, 0.0); + font-size: 18px; + line-height: 180%; + vertical-align: center; + padding-left: 8px; + border-top: none; + border-right: none; + border-bottom: 1px solid #757575; + border-left: none; +} +textarea { + color: white; + background-color: rgba(0, 0, 0, 0.0); + font-size: 18px; + line-height: 150%; + vertical-align: center; + padding-left: 8px; + border-top: none; + border-right: none; + border-bottom: 1px solid #757575; + border-left: none; +} diff --git a/tools/EditTextVariations/assets/Theme_Material_Light.css b/tools/EditTextVariations/assets/Theme_Material_Light.css new file mode 100644 index 000000000..1a78a2d4a --- /dev/null +++ b/tools/EditTextVariations/assets/Theme_Material_Light.css @@ -0,0 +1,56 @@ + + +body { + background-color: #FAFAFA; +} +div.placeholder { + color: #7D7D7D; + font-size: 18px; + margin: 0px 0px -34px 0px; + padding: 4px 0px 4px 0px +} +div.input { + border: none; + margin: 4px 0px 4px -8px; +} +input { + color: white; + background-color: rgba(0, 0, 0, 0.0); + font-size: 18px; + line-height: 180%; + vertical-align: center; + padding-left: 8px; + border-top: none; + border-right: none; + border-bottom: 1px solid #737373; + border-left: none; +} +textarea { + color: white; + background-color: rgba(0, 0, 0, 0.0); + font-size: 18px; + line-height: 150%; + vertical-align: center; + padding-left: 8px; + border-top: none; + border-right: none; + border-bottom: 1px solid #737373; + border-left: none; +} diff --git a/tools/EditTextVariations/assets/webview.html b/tools/EditTextVariations/assets/webview.html new file mode 100644 index 000000000..daf0fdb73 --- /dev/null +++ b/tools/EditTextVariations/assets/webview.html @@ -0,0 +1,96 @@ + + + + + + + +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ + diff --git a/tools/EditTextVariations/res/drawable-hdpi/ic_launcher.png b/tools/EditTextVariations/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 000000000..e0923a605 Binary files /dev/null and b/tools/EditTextVariations/res/drawable-hdpi/ic_launcher.png differ diff --git a/tools/EditTextVariations/res/drawable-mdpi/ic_launcher.png b/tools/EditTextVariations/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 000000000..9bc091481 Binary files /dev/null and b/tools/EditTextVariations/res/drawable-mdpi/ic_launcher.png differ diff --git a/tools/EditTextVariations/res/drawable-xhdpi/ic_launcher.png b/tools/EditTextVariations/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 000000000..d60ac3dc0 Binary files /dev/null and b/tools/EditTextVariations/res/drawable-xhdpi/ic_launcher.png differ diff --git a/tools/EditTextVariations/res/drawable-xxhdpi/ic_launcher.png b/tools/EditTextVariations/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..f3069d74f Binary files /dev/null and b/tools/EditTextVariations/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/tools/EditTextVariations/res/layout/main.xml b/tools/EditTextVariations/res/layout/main.xml new file mode 100644 index 000000000..99abfb07e --- /dev/null +++ b/tools/EditTextVariations/res/layout/main.xml @@ -0,0 +1,298 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/EditTextVariations/res/values-v11/donottranslate.xml b/tools/EditTextVariations/res/values-v11/donottranslate.xml new file mode 100644 index 000000000..5b7eb23fc --- /dev/null +++ b/tools/EditTextVariations/res/values-v11/donottranslate.xml @@ -0,0 +1,23 @@ + + + + + Theme_Holo_Light + diff --git a/tools/EditTextVariations/res/values-v14/themes.xml b/tools/EditTextVariations/res/values-v14/themes.xml new file mode 100644 index 000000000..22c6016ff --- /dev/null +++ b/tools/EditTextVariations/res/values-v14/themes.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/tools/EditTextVariations/res/values/countries.xml b/tools/EditTextVariations/res/values/countries.xml new file mode 100644 index 000000000..6d7e5c137 --- /dev/null +++ b/tools/EditTextVariations/res/values/countries.xml @@ -0,0 +1,263 @@ + + + + + + + Afghanistan + Albania + Algeria + American Samoa + Andorra + Angola + Anguilla + Antarctica + Antigua and Barbuda + Argentina + Armenia + Aruba + Australia + Austria + Azerbaijan + Bahrain + Bangladesh + Barbados + Belarus + Belgium + Belize + Benin + Bermuda + Bhutan + Bolivia + Bosnia and Herzegovina + Botswana + Bouvet Island + Brazil + British Indian Ocean Territory + British Virgin Islands + Brunei + Bulgaria + Burkina Faso + Burundi + "Cote d'Ivoire" + Cambodia + Cameroon + Canada + Cape Verde + Cayman Islands + Central African Republic + Chad + Chile + China + Christmas Island + Cocos (Keeling) Islands + Colombia + Comoros + Congo + Cook Islands + Costa Rica + Croatia + Cuba + Cyprus + Czech Republic + Democratic Republic of the Congo + Denmark + Djibouti + Dominica + Dominican Republic + East Timor + Ecuador + Egypt + El Salvador + Equatorial Guinea + Eritrea + Estonia + Ethiopia + Faeroe Islands + Falkland Islands + Fiji + Finland + Republic of Macedonia + France + French Guiana + French Polynesia + French Southern Territories + Gabon + Georgia + Germany + Ghana + Gibraltar + Greece + Greenland + Grenada + Guadeloupe + Guam + Guatemala + Guinea + Guinea-Bissau + Guyana + Haiti + Heard Island and McDonald Islands + Honduras + Hong Kong + Hungary + Iceland + India + Indonesia + Iran + Iraq + Ireland + Israel + Italy + Jamaica + Japan + Jordan + Kazakhstan + Kenya + Kiribati + Kuwait + Kyrgyzstan + Laos + Latvia + Lebanon + Lesotho + Liberia + Libya + Liechtenstein + Lithuania + Luxembourg + Macau + Madagascar + Malawi + Malaysia + Maldives + Mali + Malta + Marshall Islands + Martinique + Mauritania + Mauritius + Mayotte + Mexico + Micronesia + Moldova + Monaco + Mongolia + Montserrat + Morocco + Mozambique + Myanmar + Namibia + Nauru + Nepal + Netherlands + Netherlands Antilles + New Caledonia + New Zealand + Nicaragua + Niger + Nigeria + Niue + Norfolk Island + North Korea + Northern Marianas + Norway + Oman + Pakistan + Palau + Panama + Papua New Guinea + Paraguay + Peru + Philippines + Pitcairn Islands + Poland + Portugal + Puerto Rico + Qatar + Reunion + Romania + Russia + Rwanda + Sao Tome and Principe + Saint Helena + Saint Kitts and Nevis + Saint Lucia + Saint Pierre and Miquelon + Saint Vincent and the Grenadines + Samoa + San Marino + Saudi Arabia + Senegal + Seychelles + Sierra Leone + Singapore + Slovakia + Slovenia + Solomon Islands + Somalia + South Africa + South Georgia and the South Sandwich Islands + South Korea + Spain + Sri Lanka + Sudan + Suriname + Svalbard and Jan Mayen + Swaziland + Sweden + Switzerland + Syria + Taiwan + Tajikistan + Tanzania + Thailand + The Bahamas + The Gambia + Togo + Tokelau + Tonga + Trinidad and Tobago + Tunisia + Turkey + Turkmenistan + Turks and Caicos Islands + Tuvalu + Virgin Islands + Uganda + Ukraine + United Arab Emirates + United Kingdom + United States + United States Minor Outlying Islands + Uruguay + Uzbekistan + Vanuatu + Vatican City + Venezuela + Vietnam + Wallis and Futuna + Western Sahara + Yemen + Zambia + Zimbabwe + Yemen + + diff --git a/tools/EditTextVariations/res/values/strings.xml b/tools/EditTextVariations/res/values/strings.xml new file mode 100644 index 000000000..02387f2ff --- /dev/null +++ b/tools/EditTextVariations/res/values/strings.xml @@ -0,0 +1,38 @@ + + + + + + EditTextVariations + + Change Theme + + Version %s + + Navigate On + + Navigate Off + + Keyboard Visible + + Keyboard Hidden + + Custom + diff --git a/tools/EditTextVariations/res/values/themes.xml b/tools/EditTextVariations/res/values/themes.xml new file mode 100644 index 000000000..036a7111b --- /dev/null +++ b/tools/EditTextVariations/res/values/themes.xml @@ -0,0 +1,23 @@ + + + + +