Skip to content

Commit

Permalink
remove longPressCode of delete key
Browse files Browse the repository at this point in the history
  • Loading branch information
gouzhun committed Oct 15, 2017
1 parent 8824b9c commit 78a7d6e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/src/main/res/xml/qwerty.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@
<Key android:codes="98" android:keyLabel="b" android:popupCharacters="β"/>
<Key android:codes="110" android:keyLabel="n" android:popupCharacters="ñńν"/>
<Key android:codes="109" android:keyLabel="m" android:popupCharacters="μ"/>
<Key android:keyWidth="15%p" android:codes="-5" ask:longPressCode="-7" android:keyEdgeFlags="right" android:isRepeatable="true"/>
<Key android:keyWidth="15%p" android:codes="-5" android:keyEdgeFlags="right" android:isRepeatable="true"/>
</Row>
</Keyboard>
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,18 @@ public void testWithLongPressDeleteKeyOutput(){
final AnyKeyboard.AnyKey key = findKey(KeyCodes.DELETE);
key.longPressCode = -7;

ViewTestUtils.navigateFromTo(mUnderTest,key,key,60,true,true);
KeyDrawableStateProvider provider = new KeyDrawableStateProvider(R.attr.key_type_function, R.attr.key_type_action, R.attr.action_done, R.attr.action_search, R.attr.action_go);
Assert.assertArrayEquals(provider.KEY_STATE_NORMAL, key.getCurrentDrawableState(provider));

Mockito.verify(mMockKeyboardListener).onKey(Mockito.eq((int) KeyCodes.DELETE_WORD), Mockito.same(key), Mockito.eq(0), Mockito.any(int[].class), Mockito.eq(true));
Mockito.verify(mMockKeyboardListener, Mockito.never()).onKey(Mockito.eq(key.getPrimaryCode()), Mockito.any(Keyboard.Key.class), Mockito.anyInt(), Mockito.any(int[].class), Mockito.anyBoolean());
Point keyPoint = ViewTestUtils.getKeyCenterPoint(key);

ViewTestUtils.navigateFromTo(mUnderTest,keyPoint,keyPoint,60,true,true);

Assert.assertArrayEquals(provider.KEY_STATE_PRESSED, key.getCurrentDrawableState(provider));

mUnderTest.onTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, keyPoint.x, keyPoint.y, 0));

Assert.assertArrayEquals(provider.KEY_STATE_NORMAL, key.getCurrentDrawableState(provider));
}

@Nullable
Expand Down

0 comments on commit 78a7d6e

Please sign in to comment.