diff options
Diffstat (limited to 'tests')
22 files changed, 265 insertions, 76 deletions
diff --git a/tests/AndroidTests/src/com/android/unit_tests/SearchManagerTest.java b/tests/AndroidTests/src/com/android/unit_tests/SearchManagerTest.java index 4c5fefc..e48a57b 100644 --- a/tests/AndroidTests/src/com/android/unit_tests/SearchManagerTest.java +++ b/tests/AndroidTests/src/com/android/unit_tests/SearchManagerTest.java @@ -23,14 +23,11 @@ import android.app.ISearchManager; import android.app.SearchManager; import android.content.ComponentName; import android.content.Context; -import android.os.Bundle; -import android.os.RemoteException; import android.os.ServiceManager; import android.server.search.SearchableInfo; import android.test.ActivityInstrumentationTestCase2; import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.MediumTest; -import android.util.AndroidRuntimeException; /** * To launch this test from the command line: @@ -98,22 +95,6 @@ public class SearchManagerTest extends ActivityInstrumentationTestCase2<LocalAct ServiceManager.getService(Context.SEARCH_SERVICE)); } - // Checks that the search UI is visible. - private void assertSearchVisible() { - SearchManager searchManager = (SearchManager) - mContext.getSystemService(Context.SEARCH_SERVICE); - assertTrue("SearchManager thinks search UI isn't visible when it should be", - searchManager.isVisible()); - } - - // Checks that the search UI is not visible. - private void assertSearchNotVisible() { - SearchManager searchManager = (SearchManager) - mContext.getSystemService(Context.SEARCH_SERVICE); - assertFalse("SearchManager thinks search UI is visible when it shouldn't be", - searchManager.isVisible()); - } - /** * The goal of this test is to confirm that we can obtain * a search manager interface. @@ -157,57 +138,34 @@ public class SearchManagerTest extends ActivityInstrumentationTestCase2<LocalAct } /** - * Tests that rapid calls to start-stop-start doesn't cause problems. - */ - @MediumTest - public void testSearchManagerFastInvocations() throws Exception { - SearchManager searchManager = (SearchManager) - mContext.getSystemService(Context.SEARCH_SERVICE); - assertNotNull(searchManager); - assertSearchNotVisible(); - - searchManager.startSearch(null, false, SEARCHABLE_ACTIVITY, null, false); - assertSearchVisible(); - searchManager.stopSearch(); - searchManager.startSearch(null, false, SEARCHABLE_ACTIVITY, null, false); - searchManager.stopSearch(); - assertSearchNotVisible(); - } - - /** - * Tests that startSearch() is idempotent. + * Tests that startSearch() can be called multiple times without stopSearch() + * in between. */ @MediumTest public void testStartSearchIdempotent() throws Exception { SearchManager searchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE); assertNotNull(searchManager); - assertSearchNotVisible(); searchManager.startSearch(null, false, SEARCHABLE_ACTIVITY, null, false); searchManager.startSearch(null, false, SEARCHABLE_ACTIVITY, null, false); - assertSearchVisible(); searchManager.stopSearch(); - assertSearchNotVisible(); } /** - * Tests that stopSearch() is idempotent and can be called when the search UI is not visible. + * Tests that stopSearch() can be called when the search UI is not visible and can be + * called multiple times without startSearch() in between. */ @MediumTest public void testStopSearchIdempotent() throws Exception { SearchManager searchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE); assertNotNull(searchManager); - assertSearchNotVisible(); searchManager.stopSearch(); - assertSearchNotVisible(); searchManager.startSearch(null, false, SEARCHABLE_ACTIVITY, null, false); - assertSearchVisible(); searchManager.stopSearch(); searchManager.stopSearch(); - assertSearchNotVisible(); } /** @@ -219,28 +177,19 @@ public class SearchManagerTest extends ActivityInstrumentationTestCase2<LocalAct SearchManager searchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE); assertNotNull(searchManager); - assertSearchNotVisible(); // These tests should simply run to completion w/o exceptions searchManager.startSearch(null, false, SEARCHABLE_ACTIVITY, null, false); - assertSearchVisible(); searchManager.stopSearch(); - assertSearchNotVisible(); searchManager.startSearch("", false, SEARCHABLE_ACTIVITY, null, false); - assertSearchVisible(); searchManager.stopSearch(); - assertSearchNotVisible(); searchManager.startSearch("test search string", false, SEARCHABLE_ACTIVITY, null, false); - assertSearchVisible(); searchManager.stopSearch(); - assertSearchNotVisible(); searchManager.startSearch("test search string", true, SEARCHABLE_ACTIVITY, null, false); - assertSearchVisible(); searchManager.stopSearch(); - assertSearchNotVisible(); } } diff --git a/tests/AndroidTests/src/com/android/unit_tests/VpnTest.java b/tests/AndroidTests/src/com/android/unit_tests/VpnTest.java index 7dc1314..67fcd61 100755 --- a/tests/AndroidTests/src/com/android/unit_tests/VpnTest.java +++ b/tests/AndroidTests/src/com/android/unit_tests/VpnTest.java @@ -16,10 +16,22 @@ package com.android.unit_tests; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.net.vpn.L2tpProfile; import android.net.vpn.L2tpIpsecProfile; +import android.net.vpn.L2tpIpsecPskProfile; +import android.net.vpn.PptpProfile; +import android.net.vpn.VpnManager; +import android.net.vpn.VpnProfile; +import android.net.vpn.VpnState; import android.net.vpn.VpnType; +import android.os.ConditionVariable; +import android.os.Parcel; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; +import android.text.TextUtils; /** * Unit test class to test VPN api @@ -29,6 +41,12 @@ import android.test.suitebuilder.annotation.SmallTest; * -w com.android.unit_tests/android.test.InstrumentationTestRunner */ public class VpnTest extends AndroidTestCase { + private static final String NAME = "a name"; + private static final String SERVER_NAME = "a server name"; + private static final String ID = "some id"; + private static final String SUFFICES = "some suffices"; + private static final String ROUTES = "some routes"; + private static final String SAVED_NAME = "some name"; @Override public void setUp() { @@ -39,8 +57,102 @@ public class VpnTest extends AndroidTestCase { } @SmallTest + public void testVpnType() { + testVpnType(VpnType.L2TP); + testVpnType(VpnType.L2TP_IPSEC); + testVpnType(VpnType.L2TP_IPSEC_PSK); + testVpnType(VpnType.PPTP); + } + + @SmallTest + public void testVpnProfile() { + VpnState state = VpnState.CONNECTING; + testVpnProfile(createTestProfile(state), state); + } + + @SmallTest public void testGetType() { - L2tpIpsecProfile li = new L2tpIpsecProfile(); - assertTrue(VpnType.L2TP_IPSEC== li.getType()); + assertEquals(VpnType.L2TP, new L2tpProfile().getType()); + assertEquals(VpnType.L2TP_IPSEC, new L2tpIpsecProfile().getType()); + assertEquals(VpnType.L2TP_IPSEC_PSK, + new L2tpIpsecPskProfile().getType()); + assertEquals(VpnType.PPTP, new PptpProfile().getType()); + } + + @SmallTest + public void testVpnTypes() { + assertTrue(VpnManager.getSupportedVpnTypes().length > 0); + } + + @SmallTest + public void testGetTypeFromManager() { + VpnManager m = new VpnManager(getContext()); + VpnType[] types = VpnManager.getSupportedVpnTypes(); + for (VpnType t : types) { + assertEquals(t, m.createVpnProfile(t).getType()); + } + } + + @SmallTest + public void testParcelable() { + VpnProfile p = createTestProfile(VpnState.CONNECTED); + Parcel parcel = Parcel.obtain(); + p.writeToParcel(parcel, 0); + parcel.setDataPosition(0); + + // VpnState is transient and not saved in the parcel + testVpnProfile(VpnProfile.CREATOR.createFromParcel(parcel), null); + } + + @SmallTest + public void testReceiver() { + final String profileName = "whatever"; + final VpnState state = VpnState.DISCONNECTING; + final ConditionVariable cv = new ConditionVariable(); + cv.close(); + BroadcastReceiver r = new BroadcastReceiver() { + public void onReceive(Context c, Intent i) { + assertEquals(profileName, + i.getStringExtra(VpnManager.BROADCAST_PROFILE_NAME)); + assertEquals(state, i.getSerializableExtra( + VpnManager.BROADCAST_CONNECTION_STATE)); + cv.open(); + } + }; + + VpnManager m = new VpnManager(getContext()); + m.registerConnectivityReceiver(r); + m.broadcastConnectivity(profileName, state); + + // fail it if onReceive() doesn't get executed in 5 sec + assertTrue(cv.block(5000)); + } + + private void testVpnType(VpnType type) { + assertFalse(TextUtils.isEmpty(type.getDisplayName())); + assertNotNull(type.getDescription()); + assertNotNull(type.getProfileClass()); + } + + private VpnProfile createTestProfile(VpnState state) { + VpnProfile p = new L2tpProfile(); + p.setName(NAME); + p.setServerName(SERVER_NAME); + p.setId(ID); + p.setDomainSuffices(SUFFICES); + p.setRouteList(ROUTES); + p.setSavedUsername(SAVED_NAME); + p.setState(state); + return p; + } + + private void testVpnProfile(VpnProfile p, VpnState state) { + assertEquals(NAME, p.getName()); + assertEquals(SERVER_NAME, p.getServerName()); + assertEquals(ID, p.getId()); + assertEquals(SUFFICES, p.getDomainSuffices()); + assertEquals(ROUTES, p.getRouteList()); + assertEquals(SAVED_NAME, p.getSavedUsername()); + if (state != null) assertEquals(state, p.getState()); } } diff --git a/tests/CoreTests/android/AndroidManifest.xml b/tests/CoreTests/android/AndroidManifest.xml index 4809f844..98cc9e5 100644 --- a/tests/CoreTests/android/AndroidManifest.xml +++ b/tests/CoreTests/android/AndroidManifest.xml @@ -30,6 +30,7 @@ <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/> <uses-permission android:name="android.permission.WRITE_SETTINGS"/> <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <application> <uses-library android:name="android.test.runner" /> diff --git a/tests/CoreTests/android/core/CryptoTest.java b/tests/CoreTests/android/core/CryptoTest.java index f00d49f..e6e50ec 100644 --- a/tests/CoreTests/android/core/CryptoTest.java +++ b/tests/CoreTests/android/core/CryptoTest.java @@ -22,7 +22,6 @@ import junit.framework.TestCase; import org.apache.harmony.xnet.provider.jsse.OpenSSLMessageDigest; import org.bouncycastle.crypto.Digest; import org.bouncycastle.crypto.ExtendedDigest; -import org.bouncycastle.crypto.digests.MD2Digest; import org.bouncycastle.crypto.digests.MD4Digest; import org.bouncycastle.crypto.digests.MD5Digest; import org.bouncycastle.crypto.digests.SHA1Digest; @@ -93,16 +92,6 @@ public class CryptoTest extends TestCase { // Assert.assertTrue("New hash should be faster", newTime < oldTime); } - - /** - * Tests the MD2 implementation. - */ - @LargeTest - public void testMD2() { - Digest oldDigest = new MD2Digest(); - Digest newDigest = OpenSSLMessageDigest.getInstance("MD2"); - doTestMessageDigest(oldDigest, newDigest); - } /** * Tests the MD4 implementation. diff --git a/tests/CoreTests/android/database/MatrixCursorTest.java b/tests/CoreTests/android/database/MatrixCursorTest.java index fb8a12f..cddc6c4 100644 --- a/tests/CoreTests/android/database/MatrixCursorTest.java +++ b/tests/CoreTests/android/database/MatrixCursorTest.java @@ -32,6 +32,12 @@ public class MatrixCursorTest extends TestCase { cursor.newRow().add(null); cursor.moveToNext(); assertTrue(cursor.isNull(0)); + assertNull(cursor.getString(0)); + assertEquals(0, cursor.getShort(0)); + assertEquals(0, cursor.getInt(0)); + assertEquals(0L, cursor.getLong(0)); + assertEquals(0.0f, cursor.getFloat(0)); + assertEquals(0.0d, cursor.getDouble(0)); } public void testMatrixCursor() { diff --git a/tests/DpiTest/res/drawable-hdpi/npatch240dpi.9.png b/tests/DpiTest/res/drawable-hdpi/npatch240dpi.9.png Binary files differnew file mode 100644 index 0000000..a362b0f --- /dev/null +++ b/tests/DpiTest/res/drawable-hdpi/npatch240dpi.9.png diff --git a/tests/DpiTest/res/drawable-hdpi/reslogo240dpi.png b/tests/DpiTest/res/drawable-hdpi/reslogo240dpi.png Binary files differnew file mode 100644 index 0000000..4d717a8 --- /dev/null +++ b/tests/DpiTest/res/drawable-hdpi/reslogo240dpi.png diff --git a/tests/DpiTest/res/drawable-hdpi/smlnpatch240dpi.9.png b/tests/DpiTest/res/drawable-hdpi/smlnpatch240dpi.9.png Binary files differnew file mode 100644 index 0000000..84bdcb0 --- /dev/null +++ b/tests/DpiTest/res/drawable-hdpi/smlnpatch240dpi.9.png diff --git a/tests/DpiTest/res/drawable-hdpi/stylogo240dpi.png b/tests/DpiTest/res/drawable-hdpi/stylogo240dpi.png Binary files differnew file mode 100644 index 0000000..4d717a8 --- /dev/null +++ b/tests/DpiTest/res/drawable-hdpi/stylogo240dpi.png diff --git a/tests/DpiTest/res/drawable-ldpi/npatch120dpi.9.png b/tests/DpiTest/res/drawable-ldpi/npatch120dpi.9.png Binary files differnew file mode 100644 index 0000000..0d8115b --- /dev/null +++ b/tests/DpiTest/res/drawable-ldpi/npatch120dpi.9.png diff --git a/tests/DpiTest/res/drawable-ldpi/reslogo120dpi.png b/tests/DpiTest/res/drawable-ldpi/reslogo120dpi.png Binary files differnew file mode 100644 index 0000000..46bbd5b --- /dev/null +++ b/tests/DpiTest/res/drawable-ldpi/reslogo120dpi.png diff --git a/tests/DpiTest/res/drawable-ldpi/smlnpatch120dpi.9.png b/tests/DpiTest/res/drawable-ldpi/smlnpatch120dpi.9.png Binary files differnew file mode 100644 index 0000000..de8d607 --- /dev/null +++ b/tests/DpiTest/res/drawable-ldpi/smlnpatch120dpi.9.png diff --git a/tests/DpiTest/res/drawable-ldpi/stylogo120dpi.png b/tests/DpiTest/res/drawable-ldpi/stylogo120dpi.png Binary files differnew file mode 100644 index 0000000..46bbd5b --- /dev/null +++ b/tests/DpiTest/res/drawable-ldpi/stylogo120dpi.png diff --git a/tests/DpiTest/res/drawable/npatch160dpi.9.png b/tests/DpiTest/res/drawable/npatch160dpi.9.png Binary files differnew file mode 100644 index 0000000..44d89a9 --- /dev/null +++ b/tests/DpiTest/res/drawable/npatch160dpi.9.png diff --git a/tests/DpiTest/res/drawable/reslogo160dpi.png b/tests/DpiTest/res/drawable/reslogo160dpi.png Binary files differnew file mode 100644 index 0000000..c23b2ce --- /dev/null +++ b/tests/DpiTest/res/drawable/reslogo160dpi.png diff --git a/tests/DpiTest/res/drawable/smlnpatch160dpi.9.png b/tests/DpiTest/res/drawable/smlnpatch160dpi.9.png Binary files differnew file mode 100644 index 0000000..76c4ae8 --- /dev/null +++ b/tests/DpiTest/res/drawable/smlnpatch160dpi.9.png diff --git a/tests/DpiTest/res/drawable/stylogo160dpi.png b/tests/DpiTest/res/drawable/stylogo160dpi.png Binary files differnew file mode 100644 index 0000000..c23b2ce --- /dev/null +++ b/tests/DpiTest/res/drawable/stylogo160dpi.png diff --git a/tests/DpiTest/res/layout/image_views.xml b/tests/DpiTest/res/layout/image_views.xml new file mode 100644 index 0000000..6a91497 --- /dev/null +++ b/tests/DpiTest/res/layout/image_views.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2009 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. +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="horizontal" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/reslogo120dpi" /> + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/reslogo160dpi" /> + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/reslogo240dpi" /> + +</LinearLayout> diff --git a/tests/DpiTest/res/layout/styled_image_views.xml b/tests/DpiTest/res/layout/styled_image_views.xml new file mode 100644 index 0000000..86c63bf --- /dev/null +++ b/tests/DpiTest/res/layout/styled_image_views.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2009 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. +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="horizontal" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> + + <ImageView style="@style/ImageView120dpi" /> + <ImageView style="@style/ImageView160dpi" /> + <ImageView style="@style/ImageView240dpi" /> + +</LinearLayout> diff --git a/tests/DpiTest/res/values/styles.xml b/tests/DpiTest/res/values/styles.xml new file mode 100644 index 0000000..bb4b13c --- /dev/null +++ b/tests/DpiTest/res/values/styles.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2009 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. +--> + +<resources> + <style name="ImageView120dpi"> + <item name="android:src">@drawable/stylogo120dpi</item> + <item name="android:layout_width">wrap_content</item> + <item name="android:layout_height">wrap_content</item> + </style> + + <style name="ImageView160dpi"> + <item name="android:src">@drawable/stylogo160dpi</item> + <item name="android:layout_width">wrap_content</item> + <item name="android:layout_height">wrap_content</item> + </style> + + <style name="ImageView240dpi"> + <item name="android:src">@drawable/stylogo240dpi</item> + <item name="android:layout_width">wrap_content</item> + <item name="android:layout_height">wrap_content</item> + </style> +</resources> diff --git a/tests/DpiTest/src/com/google/android/test/dpi/DpiTestActivity.java b/tests/DpiTest/src/com/google/android/test/dpi/DpiTestActivity.java index 49fff57..ae53b76 100644 --- a/tests/DpiTest/src/com/google/android/test/dpi/DpiTestActivity.java +++ b/tests/DpiTest/src/com/google/android/test/dpi/DpiTestActivity.java @@ -28,12 +28,14 @@ import android.graphics.drawable.Drawable; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.ScrollView; +import android.view.LayoutInflater; import android.view.View; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.res.CompatibilityInfo; import android.util.DisplayMetrics; +import android.util.Log; public class DpiTestActivity extends Activity { public DpiTestActivity() { @@ -52,14 +54,13 @@ public class DpiTestActivity extends Activity { // be doing it. Application app = ActivityThread.currentActivityThread().getApplication(); ApplicationInfo ai = app.getPackageManager().getApplicationInfo( - "com.google.android.test.dpi", - PackageManager.GET_SUPPORTS_DENSITIES); + "com.google.android.test.dpi", 0); if (noCompat) { ai.flags |= ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS | ApplicationInfo.FLAG_SUPPORTS_NORMAL_SCREENS | ApplicationInfo.FLAG_SUPPORTS_SMALL_SCREENS - | ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS; - ai.supportsDensities = new int[] { ApplicationInfo.ANY_DENSITY }; + | ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS + | ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES; app.getResources().setCompatibilityInfo(new CompatibilityInfo(ai)); } } catch (PackageManager.NameNotFoundException e) { @@ -71,6 +72,9 @@ public class DpiTestActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + final LayoutInflater li = (LayoutInflater)getSystemService( + LAYOUT_INFLATER_SERVICE); + this.setTitle(R.string.act_title); LinearLayout root = new LinearLayout(this); root.setOrientation(LinearLayout.VERTICAL); @@ -96,6 +100,14 @@ public class DpiTestActivity extends Activity { addLabelToRoot(root, "Prescaled resource drawable"); addChildToRoot(root, layout); + layout = (LinearLayout)li.inflate(R.layout.image_views, null); + addLabelToRoot(root, "Inflated layout"); + addChildToRoot(root, layout); + + layout = (LinearLayout)li.inflate(R.layout.styled_image_views, null); + addLabelToRoot(root, "Inflated styled layout"); + addChildToRoot(root, layout); + layout = new LinearLayout(this); addCanvasBitmap(layout, R.drawable.logo120dpi, true); addCanvasBitmap(layout, R.drawable.logo160dpi, true); @@ -117,6 +129,13 @@ public class DpiTestActivity extends Activity { addLabelToRoot(root, "No-dpi resource drawable"); addChildToRoot(root, layout); + layout = new LinearLayout(this); + addNinePatchResourceDrawable(layout, R.drawable.smlnpatch120dpi); + addNinePatchResourceDrawable(layout, R.drawable.smlnpatch160dpi); + addNinePatchResourceDrawable(layout, R.drawable.smlnpatch240dpi); + addLabelToRoot(root, "Prescaled 9-patch resource drawable"); + addChildToRoot(root, layout); + setContentView(scrollWrap(root)); } @@ -145,8 +164,8 @@ public class DpiTestActivity extends Activity { View view = new View(this); - final BitmapDrawable d = new BitmapDrawable(bitmap); - if (!scale) d.setDensityScale(getResources().getDisplayMetrics()); + final BitmapDrawable d = new BitmapDrawable(getResources(), bitmap); + if (!scale) d.setTargetDensity(getResources().getDisplayMetrics()); view.setBackgroundDrawable(d); view.setLayoutParams(new LinearLayout.LayoutParams(d.getIntrinsicWidth(), @@ -176,6 +195,19 @@ public class DpiTestActivity extends Activity { layout.addView(view); } + private void addNinePatchResourceDrawable(LinearLayout layout, int resource) { + View view = new View(this); + + final Drawable d = getResources().getDrawable(resource); + view.setBackgroundDrawable(d); + + Log.i("foo", "9-patch #" + Integer.toHexString(resource) + + " w=" + d.getIntrinsicWidth() + " h=" + d.getIntrinsicHeight()); + view.setLayoutParams(new LinearLayout.LayoutParams( + d.getIntrinsicWidth()*2, d.getIntrinsicHeight()*2)); + layout.addView(view); + } + private Bitmap loadAndPrintDpi(int id, boolean scale) { Bitmap bitmap; if (scale) { diff --git a/tests/FrameworkTest/tests/src/android/widget/AutoCompleteTextViewCallbacks.java b/tests/FrameworkTest/tests/src/android/widget/AutoCompleteTextViewCallbacks.java index 93cb84a..515ddba 100644 --- a/tests/FrameworkTest/tests/src/android/widget/AutoCompleteTextViewCallbacks.java +++ b/tests/FrameworkTest/tests/src/android/widget/AutoCompleteTextViewCallbacks.java @@ -27,8 +27,10 @@ public class AutoCompleteTextViewCallbacks super("com.android.frameworktest", AutoCompleteTextViewSimple.class); } - /** Test that the initial popup of the suggestions does not select anything */ - @MediumTest + /** Test that the initial popup of the suggestions does not select anything. + * + * TODO: test currently fails. Add back MediumTest annotation when fixed. + */ public void testPopupNoSelection() { AutoCompleteTextViewSimple theActivity = getActivity(); AutoCompleteTextView textView = theActivity.getTextView(); |