package com.anysoftkeyboard.quicktextkeys.ui;

import android.view.KeyEvent;
import android.view.View;

import com.anysoftkeyboard.keyboards.views.OnKeyboardActionListener;
import com.menny.android.anysoftkeyboard.R;

import junit.framework.TestCase;

import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;

@RunWith(RobolectricTestRunner.class)
public class FrameKeyboardViewClickListenerTest {

	public void testOnClickClose() throws Exception {
		OnKeyboardActionListener keyboardActionListener = Mockito.mock(OnKeyboardActionListener.class);
		FrameKeyboardViewClickListener listener = new FrameKeyboardViewClickListener(keyboardActionListener);
		Mockito.verifyZeroInteractions(keyboardActionListener);
		View view = new View(Robolectric.application);
		view.setId(R.id.quick_keys_popup_close);
		listener.onClick(view);
		Mockito.verify(keyboardActionListener).onCancel();
		Mockito.verifyNoMoreInteractions(keyboardActionListener);
	}

	public void testOnClickBackSpace() throws Exception {
		OnKeyboardActionListener keyboardActionListener = Mockito.mock(OnKeyboardActionListener.class);
		FrameKeyboardViewClickListener listener = new FrameKeyboardViewClickListener(keyboardActionListener);
		Mockito.verifyZeroInteractions(keyboardActionListener);
		View view = new View(Robolectric.application);
		view.setId(R.id.quick_keys_popup_backspace);
		listener.onClick(view);
		Mockito.verify(keyboardActionListener).onKey(KeyEvent.KEYCODE_DEL, null, 0, null, true);
		Mockito.verifyNoMoreInteractions(keyboardActionListener);
	}

	public void testOnClickEnter() throws Exception {
		OnKeyboardActionListener keyboardActionListener = Mockito.mock(OnKeyboardActionListener.class);
		FrameKeyboardViewClickListener listener = new FrameKeyboardViewClickListener(keyboardActionListener);
		Mockito.verifyZeroInteractions(keyboardActionListener);
		View view = new View(Robolectric.application);
		view.setId(R.id.quick_keys_popup_return);
		listener.onClick(view);
		Mockito.verify(keyboardActionListener).onKey(KeyEvent.KEYCODE_ENTER, null, 0, null, true);
		Mockito.verifyNoMoreInteractions(keyboardActionListener);
	}
}
@@ -97,16 +97,57 @@
 .View;%0A%0A
+import com.anysoftkeyboard.api.KeyCodes;%0A
 import c
@@ -207,16 +207,16 @@
 stener;%0A
-
 import c
@@ -286,16 +286,39 @@
 tCase;%0A%0A
+import org.junit.Test;%0A
 import o
@@ -542,16 +542,23 @@
 Test %7B%0A%0A
+%09@Test%0A
 %09public 
@@ -1087,32 +1087,39 @@
 nListener);%0A%09%7D%0A%0A
+%09@Test%0A
 %09public void tes
@@ -1593,25 +1593,20 @@
 (Key
-Event.KEYCODE_DEL
+Codes.DELETE
 , nu
@@ -1689,16 +1689,23 @@
 r);%0A%09%7D%0A%0A
+%09@Test%0A
 %09public 
@@ -2180,22 +2180,14 @@
 (Key
-Event.KEYCODE_
+Codes.
 ENTE

fix unit-test. Issue #390