Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1179)

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/input/CursorAnchorInfoControllerTest.java

Issue 2708243004: Auto convert content shell tests to JUnit4 (Closed)
Patch Set: organized import order and removed broken tests Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/public/android/javatests/src/org/chromium/content/browser/input/CursorAnchorInfoControllerTest.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/CursorAnchorInfoControllerTest.java b/content/public/android/javatests/src/org/chromium/content/browser/input/CursorAnchorInfoControllerTest.java
index bf6a11d75de4be0ce1d51de654d986ac856ead84..f03a06c889964ba393e3c4fd048240cb3f7dbc75 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/input/CursorAnchorInfoControllerTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/input/CursorAnchorInfoControllerTest.java
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,11 +9,15 @@ import android.graphics.Matrix;
import android.graphics.RectF;
import android.os.Build;
import android.support.test.filters.SmallTest;
-import android.test.InstrumentationTestCase;
import android.text.TextUtils;
import android.view.View;
import android.view.inputmethod.CursorAnchorInfo;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.MinAndroidSdkLevel;
import org.chromium.content.browser.RenderCoordinates;
@@ -22,9 +26,12 @@ import org.chromium.content.browser.test.util.TestInputMethodManagerWrapper;
/**
* Test for {@link CursorAnchorInfoController}.
*/
+@RunWith(BaseJUnit4ClassRunner.class)
@MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP)
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
-public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
+public class CursorAnchorInfoControllerTest {
+ private static final double ASSERTION_DELTA = 0.00000001;
the real yoland 2017/03/08 23:39:03 Set ASSERTION_DELTA to be 0.00000001 for no partic
+
private static RenderCoordinates createRenderCoordinates(float deviceScaleFactor,
float contentOffsetYPix) {
RenderCoordinates renderCoordinates = new RenderCoordinates();
@@ -92,39 +99,41 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
Matrix expectedMatrix = new Matrix();
expectedMatrix.setScale(expectedScale, expectedScale);
expectedMatrix.postTranslate(expectedTranslateX, expectedTranslateY);
- assertEquals(expectedMatrix, actual.getMatrix());
+ Assert.assertEquals(expectedMatrix, actual.getMatrix());
}
private void assertHasInsertionMarker(int expectedFlags, float expectedHorizontal,
float expectedTop, float expectedBaseline, float expectedBottom,
CursorAnchorInfo actual) {
- assertEquals(expectedFlags, actual.getInsertionMarkerFlags());
- assertEquals(expectedHorizontal, actual.getInsertionMarkerHorizontal());
- assertEquals(expectedTop, actual.getInsertionMarkerTop());
- assertEquals(expectedBaseline, actual.getInsertionMarkerBaseline());
- assertEquals(expectedBottom, actual.getInsertionMarkerBottom());
+ Assert.assertEquals(expectedFlags, actual.getInsertionMarkerFlags(), ASSERTION_DELTA);
+ Assert.assertEquals(
+ expectedHorizontal, actual.getInsertionMarkerHorizontal(), ASSERTION_DELTA);
+ Assert.assertEquals(expectedTop, actual.getInsertionMarkerTop(), ASSERTION_DELTA);
+ Assert.assertEquals(expectedBaseline, actual.getInsertionMarkerBaseline(), ASSERTION_DELTA);
+ Assert.assertEquals(expectedBottom, actual.getInsertionMarkerBottom(), ASSERTION_DELTA);
}
private void assertHasNoInsertionMarker(CursorAnchorInfo actual) {
- assertEquals(0, actual.getInsertionMarkerFlags());
- assertTrue(Float.isNaN(actual.getInsertionMarkerHorizontal()));
- assertTrue(Float.isNaN(actual.getInsertionMarkerTop()));
- assertTrue(Float.isNaN(actual.getInsertionMarkerBaseline()));
- assertTrue(Float.isNaN(actual.getInsertionMarkerBottom()));
+ Assert.assertEquals(0, actual.getInsertionMarkerFlags());
+ Assert.assertTrue(Float.isNaN(actual.getInsertionMarkerHorizontal()));
+ Assert.assertTrue(Float.isNaN(actual.getInsertionMarkerTop()));
+ Assert.assertTrue(Float.isNaN(actual.getInsertionMarkerBaseline()));
+ Assert.assertTrue(Float.isNaN(actual.getInsertionMarkerBottom()));
}
private void assertComposingText(CharSequence expectedComposingText,
int expectedComposingTextStart, CursorAnchorInfo actual) {
- assertTrue(TextUtils.equals(expectedComposingText, actual.getComposingText()));
- assertEquals(expectedComposingTextStart, actual.getComposingTextStart());
+ Assert.assertTrue(TextUtils.equals(expectedComposingText, actual.getComposingText()));
+ Assert.assertEquals(expectedComposingTextStart, actual.getComposingTextStart());
}
private void assertSelection(int expecteSelectionStart, int expecteSelectionEnd,
CursorAnchorInfo actual) {
- assertEquals(expecteSelectionStart, actual.getSelectionStart());
- assertEquals(expecteSelectionEnd, actual.getSelectionEnd());
+ Assert.assertEquals(expecteSelectionStart, actual.getSelectionStart());
+ Assert.assertEquals(expecteSelectionEnd, actual.getSelectionEnd());
}
+ @Test
@SmallTest
@Feature({"Input-Text-IME"})
public void testFocusedNodeChanged() {
@@ -138,7 +147,7 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
viewDelegate.locationX = 0;
viewDelegate.locationY = 0;
- assertFalse(
+ Assert.assertFalse(
"IC#onRequestCursorUpdates() must be rejected if the focused node is not editable.",
controller.onRequestCursorUpdates(
false /* immediate request */, true /* monitor request */, view));
@@ -148,7 +157,7 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
composingTextDelegate.updateTextAndSelection(controller, "0", 0, 1, 0, 1);
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
- assertEquals(0, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(0, immw.getUpdateCursorAnchorInfoCounter());
controller.focusedNodeChanged(false);
composingTextDelegate.clearTextAndSelection(controller);
@@ -159,9 +168,10 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
composingTextDelegate.updateTextAndSelection(controller, "1", 0, 1, 0, 1);
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 100.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
- assertEquals(0, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(0, immw.getUpdateCursorAnchorInfoCounter());
}
+ @Test
@SmallTest
@Feature({"Input-Text-IME"})
public void testImmediateMode() {
@@ -179,20 +189,20 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
// Make sure that #updateCursorAnchorInfo() is not be called until the matrix info becomes
// available with #onUpdateFrameInfo().
- assertTrue(controller.onRequestCursorUpdates(
+ Assert.assertTrue(controller.onRequestCursorUpdates(
true /* immediate request */, false /* monitor request */, view));
controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f}, view);
composingTextDelegate.updateTextAndSelection(controller, "0", 0, 1, 0, 1);
- assertEquals(0, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(0, immw.getUpdateCursorAnchorInfoCounter());
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
- assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
assertScaleAndTranslate(1.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f, 0.0f, 3.0f,
3.0f, immw.getLastCursorAnchorInfo());
- assertEquals(new RectF(0.0f, 1.0f, 2.0f, 3.0f),
+ Assert.assertEquals(new RectF(0.0f, 1.0f, 2.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(0));
- assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
+ Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
assertComposingText("0", 0, immw.getLastCursorAnchorInfo());
assertSelection(0, 1, immw.getLastCursorAnchorInfo());
@@ -201,19 +211,19 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
// Make sure that 2nd call of #onUpdateFrameInfo() is ignored.
controller.onUpdateFrameInfo(createRenderCoordinates(2.0f, 0.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
- assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
// Make sure that #onUpdateFrameInfo() is immediately called because the matrix info is
// already available.
- assertTrue(controller.onRequestCursorUpdates(
+ Assert.assertTrue(controller.onRequestCursorUpdates(
true /* immediate request */, false /* monitor request */, view));
- assertEquals(2, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(2, immw.getUpdateCursorAnchorInfoCounter());
assertScaleAndTranslate(2.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f, 0.0f, 3.0f,
3.0f, immw.getLastCursorAnchorInfo());
- assertEquals(new RectF(0.0f, 1.0f, 2.0f, 3.0f),
+ Assert.assertEquals(new RectF(0.0f, 1.0f, 2.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(0));
- assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
+ Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
assertComposingText("0", 0, immw.getLastCursorAnchorInfo());
assertSelection(0, 1, immw.getLastCursorAnchorInfo());
@@ -221,20 +231,20 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
// Make sure that CURSOR_UPDATE_IMMEDIATE and CURSOR_UPDATE_MONITOR can be specified at
// the same time.
- assertTrue(controller.onRequestCursorUpdates(
+ Assert.assertTrue(controller.onRequestCursorUpdates(
true /* immediate request*/, true /* monitor request */, view));
- assertEquals(3, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(3, immw.getUpdateCursorAnchorInfoCounter());
assertScaleAndTranslate(2.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
- assertEquals(4, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(4, immw.getUpdateCursorAnchorInfoCounter());
assertScaleAndTranslate(1.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f, 0.0f, 3.0f,
3.0f, immw.getLastCursorAnchorInfo());
- assertEquals(new RectF(0.0f, 1.0f, 2.0f, 3.0f),
+ Assert.assertEquals(new RectF(0.0f, 1.0f, 2.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(0));
- assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
+ Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
assertComposingText("0", 0, immw.getLastCursorAnchorInfo());
assertSelection(0, 1, immw.getLastCursorAnchorInfo());
@@ -245,32 +255,33 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
controller.focusedNodeChanged(false);
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
- assertTrue(controller.onRequestCursorUpdates(
+ Assert.assertTrue(controller.onRequestCursorUpdates(
true /* immediate request */, false /* monitor request */, view));
controller.focusedNodeChanged(false);
composingTextDelegate.clearTextAndSelection(controller);
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 100.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
- assertEquals(4, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(4, immw.getUpdateCursorAnchorInfoCounter());
// Make sure that CURSOR_UPDATE_IMMEDIATE can be enabled again.
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
- assertTrue(controller.onRequestCursorUpdates(
+ Assert.assertTrue(controller.onRequestCursorUpdates(
true /* immediate request */, false /* monitor request */, view));
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
- assertEquals(5, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(5, immw.getUpdateCursorAnchorInfoCounter());
assertScaleAndTranslate(1.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f, 0.0f, 3.0f,
3.0f, immw.getLastCursorAnchorInfo());
- assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(0));
- assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
+ Assert.assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(0));
+ Assert.assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
assertComposingText(null, -1, immw.getLastCursorAnchorInfo());
assertSelection(-1, -1, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
}
+ @Test
@SmallTest
@Feature({"Input-Text-IME"})
public void testMonitorMode() {
@@ -288,20 +299,20 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
// Make sure that #updateCursorAnchorInfo() is not be called until the matrix info becomes
// available with #onUpdateFrameInfo().
- assertTrue(controller.onRequestCursorUpdates(
+ Assert.assertTrue(controller.onRequestCursorUpdates(
false /* immediate request */, true /* monitor request */, view));
controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f}, view);
composingTextDelegate.updateTextAndSelection(controller, "0", 0, 1, 0, 1);
- assertEquals(0, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(0, immw.getUpdateCursorAnchorInfoCounter());
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
- assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
assertScaleAndTranslate(1.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f, 0.0f, 3.0f,
3.0f, immw.getLastCursorAnchorInfo());
- assertEquals(new RectF(0.0f, 1.0f, 2.0f, 3.0f),
+ Assert.assertEquals(new RectF(0.0f, 1.0f, 2.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(0));
- assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
+ Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
assertComposingText("0", 0, immw.getLastCursorAnchorInfo());
assertSelection(0, 1, immw.getLastCursorAnchorInfo());
@@ -312,21 +323,21 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f}, view);
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
- assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
// Make sure that #updateCursorAnchorInfo() is called if #setCompositionCharacterBounds()
// is called with a different parameter.
controller.setCompositionCharacterBounds(new float[] {30.0f, 1.0f, 32.0f, 3.0f}, view);
- assertEquals(2, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(2, immw.getUpdateCursorAnchorInfoCounter());
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
- assertEquals(2, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(2, immw.getUpdateCursorAnchorInfoCounter());
assertScaleAndTranslate(1.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f, 0.0f, 3.0f,
3.0f, immw.getLastCursorAnchorInfo());
- assertEquals(new RectF(30.0f, 1.0f, 32.0f, 3.0f),
+ Assert.assertEquals(new RectF(30.0f, 1.0f, 32.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(0));
- assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
+ Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
assertComposingText("0", 0, immw.getLastCursorAnchorInfo());
assertSelection(0, 1, immw.getLastCursorAnchorInfo());
@@ -335,16 +346,16 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
// Make sure that #updateCursorAnchorInfo() is called if #updateTextAndSelection()
// is called with a different parameter.
composingTextDelegate.updateTextAndSelection(controller, "1", 0, 1, 0, 1);
- assertEquals(2, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(2, immw.getUpdateCursorAnchorInfoCounter());
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
- assertEquals(3, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(3, immw.getUpdateCursorAnchorInfoCounter());
assertScaleAndTranslate(1.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f, 0.0f, 3.0f,
3.0f, immw.getLastCursorAnchorInfo());
- assertEquals(new RectF(30.0f, 1.0f, 32.0f, 3.0f),
+ Assert.assertEquals(new RectF(30.0f, 1.0f, 32.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(0));
- assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
+ Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
assertComposingText("1", 0, immw.getLastCursorAnchorInfo());
assertSelection(0, 1, immw.getLastCursorAnchorInfo());
@@ -354,13 +365,13 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
// is called with a different parameter.
controller.onUpdateFrameInfo(createRenderCoordinates(2.0f, 0.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
- assertEquals(4, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(4, immw.getUpdateCursorAnchorInfoCounter());
assertScaleAndTranslate(2.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f, 0.0f, 3.0f,
3.0f, immw.getLastCursorAnchorInfo());
- assertEquals(new RectF(30.0f, 1.0f, 32.0f, 3.0f),
+ Assert.assertEquals(new RectF(30.0f, 1.0f, 32.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(0));
- assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
+ Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
assertComposingText("1", 0, immw.getLastCursorAnchorInfo());
assertSelection(0, 1, immw.getLastCursorAnchorInfo());
@@ -371,13 +382,13 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
viewDelegate.locationY = 9;
controller.onUpdateFrameInfo(createRenderCoordinates(2.0f, 0.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
- assertEquals(5, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(5, immw.getUpdateCursorAnchorInfoCounter());
assertScaleAndTranslate(2.0f, 7.0f, 9.0f, immw.getLastCursorAnchorInfo());
assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f, 0.0f, 3.0f,
3.0f, immw.getLastCursorAnchorInfo());
- assertEquals(new RectF(30.0f, 1.0f, 32.0f, 3.0f),
+ Assert.assertEquals(new RectF(30.0f, 1.0f, 32.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(0));
- assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
+ Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
assertComposingText("1", 0, immw.getLastCursorAnchorInfo());
assertSelection(0, 1, immw.getLastCursorAnchorInfo());
@@ -388,7 +399,7 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
controller.focusedNodeChanged(false);
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
- assertTrue(controller.onRequestCursorUpdates(
+ Assert.assertTrue(controller.onRequestCursorUpdates(
false /* immediate request */, true /* monitor request */, view));
controller.focusedNodeChanged(false);
composingTextDelegate.clearTextAndSelection(controller);
@@ -396,33 +407,34 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
composingTextDelegate.updateTextAndSelection(controller, "0", 0, 1, 0, 1);
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
- assertEquals(5, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(5, immw.getUpdateCursorAnchorInfoCounter());
// Make sure that CURSOR_UPDATE_MONITOR can be enabled again.
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
- assertTrue(controller.onRequestCursorUpdates(
+ Assert.assertTrue(controller.onRequestCursorUpdates(
false /* immediate request */, true /* monitor request */, view));
controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f}, view);
composingTextDelegate.updateTextAndSelection(controller, "0", 0, 1, 0, 1);
- assertEquals(5, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(5, immw.getUpdateCursorAnchorInfoCounter());
viewDelegate.locationX = 0;
viewDelegate.locationY = 0;
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
true, true, 2.0f, 0.0f, 3.0f, view);
- assertEquals(6, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(6, immw.getUpdateCursorAnchorInfoCounter());
assertScaleAndTranslate(1.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f, 0.0f, 3.0f,
3.0f, immw.getLastCursorAnchorInfo());
- assertEquals(new RectF(0.0f, 1.0f, 2.0f, 3.0f),
+ Assert.assertEquals(new RectF(0.0f, 1.0f, 2.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(0));
- assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
+ Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
assertComposingText("0", 0, immw.getLastCursorAnchorInfo());
assertSelection(0, 1, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
}
+ @Test
@SmallTest
@Feature({"Input-Text-IME"})
public void testSetCompositionCharacterBounds() {
@@ -438,7 +450,7 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
- assertTrue(controller.onRequestCursorUpdates(
+ Assert.assertTrue(controller.onRequestCursorUpdates(
false /* immediate request */, true /* monitor request */, view));
composingTextDelegate.updateTextAndSelection(controller, "01234", 1, 3, 1, 1);
@@ -446,23 +458,24 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
4.0f, 1.1f, 6.0f, 2.9f}, view);
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
false, false, Float.NaN, Float.NaN, Float.NaN, view);
- assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
- assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(0));
- assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
- assertEquals(new RectF(0.0f, 1.0f, 2.0f, 3.0f),
+ Assert.assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(0));
+ Assert.assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
+ Assert.assertEquals(new RectF(0.0f, 1.0f, 2.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(1));
- assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
+ Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(1));
- assertEquals(new RectF(4.0f, 1.1f, 6.0f, 2.9f),
+ Assert.assertEquals(new RectF(4.0f, 1.1f, 6.0f, 2.9f),
immw.getLastCursorAnchorInfo().getCharacterBounds(2));
- assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
+ Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(2));
- assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(3));
- assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(3));
+ Assert.assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(3));
+ Assert.assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(3));
assertComposingText("12", 1, immw.getLastCursorAnchorInfo());
assertSelection(1, 1, immw.getLastCursorAnchorInfo());
}
+ @Test
@SmallTest
@Feature({"Input-Text-IME"})
public void testUpdateTextAndSelection() {
@@ -478,27 +491,28 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
- assertTrue(controller.onRequestCursorUpdates(
+ Assert.assertTrue(controller.onRequestCursorUpdates(
false /* immediate request */, true /* monitor request */, view));
composingTextDelegate.updateTextAndSelection(controller, "01234", 3, 3, 1, 1);
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
false, false, Float.NaN, Float.NaN, Float.NaN, view);
- assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
- assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(0));
- assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
- assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(1));
- assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(1));
- assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(2));
- assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(2));
- assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(3));
- assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(3));
- assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(4));
- assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(4));
+ Assert.assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(0));
+ Assert.assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
+ Assert.assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(1));
+ Assert.assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(1));
+ Assert.assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(2));
+ Assert.assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(2));
+ Assert.assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(3));
+ Assert.assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(3));
+ Assert.assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(4));
+ Assert.assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(4));
assertComposingText("", 3, immw.getLastCursorAnchorInfo());
assertSelection(1, 1, immw.getLastCursorAnchorInfo());
}
+ @Test
@SmallTest
@Feature({"Input-Text-IME"})
public void testInsertionMarker() {
@@ -511,20 +525,20 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
- assertTrue(controller.onRequestCursorUpdates(
+ Assert.assertTrue(controller.onRequestCursorUpdates(
false /* immediate request */, true /* monitor request */, view));
// Test no insertion marker.
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
false, false, Float.NaN, Float.NaN, Float.NaN, view);
- assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
assertHasNoInsertionMarker(immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
// Test a visible insertion marker.
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
true, true, 10.0f, 23.0f, 29.0f, view);
- assertEquals(2, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(2, immw.getUpdateCursorAnchorInfoCounter());
assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
10.0f, 23.0f, 29.0f, 29.0f, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
@@ -532,12 +546,13 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
// Test a invisible insertion marker.
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
true, false, 10.0f, 23.0f, 29.0f, view);
- assertEquals(3, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(3, immw.getUpdateCursorAnchorInfoCounter());
assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_INVISIBLE_REGION,
10.0f, 23.0f, 29.0f, 29.0f, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
}
+ @Test
@SmallTest
@Feature({"Input-Text-IME"})
public void testMatrix() {
@@ -550,7 +565,7 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
- assertTrue(controller.onRequestCursorUpdates(
+ Assert.assertTrue(controller.onRequestCursorUpdates(
false /* immediate request */, true /* monitor request */, view));
// Test no transformation
@@ -558,7 +573,7 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
viewDelegate.locationY = 0;
controller.onUpdateFrameInfo(createRenderCoordinates(1.0f, 0.0f),
false, false, Float.NaN, Float.NaN, Float.NaN, view);
- assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
assertScaleAndTranslate(1.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
@@ -567,7 +582,7 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
viewDelegate.locationY = 0;
controller.onUpdateFrameInfo(createRenderCoordinates(2.0f, 0.0f),
false, false, Float.NaN, Float.NaN, Float.NaN, view);
- assertEquals(2, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(2, immw.getUpdateCursorAnchorInfoCounter());
assertScaleAndTranslate(2.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
@@ -577,7 +592,7 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
viewDelegate.locationY = 141;
controller.onUpdateFrameInfo(createRenderCoordinates(2.0f, 0.0f),
false, false, Float.NaN, Float.NaN, Float.NaN, view);
- assertEquals(3, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(3, immw.getUpdateCursorAnchorInfoCounter());
assertScaleAndTranslate(2.0f, 10.0f, 141.0f, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
@@ -588,7 +603,7 @@ public class CursorAnchorInfoControllerTest extends InstrumentationTestCase {
viewDelegate.locationY = 141;
controller.onUpdateFrameInfo(createRenderCoordinates(2.0f, 40.0f),
false, false, Float.NaN, Float.NaN, Float.NaN, view);
- assertEquals(4, immw.getUpdateCursorAnchorInfoCounter());
+ Assert.assertEquals(4, immw.getUpdateCursorAnchorInfoCounter());
assertScaleAndTranslate(2.0f, 10.0f, 181.0f, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
}

Powered by Google App Engine
This is Rietveld 408576698