aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-05-29 07:30:15 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-29 07:30:16 +0000
commit262b1e75182ecd34e7488c6ac98341c45dc9f24d (patch)
tree3a7c53cc7f1543e95d41bdd1ff0d724540272a6e /tests/src
parent6dc21bd4e6b4854da65541a431d499489ece7246 (diff)
parentbbf556e8e1f2b522c555e05ec06c4efefed16e02 (diff)
downloadlatinime-262b1e75182ecd34e7488c6ac98341c45dc9f24d.tar.gz
latinime-262b1e75182ecd34e7488c6ac98341c45dc9f24d.tar.xz
latinime-262b1e75182ecd34e7488c6ac98341c45dc9f24d.zip
Merge "Remove researcher logger"
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/com/android/inputmethod/research/MotionEventReaderTests.java171
1 files changed, 0 insertions, 171 deletions
diff --git a/tests/src/com/android/inputmethod/research/MotionEventReaderTests.java b/tests/src/com/android/inputmethod/research/MotionEventReaderTests.java
deleted file mode 100644
index 28a9f3d5c..000000000
--- a/tests/src/com/android/inputmethod/research/MotionEventReaderTests.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (C) 2013 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.research;
-
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-import android.util.JsonReader;
-
-import com.android.inputmethod.research.MotionEventReader.ReplayData;
-
-import java.io.IOException;
-import java.io.StringReader;
-
-@SmallTest
-public class MotionEventReaderTests extends AndroidTestCase {
- private MotionEventReader mMotionEventReader = new MotionEventReader();
- private ReplayData mReplayData;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mReplayData = new ReplayData();
- }
-
- private JsonReader jsonReaderForString(final String s) {
- return new JsonReader(new StringReader(s));
- }
-
- public void testTopLevelDataVariant() {
- final JsonReader jsonReader = jsonReaderForString(
- "{"
- + "\"_ct\": 1359590400000,"
- + "\"_ut\": 4381933,"
- + "\"_ty\": \"MotionEvent\","
- + "\"action\": \"UP\","
- + "\"isLoggingRelated\": false,"
- + "\"x\": 100.0,"
- + "\"y\": 200.0"
- + "}"
- );
- try {
- mMotionEventReader.readLogStatement(jsonReader, mReplayData);
- } catch (IOException e) {
- e.printStackTrace();
- fail("IOException thrown");
- }
- assertEquals("x set correctly", (int) mReplayData.mPointerCoordsArrays.get(0)[0].x, 100);
- assertEquals("y set correctly", (int) mReplayData.mPointerCoordsArrays.get(0)[0].y, 200);
- assertEquals("only one pointer", mReplayData.mPointerCoordsArrays.get(0).length, 1);
- assertEquals("only one MotionEvent", mReplayData.mPointerCoordsArrays.size(), 1);
- }
-
- public void testNestedDataVariant() {
- final JsonReader jsonReader = jsonReaderForString(
- "{"
- + " \"_ct\": 135959040000,"
- + " \"_ut\": 4382702,"
- + " \"_ty\": \"MotionEvent\","
- + " \"action\": \"MOVE\","
- + " \"isLoggingRelated\": false,"
- + " \"motionEvent\": {"
- + " \"pointerIds\": ["
- + " 0"
- + " ],"
- + " \"xyt\": ["
- + " {"
- + " \"t\": 4382551,"
- + " \"d\": ["
- + " {"
- + " \"x\": 100.0,"
- + " \"y\": 200.0,"
- + " \"toma\": 999.0,"
- + " \"tomi\": 999.0,"
- + " \"o\": 0.0"
- + " }"
- + " ]"
- + " },"
- + " {"
- + " \"t\": 4382559,"
- + " \"d\": ["
- + " {"
- + " \"x\": 300.0,"
- + " \"y\": 400.0,"
- + " \"toma\": 999.0,"
- + " \"tomi\": 999.0,"
- + " \"o\": 0.0"
- + " }"
- + " ]"
- + " }"
- + " ]"
- + " }"
- + "}"
- );
- try {
- mMotionEventReader.readLogStatement(jsonReader, mReplayData);
- } catch (IOException e) {
- e.printStackTrace();
- fail("IOException thrown");
- }
- assertEquals("x1 set correctly", (int) mReplayData.mPointerCoordsArrays.get(0)[0].x, 100);
- assertEquals("y1 set correctly", (int) mReplayData.mPointerCoordsArrays.get(0)[0].y, 200);
- assertEquals("x2 set correctly", (int) mReplayData.mPointerCoordsArrays.get(1)[0].x, 300);
- assertEquals("y2 set correctly", (int) mReplayData.mPointerCoordsArrays.get(1)[0].y, 400);
- assertEquals("only one pointer", mReplayData.mPointerCoordsArrays.get(0).length, 1);
- assertEquals("two MotionEvents", mReplayData.mPointerCoordsArrays.size(), 2);
- }
-
- public void testNestedDataVariantMultiPointer() {
- final JsonReader jsonReader = jsonReaderForString(
- "{"
- + " \"_ct\": 135959040000,"
- + " \"_ut\": 4382702,"
- + " \"_ty\": \"MotionEvent\","
- + " \"action\": \"MOVE\","
- + " \"isLoggingRelated\": false,"
- + " \"motionEvent\": {"
- + " \"pointerIds\": ["
- + " 1"
- + " ],"
- + " \"xyt\": ["
- + " {"
- + " \"t\": 4382551,"
- + " \"d\": ["
- + " {"
- + " \"x\": 100.0,"
- + " \"y\": 200.0,"
- + " \"toma\": 999.0,"
- + " \"tomi\": 999.0,"
- + " \"o\": 0.0"
- + " },"
- + " {"
- + " \"x\": 300.0,"
- + " \"y\": 400.0,"
- + " \"toma\": 999.0,"
- + " \"tomi\": 999.0,"
- + " \"o\": 0.0"
- + " }"
- + " ]"
- + " }"
- + " ]"
- + " }"
- + "}"
- );
- try {
- mMotionEventReader.readLogStatement(jsonReader, mReplayData);
- } catch (IOException e) {
- e.printStackTrace();
- fail("IOException thrown");
- }
- assertEquals("x1 set correctly", (int) mReplayData.mPointerCoordsArrays.get(0)[0].x, 100);
- assertEquals("y1 set correctly", (int) mReplayData.mPointerCoordsArrays.get(0)[0].y, 200);
- assertEquals("x2 set correctly", (int) mReplayData.mPointerCoordsArrays.get(0)[1].x, 300);
- assertEquals("y2 set correctly", (int) mReplayData.mPointerCoordsArrays.get(0)[1].y, 400);
- assertEquals("two pointers", mReplayData.mPointerCoordsArrays.get(0).length, 2);
- assertEquals("one MotionEvent", mReplayData.mPointerCoordsArrays.size(), 1);
- }
-}