summaryrefslogtreecommitdiffstats
path: root/core/tests/coretests
diff options
context:
space:
mode:
authorAdam Powell <adamp@android.com>2012-10-23 15:01:43 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-10-23 15:01:43 -0700
commita23f69a8782e0edeff815cfb5275f2864fc1d19e (patch)
treeff2e1cc77e967aa983b8786b1834d785653c22a8 /core/tests/coretests
parent265fcd2f85679ddbb2c89d6d517b4a55c1c7306e (diff)
parent86e0d95de1007d339af467c1484b09878ee528fc (diff)
downloadframeworks_base-a23f69a8782e0edeff815cfb5275f2864fc1d19e.zip
frameworks_base-a23f69a8782e0edeff815cfb5275f2864fc1d19e.tar.gz
frameworks_base-a23f69a8782e0edeff815cfb5275f2864fc1d19e.tar.bz2
am 86e0d95d: Merge "Reattach header view after DPAD scroll."
* commit '86e0d95de1007d339af467c1484b09878ee528fc': Reattach header view after DPAD scroll.
Diffstat (limited to 'core/tests/coretests')
-rw-r--r--core/tests/coretests/src/android/widget/listview/focus/ListWithEditTextHeaderTest.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/core/tests/coretests/src/android/widget/listview/focus/ListWithEditTextHeaderTest.java b/core/tests/coretests/src/android/widget/listview/focus/ListWithEditTextHeaderTest.java
index b9051e9..532b9d1 100644
--- a/core/tests/coretests/src/android/widget/listview/focus/ListWithEditTextHeaderTest.java
+++ b/core/tests/coretests/src/android/widget/listview/focus/ListWithEditTextHeaderTest.java
@@ -22,6 +22,7 @@ import android.test.TouchUtils;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.KeyEvent;
+import android.view.View;
import android.widget.AbsListView;
import android.widget.ListView;
import android.widget.listview.ListWithEditTextHeader;
@@ -63,4 +64,22 @@ public class ListWithEditTextHeaderTest extends ActivityInstrumentationTestCase2
assertTrue("header does not have focus", mListView.getChildAt(0).isFocused());
assertEquals("something is selected", AbsListView.INVALID_POSITION, mListView.getSelectedItemPosition());
}
+
+ @LargeTest
+ public void testScrollingDoesNotDetachHeaderViewFromWindow() {
+ View header = mListView.getChildAt(0);
+ assertNotNull("header is not attached to a window (?!)", header.getWindowToken());
+
+ // Scroll header off the screen and back onto the screen
+ int numItemsOnScreen = mListView.getChildCount();
+ for (int i = 0; i < numItemsOnScreen; i++) {
+ sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
+ }
+ for (int i = 0; i < numItemsOnScreen; i++) {
+ sendKeys(KeyEvent.KEYCODE_DPAD_UP);
+ }
+
+ // Make sure the header was not accidentally left detached from its window
+ assertNotNull("header has lost its window", header.getWindowToken());
+ }
}