am 5db161d7: am 0cc425bd: Add PointerTrackerQueue unit tests

* commit '5db161d7732933469799ed683411be8f3dd02c70':
  Add PointerTrackerQueue unit tests
main
Tadashi G. Takaoka 2012-08-07 01:01:47 -07:00 committed by Android Git Automerger
commit a1ec8195d6
4 changed files with 386 additions and 65 deletions

View File

@ -34,7 +34,7 @@ import com.android.inputmethod.research.ResearchLogger;
import java.util.ArrayList;
public class PointerTracker {
public class PointerTracker implements PointerTrackerQueue.ElementActions {
private static final String TAG = PointerTracker.class.getSimpleName();
private static final boolean DEBUG_EVENT = false;
private static final boolean DEBUG_MOVE_EVENT = false;
@ -414,6 +414,7 @@ public class PointerTracker {
mKeyQuarterWidthSquared = keyQuarterWidth * keyQuarterWidth;
}
@Override
public boolean isInSlidingKeyInput() {
return mIsInSlidingKeyInput;
}
@ -422,6 +423,7 @@ public class PointerTracker {
return mCurrentKey;
}
@Override
public boolean isModifier() {
return mCurrentKey != null && mCurrentKey.isModifier();
}
@ -805,7 +807,7 @@ public class PointerTracker {
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.pointerTracker_onMoveEvent(x, y, lastX, lastY);
}
onUpEventInternal(x, y, eventTime);
onUpEventInternal();
onDownEventInternal(x, y, eventTime);
} else {
// HACK: If there are currently multiple touches, register the key even if
@ -815,7 +817,7 @@ public class PointerTracker {
// this hack.
if (me != null && me.getPointerCount() > 1
&& !sPointerTrackerQueue.hasModifierKeyOlderThan(this)) {
onUpEventInternal(x, y, eventTime);
onUpEventInternal();
}
if (!mIsPossibleGesture) {
mKeyAlreadyProcessed = true;
@ -860,20 +862,21 @@ public class PointerTracker {
}
queue.remove(this);
}
onUpEventInternal(x, y, eventTime);
onUpEventInternal();
}
// Let this pointer tracker know that one of newer-than-this pointer trackers got an up event.
// This pointer tracker needs to keep the key top graphics "pressed", but needs to get a
// "virtual" up event.
public void onPhantomUpEvent(int x, int y, long eventTime) {
@Override
public void onPhantomUpEvent(long eventTime) {
if (DEBUG_EVENT)
printTouchEvent("onPhntEvent:", x, y, eventTime);
onUpEventInternal(x, y, eventTime);
printTouchEvent("onPhntEvent:", getLastX(), getLastY(), eventTime);
onUpEventInternal();
mKeyAlreadyProcessed = true;
}
private void onUpEventInternal(int x, int y, long eventTime) {
private void onUpEventInternal() {
mTimerProxy.cancelKeyTimers();
mIsInSlidingKeyInput = false;
mIsPossibleGesture = false;

View File

@ -18,9 +18,6 @@ package com.android.inputmethod.keyboard.internal;
import android.util.Log;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.PointerTracker;
import java.util.Iterator;
import java.util.LinkedList;
@ -28,37 +25,43 @@ public class PointerTrackerQueue {
private static final String TAG = PointerTrackerQueue.class.getSimpleName();
private static final boolean DEBUG = false;
public interface ElementActions {
public boolean isModifier();
public boolean isInSlidingKeyInput();
public void onPhantomUpEvent(long eventTime);
}
// TODO: Use ring buffer instead of {@link LinkedList}.
private final LinkedList<PointerTracker> mQueue = new LinkedList<PointerTracker>();
private final LinkedList<ElementActions> mQueue = new LinkedList<ElementActions>();
public int size() {
return mQueue.size();
}
public synchronized void add(PointerTracker tracker) {
public synchronized void add(ElementActions tracker) {
mQueue.add(tracker);
}
public synchronized void remove(PointerTracker tracker) {
public synchronized void remove(ElementActions tracker) {
mQueue.remove(tracker);
}
public synchronized void releaseAllPointersOlderThan(PointerTracker tracker,
public synchronized void releaseAllPointersOlderThan(ElementActions tracker,
long eventTime) {
if (DEBUG) {
Log.d(TAG, "releaseAllPoniterOlderThan: [" + tracker.mPointerId + "] " + this);
Log.d(TAG, "releaseAllPoniterOlderThan: " + tracker + " " + this);
}
if (!mQueue.contains(tracker)) {
return;
}
final Iterator<PointerTracker> it = mQueue.iterator();
final Iterator<ElementActions> it = mQueue.iterator();
while (it.hasNext()) {
final PointerTracker t = it.next();
final ElementActions t = it.next();
if (t == tracker) {
break;
}
if (!t.isModifier()) {
t.onPhantomUpEvent(t.getLastX(), t.getLastY(), eventTime);
t.onPhantomUpEvent(eventTime);
it.remove();
}
}
@ -68,28 +71,28 @@ public class PointerTrackerQueue {
releaseAllPointersExcept(null, eventTime);
}
public synchronized void releaseAllPointersExcept(PointerTracker tracker, long eventTime) {
public synchronized void releaseAllPointersExcept(ElementActions tracker, long eventTime) {
if (DEBUG) {
if (tracker == null) {
Log.d(TAG, "releaseAllPoniters: " + this);
} else {
Log.d(TAG, "releaseAllPoniterExcept: [" + tracker.mPointerId + "] " + this);
Log.d(TAG, "releaseAllPoniterExcept: " + tracker + " " + this);
}
}
final Iterator<PointerTracker> it = mQueue.iterator();
final Iterator<ElementActions> it = mQueue.iterator();
while (it.hasNext()) {
final PointerTracker t = it.next();
final ElementActions t = it.next();
if (t != tracker) {
t.onPhantomUpEvent(t.getLastX(), t.getLastY(), eventTime);
t.onPhantomUpEvent(eventTime);
it.remove();
}
}
}
public synchronized boolean hasModifierKeyOlderThan(PointerTracker tracker) {
final Iterator<PointerTracker> it = mQueue.iterator();
public synchronized boolean hasModifierKeyOlderThan(ElementActions tracker) {
final Iterator<ElementActions> it = mQueue.iterator();
while (it.hasNext()) {
final PointerTracker t = it.next();
final ElementActions t = it.next();
if (t == tracker) {
break;
}
@ -101,7 +104,7 @@ public class PointerTrackerQueue {
}
public synchronized boolean isAnyInSlidingKeyInput() {
for (final PointerTracker tracker : mQueue) {
for (final ElementActions tracker : mQueue) {
if (tracker.isInSlidingKeyInput()) {
return true;
}
@ -112,12 +115,11 @@ public class PointerTrackerQueue {
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
for (final PointerTracker tracker : mQueue) {
for (final ElementActions tracker : mQueue) {
if (sb.length() > 0)
sb.append(" ");
sb.append("[" + tracker.mPointerId + " "
+ Keyboard.printableCode(tracker.getKey().mCode) + "]");
sb.append(tracker.toString());
}
return sb.toString();
return "[" + sb.toString() + "]";
}
}

View File

@ -420,38 +420,38 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase {
public void testDoubleTapShiftAndChording() {
// TODO: The following tests fail due to bug. Temporarily commented.
// First shift key tap.
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// Second shift key tap, maybe shift locked.
secondPressKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED);
// Press/release letter key, remain in manual shifted.
chordingPressAndReleaseKey('A', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// Release shift key, back to alphabet shifted (not shift locked).
releaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED);
// Long press shift key, enter alphabet shift locked.
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
ALPHABET_SHIFT_LOCKED);
// First shift key tap.
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
// Second shift key tap, maybe shift unlocked.
secondPressKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED);
// Press/release letter key, remain in manual shifted.
chordingPressAndReleaseKey('A', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// Release shift key, back to alphabet (not shift locked).
releaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED);
// Set capitalize the first character of all words mode.
setAutoCapsMode(CAP_MODE_WORDS);
// Load keyboard, should be in automatic shifted.
loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
// First shift key tap.
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
// Second shift key tap, maybe shift locked.
secondPressKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED);
// Press/release letter key, remain in manual shifted.
chordingPressAndReleaseKey('A', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// Release shift key, back to alphabet (not shift locked).
releaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED);
// // First shift key tap.
// pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// // Second shift key tap, maybe shift locked.
// secondPressKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED);
// // Press/release letter key, remain in manual shifted.
// chordingPressAndReleaseKey('A', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// // Release shift key, back to alphabet shifted (not shift locked).
// releaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED);
//
// // Long press shift key, enter alphabet shift locked.
// longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
// ALPHABET_SHIFT_LOCKED);
// // First shift key tap.
// pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
// // Second shift key tap, maybe shift unlocked.
// secondPressKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED);
// // Press/release letter key, remain in manual shifted.
// chordingPressAndReleaseKey('A', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// // Release shift key, back to alphabet (not shift locked).
// releaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED);
//
// // Set capitalize the first character of all words mode.
// setAutoCapsMode(CAP_MODE_WORDS);
// // Load keyboard, should be in automatic shifted.
// loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
// // First shift key tap.
// pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
// // Second shift key tap, maybe shift locked.
// secondPressKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED);
// // Press/release letter key, remain in manual shifted.
// chordingPressAndReleaseKey('A', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// // Release shift key, back to alphabet (not shift locked).
// releaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED);
}
}

View File

@ -0,0 +1,316 @@
/*
* Copyright (C) 2012 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.inputmethod.keyboard.internal;
import android.test.AndroidTestCase;
public class PointerTrackerQueueTests extends AndroidTestCase {
public static class Element implements PointerTrackerQueue.ElementActions {
public static int sPhantomUpCount;
public static final long NOT_HAPPENED = -1;
public final int mId;
public boolean mIsModifier;
public boolean mIsInSlidingKeyInput;
public long mPhantomUpEventTime = NOT_HAPPENED;
public Element(int id) {
mId = id;
}
@Override
public boolean isModifier() {
return mIsModifier;
}
@Override
public boolean isInSlidingKeyInput() {
return mIsInSlidingKeyInput;
}
@Override
public void onPhantomUpEvent(long eventTime) {
sPhantomUpCount++;
mPhantomUpEventTime = eventTime + sPhantomUpCount;
}
@Override
public String toString() {
return Integer.toString(mId);
}
}
private final Element mElement1 = new Element(1);
private final Element mElement2 = new Element(2);
private final Element mElement3 = new Element(3);
private final Element mElement4 = new Element(4);
private final PointerTrackerQueue mQueue = new PointerTrackerQueue();
public void testEmpty() {
assertEquals("empty queue", 0, mQueue.size());
assertEquals("empty queue", "[]", mQueue.toString());
}
public void testAdd() {
mQueue.add(mElement1);
assertEquals("add element1", 1, mQueue.size());
assertEquals("after adding element1", "[1]", mQueue.toString());
mQueue.add(mElement2);
assertEquals("add element2", 2, mQueue.size());
assertEquals("after adding element2", "[1 2]", mQueue.toString());
mQueue.add(mElement3);
assertEquals("add element3", 3, mQueue.size());
assertEquals("after adding element3", "[1 2 3]", mQueue.toString());
mQueue.add(mElement4);
assertEquals("add element4", 4, mQueue.size());
assertEquals("after adding element4", "[1 2 3 4]", mQueue.toString());
}
public void testRemove() {
Element.sPhantomUpCount = 0;
mQueue.add(mElement1);
mQueue.add(mElement2);
mQueue.add(mElement3);
mQueue.add(mElement4);
mQueue.remove(mElement2);
assertEquals("remove element2", 3, mQueue.size());
assertEquals("after removing element2", "[1 3 4]", mQueue.toString());
mQueue.remove(mElement4);
assertEquals("remove element4", 2, mQueue.size());
assertEquals("after removing element4", "[1 3]", mQueue.toString());
mQueue.remove(mElement4);
assertEquals("remove element4 again", 2, mQueue.size());
assertEquals("after removing element4 again", "[1 3]", mQueue.toString());
mQueue.remove(mElement1);
assertEquals("remove element1", 1, mQueue.size());
assertEquals("after removing element4", "[3]", mQueue.toString());
mQueue.remove(mElement3);
assertEquals("remove element3", 0, mQueue.size());
assertEquals("after removing element3", "[]", mQueue.toString());
mQueue.remove(mElement1);
assertEquals("remove element1 again", 0, mQueue.size());
assertEquals("after removing element1 again", "[]", mQueue.toString());
assertEquals("after remove elements", 0, Element.sPhantomUpCount);
assertEquals("after remove element1",
Element.NOT_HAPPENED, mElement1.mPhantomUpEventTime);
assertEquals("after remove element2",
Element.NOT_HAPPENED, mElement2.mPhantomUpEventTime);
assertEquals("after remove element3",
Element.NOT_HAPPENED, mElement3.mPhantomUpEventTime);
assertEquals("after remove element4",
Element.NOT_HAPPENED, mElement4.mPhantomUpEventTime);
}
public void testAddAndRemove() {
Element.sPhantomUpCount = 0;
mQueue.add(mElement1);
mQueue.add(mElement2);
mQueue.add(mElement3);
mQueue.add(mElement4);
mQueue.remove(mElement2);
assertEquals("remove element2", 3, mQueue.size());
assertEquals("after removing element2", "[1 3 4]", mQueue.toString());
mQueue.remove(mElement4);
assertEquals("remove element4", 2, mQueue.size());
assertEquals("after removing element4", "[1 3]", mQueue.toString());
mQueue.add(mElement2);
assertEquals("add element2", 3, mQueue.size());
assertEquals("after adding element2", "[1 3 2]", mQueue.toString());
mQueue.remove(mElement4);
assertEquals("remove element4 again", 3, mQueue.size());
assertEquals("after removing element4 again", "[1 3 2]", mQueue.toString());
mQueue.remove(mElement1);
assertEquals("remove element1", 2, mQueue.size());
assertEquals("after removing element4", "[3 2]", mQueue.toString());
mQueue.add(mElement1);
assertEquals("add element1", 3, mQueue.size());
assertEquals("after adding element1", "[3 2 1]", mQueue.toString());
mQueue.remove(mElement3);
assertEquals("remove element3", 2, mQueue.size());
assertEquals("after removing element3", "[2 1]", mQueue.toString());
mQueue.remove(mElement1);
assertEquals("remove element1 again", 1, mQueue.size());
assertEquals("after removing element1 again", "[2]", mQueue.toString());
assertEquals("after remove element1",
Element.NOT_HAPPENED, mElement1.mPhantomUpEventTime);
assertEquals("after remove element2",
Element.NOT_HAPPENED, mElement2.mPhantomUpEventTime);
assertEquals("after remove element3",
Element.NOT_HAPPENED, mElement3.mPhantomUpEventTime);
assertEquals("after remove element4",
Element.NOT_HAPPENED, mElement4.mPhantomUpEventTime);
}
public void testReleaseAllPointers() {
mElement2.mIsModifier = true;
mQueue.add(mElement1);
mQueue.add(mElement2);
mQueue.add(mElement3);
mQueue.add(mElement4);
final long eventTime = 123;
Element.sPhantomUpCount = 0;
mQueue.releaseAllPointers(eventTime);
assertEquals("after releaseAllPointers", 4, Element.sPhantomUpCount);
assertEquals("after releaseAllPointers", 0, mQueue.size());
assertEquals("after releaseAllPointers", "[]", mQueue.toString());
assertEquals("after releaseAllPointers element1",
eventTime + 1, mElement1.mPhantomUpEventTime);
assertEquals("after releaseAllPointers element2",
eventTime + 2, mElement2.mPhantomUpEventTime);
assertEquals("after releaseAllPointers element3",
eventTime + 3, mElement3.mPhantomUpEventTime);
assertEquals("after releaseAllPointers element4",
eventTime + 4, mElement4.mPhantomUpEventTime);
}
public void testReleaseAllPointersOlderThan() {
mElement2.mIsModifier = true;
mQueue.add(mElement1);
mQueue.add(mElement2);
mQueue.add(mElement3);
mQueue.add(mElement4);
final long eventTime = 123;
Element.sPhantomUpCount = 0;
mQueue.releaseAllPointersOlderThan(mElement4, eventTime);
assertEquals("after releaseAllPointersOlderThan", 2, Element.sPhantomUpCount);
assertEquals("after releaseAllPointersOlderThan", 2, mQueue.size());
assertEquals("after releaseAllPointersOlderThan", "[2 4]", mQueue.toString());
assertEquals("after releaseAllPointersOlderThan element1",
eventTime + 1, mElement1.mPhantomUpEventTime);
assertEquals("after releaseAllPointersOlderThan element2",
Element.NOT_HAPPENED, mElement2.mPhantomUpEventTime);
assertEquals("after releaseAllPointersOlderThan element3",
eventTime + 2, mElement3.mPhantomUpEventTime);
assertEquals("after releaseAllPointersOlderThan element4",
Element.NOT_HAPPENED, mElement4.mPhantomUpEventTime);
}
public void testReleaseAllPointersOlderThanWithoutModifier() {
mQueue.add(mElement1);
mQueue.add(mElement2);
mQueue.add(mElement3);
mQueue.add(mElement4);
final long eventTime = 123;
Element.sPhantomUpCount = 0;
mQueue.releaseAllPointersOlderThan(mElement4, eventTime);
assertEquals("after releaseAllPointersOlderThan without modifier",
3, Element.sPhantomUpCount);
assertEquals("after releaseAllPointersOlderThan without modifier", 1, mQueue.size());
assertEquals("after releaseAllPointersOlderThan without modifier",
"[4]", mQueue.toString());
assertEquals("after releaseAllPointersOlderThan without modifier element1",
eventTime + 1, mElement1.mPhantomUpEventTime);
assertEquals("after releaseAllPointersOlderThan without modifier element2",
eventTime + 2, mElement2.mPhantomUpEventTime);
assertEquals("after releaseAllPointersOlderThan without modifier element3",
eventTime + 3, mElement3.mPhantomUpEventTime);
assertEquals("after releaseAllPointersOlderThan without modifier element4",
Element.NOT_HAPPENED, mElement4.mPhantomUpEventTime);
}
public void testReleaseAllPointersExcept() {
mElement2.mIsModifier = true;
mQueue.add(mElement1);
mQueue.add(mElement2);
mQueue.add(mElement3);
mQueue.add(mElement4);
final long eventTime = 123;
Element.sPhantomUpCount = 0;
mQueue.releaseAllPointersExcept(mElement3, eventTime);
assertEquals("after releaseAllPointersExcept", 3, Element.sPhantomUpCount);
assertEquals("after releaseAllPointersExcept", 1, mQueue.size());
assertEquals("after releaseAllPointersExcept", "[3]", mQueue.toString());
assertEquals("after releaseAllPointersExcept element1",
eventTime + 1, mElement1.mPhantomUpEventTime);
assertEquals("after releaseAllPointersExcept element2",
eventTime + 2, mElement2.mPhantomUpEventTime);
assertEquals("after releaseAllPointersExcept element3",
Element.NOT_HAPPENED, mElement3.mPhantomUpEventTime);
assertEquals("after releaseAllPointersExcept element4",
eventTime + 3, mElement4.mPhantomUpEventTime);
}
public void testHasModifierKeyOlderThan() {
Element.sPhantomUpCount = 0;
assertFalse("hasModifierKeyOlderThan empty", mQueue.hasModifierKeyOlderThan(mElement1));
mQueue.add(mElement1);
mQueue.add(mElement2);
mQueue.add(mElement3);
mQueue.add(mElement4);
assertFalse("hasModifierKeyOlderThan element1", mQueue.hasModifierKeyOlderThan(mElement1));
assertFalse("hasModifierKeyOlderThan element2", mQueue.hasModifierKeyOlderThan(mElement2));
assertFalse("hasModifierKeyOlderThan element3", mQueue.hasModifierKeyOlderThan(mElement3));
assertFalse("hasModifierKeyOlderThan element4", mQueue.hasModifierKeyOlderThan(mElement4));
mElement2.mIsModifier = true;
assertFalse("hasModifierKeyOlderThan element1", mQueue.hasModifierKeyOlderThan(mElement1));
assertFalse("hasModifierKeyOlderThan element2", mQueue.hasModifierKeyOlderThan(mElement2));
assertTrue("hasModifierKeyOlderThan element3", mQueue.hasModifierKeyOlderThan(mElement3));
assertTrue("hasModifierKeyOlderThan element4", mQueue.hasModifierKeyOlderThan(mElement4));
assertEquals("after hasModifierKeyOlderThan", 0, Element.sPhantomUpCount);
assertEquals("after hasModifierKeyOlderThan", 4, mQueue.size());
assertEquals("after hasModifierKeyOlderThan", "[1 2 3 4]", mQueue.toString());
assertEquals("after hasModifierKeyOlderThan element1",
Element.NOT_HAPPENED, mElement1.mPhantomUpEventTime);
assertEquals("after hasModifierKeyOlderThan element2",
Element.NOT_HAPPENED, mElement2.mPhantomUpEventTime);
assertEquals("after hasModifierKeyOlderThan element3",
Element.NOT_HAPPENED, mElement3.mPhantomUpEventTime);
assertEquals("after hasModifierKeyOlderThan element4",
Element.NOT_HAPPENED, mElement4.mPhantomUpEventTime);
}
public void testIsAnyInSlidingKeyInput() {
Element.sPhantomUpCount = 0;
assertFalse("isAnyInSlidingKeyInput empty", mQueue.isAnyInSlidingKeyInput());
mQueue.add(mElement1);
mQueue.add(mElement2);
mQueue.add(mElement3);
mQueue.add(mElement4);
assertFalse("isAnyInSlidingKeyInput element1", mQueue.isAnyInSlidingKeyInput());
mElement3.mIsInSlidingKeyInput = true;
assertTrue("isAnyInSlidingKeyInput element1", mQueue.isAnyInSlidingKeyInput());
assertEquals("after isAnyInSlidingKeyInput", 0, Element.sPhantomUpCount);
assertEquals("after isAnyInSlidingKeyInput", 4, mQueue.size());
assertEquals("after isAnyInSlidingKeyInput", "[1 2 3 4]", mQueue.toString());
assertEquals("after isAnyInSlidingKeyInput element1",
Element.NOT_HAPPENED, mElement1.mPhantomUpEventTime);
assertEquals("after isAnyInSlidingKeyInput element2",
Element.NOT_HAPPENED, mElement2.mPhantomUpEventTime);
assertEquals("after isAnyInSlidingKeyInput element3",
Element.NOT_HAPPENED, mElement3.mPhantomUpEventTime);
assertEquals("after isAnyInSlidingKeyInput element4",
Element.NOT_HAPPENED, mElement4.mPhantomUpEventTime);
}
}