Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 21914183 authored by Siyamed Sinir's avatar Siyamed Sinir
Browse files

Migrate core TextView tests to JUnit4

Test: bit FrameworksCoreTests:android.widget.EditorCursorTest
bit -t FrameworksCoreTests:android.widget.TextViewActivityMouseTest
bit -t FrameworksCoreTests:android.widget.TextViewActivityTest
bit -t FrameworksCoreTests:android.widget.TextViewPerformanceTest
bit -t FrameworksCoreTests:android.widget.TextViewTest

Bug: 31223263
Change-Id: Ib7cc4267b3c9a631aae1d4dd7b18f51d94d3c3ae
parent 5d17d3a5
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2017 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
  -->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
             android:layout_width="match_parent"
             android:layout_height="match_parent">

    <EditText
        android:id="@+id/edittext"
        android:layout_width="200px"
        android:layout_height="wrap_content"
        android:padding="15px"
        android:lines="1"
        android:singleLine="true"
        android:textSize="30px"/>

</FrameLayout>
+62 −72
Original line number Diff line number Diff line
@@ -16,71 +16,68 @@

package android.widget;

import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.SmallTest;
import android.view.Choreographer;
import android.view.ViewGroup;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.widget.espresso.TextViewAssertions.hasInsertionPointerOnLeft;
import static android.widget.espresso.TextViewAssertions.hasInsertionPointerOnRight;

import static junit.framework.Assert.fail;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.isEmptyString;
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.Matchers.sameInstance;

public class EditorCursorTest extends ActivityInstrumentationTestCase2<TextViewActivity> {
import android.app.Activity;
import android.app.Instrumentation;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.MediumTest;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;

import com.android.frameworks.coretests.R;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

@RunWith(AndroidJUnit4.class)
@MediumTest
public class EditorCursorTest {
    private final static String LTR_STRING = "aaaaaaaaaaaaaaaaaaaaaa";
    private final static String LTR_HINT = "hint";
    private final static String RTL_STRING = "مرحبا الروبوت مرحبا الروبوت مرحبا الروبوت";
    private final static String RTL_HINT = "الروبوت";
    private final static int CURSOR_BLINK_MS = 500;

    @Rule
    public ActivityTestRule<TextViewActivity> mActivityRule = new ActivityTestRule<>(
            TextViewActivity.class);

    private Instrumentation mInstrumentation;
    private Activity mActivity;
    private EditText mEditText;

    public EditorCursorTest() {
        super(TextViewActivity.class);
    }
    @Before
    public void setUp() throws Throwable {
        mActivity = mActivityRule.getActivity();
        mInstrumentation = InstrumentationRegistry.getInstrumentation();

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        mEditText = new EditText(getActivity());
        mEditText.setTextSize(30);
        mEditText.setSingleLine(true);
        mEditText.setLines(1);
        mEditText.setPadding(15, 15, 15, 15);
        ViewGroup.LayoutParams editTextLayoutParams = new ViewGroup.LayoutParams(200,
                ViewGroup.LayoutParams.WRAP_CONTENT);

        mEditText.setLayoutParams(editTextLayoutParams);

        final FrameLayout layout = new FrameLayout(getActivity());
        ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);
        layout.setLayoutParams(layoutParams);
        layout.addView(mEditText);

        getActivity().runOnUiThread(new Runnable() {
            @Override
            public void run() {
                getActivity().setContentView(layout);
            }
        mActivityRule.runOnUiThread(() -> {
            mActivity.setContentView(R.layout.activity_editor_cursor_test);
            mEditText = mActivity.findViewById(R.id.edittext);
        });
        getInstrumentation().waitForIdleSync();
        mInstrumentation.waitForIdleSync();
        onView(sameInstance(mEditText)).perform(click());
    }

    @SmallTest
    public void testCursorIsInViewBoundariesWhenOnRightForLtr() {
    @Test
    public void testCursorIsInViewBoundariesWhenOnRightForLtr() throws Throwable {
        // Asserts that when an EditText has LTR text, and cursor is at the end (right),
        // cursor is drawn to the right edge of the view
        setEditTextText(LTR_STRING, LTR_STRING.length());
@@ -88,8 +85,8 @@ public class EditorCursorTest extends ActivityInstrumentationTestCase2<TextViewA
        onView(sameInstance(mEditText)).check(hasInsertionPointerOnRight());
    }

    @SmallTest
    public void testCursorIsInViewBoundariesWhenOnLeftForLtr() {
    @Test
    public void testCursorIsInViewBoundariesWhenOnLeftForLtr() throws Throwable {
        // Asserts that when an EditText has LTR text, and cursor is at the beginning,
        // cursor is drawn to the left edge of the view
        setEditTextText(LTR_STRING, 0);
@@ -97,8 +94,8 @@ public class EditorCursorTest extends ActivityInstrumentationTestCase2<TextViewA
        onView(sameInstance(mEditText)).check(hasInsertionPointerOnLeft());
    }

    @SmallTest
    public void testCursorIsInViewBoundariesWhenOnRightForRtl() {
    @Test
    public void testCursorIsInViewBoundariesWhenOnRightForRtl() throws Throwable {
        // Asserts that when an EditText has RTL text, and cursor is at the end,
        // cursor is drawn to the left edge of the view
        setEditTextText(RTL_STRING, 0);
@@ -106,8 +103,8 @@ public class EditorCursorTest extends ActivityInstrumentationTestCase2<TextViewA
        onView(sameInstance(mEditText)).check(hasInsertionPointerOnRight());
    }

    @SmallTest
    public void testCursorIsInViewBoundariesWhenOnLeftForRtl() {
    @Test
    public void testCursorIsInViewBoundariesWhenOnLeftForRtl() throws Throwable {
        // Asserts that when an EditText has RTL text, and cursor is at the beginning,
        // cursor is drawn to the right edge of the view
        setEditTextText(RTL_STRING, RTL_STRING.length());
@@ -116,8 +113,8 @@ public class EditorCursorTest extends ActivityInstrumentationTestCase2<TextViewA
    }

    /* Tests for cursor positioning with hint */
    @SmallTest
    public void testCursorIsOnLeft_withFirstStrongLtrAlgorithm() {
    @Test
    public void testCursorIsOnLeft_withFirstStrongLtrAlgorithm() throws Throwable {
        setEditTextHint(null, TextView.TEXT_DIRECTION_FIRST_STRONG_LTR, 0);
        assertThat(mEditText.getText().toString(), isEmptyString());
        assertThat(mEditText.getHint(), nullValue());
@@ -135,8 +132,8 @@ public class EditorCursorTest extends ActivityInstrumentationTestCase2<TextViewA
        onView(sameInstance(mEditText)).check(hasInsertionPointerOnLeft());
    }

    @SmallTest
    public void testCursorIsOnRight_withFirstStrongRtlAlgorithm() {
    @Test
    public void testCursorIsOnRight_withFirstStrongRtlAlgorithm() throws Throwable {
        setEditTextHint(null, TextView.TEXT_DIRECTION_FIRST_STRONG_RTL, 0);
        assertThat(mEditText.getText().toString(), isEmptyString());
        assertThat(mEditText.getHint(), nullValue());
@@ -154,8 +151,8 @@ public class EditorCursorTest extends ActivityInstrumentationTestCase2<TextViewA
        onView(sameInstance(mEditText)).check(hasInsertionPointerOnRight());
    }

    @SmallTest
    public void testCursorIsOnLeft_withLtrAlgorithm() {
    @Test
    public void testCursorIsOnLeft_withLtrAlgorithm() throws Throwable {
        setEditTextHint(null, TextView.TEXT_DIRECTION_LTR, 0);
        assertThat(mEditText.getText().toString(), isEmptyString());
        assertThat(mEditText.getHint(), nullValue());
@@ -173,8 +170,8 @@ public class EditorCursorTest extends ActivityInstrumentationTestCase2<TextViewA
        onView(sameInstance(mEditText)).check(hasInsertionPointerOnLeft());
    }

    @SmallTest
    public void testCursorIsOnRight_withRtlAlgorithm() {
    @Test
    public void testCursorIsOnRight_withRtlAlgorithm() throws Throwable {
        setEditTextHint(null, TextView.TEXT_DIRECTION_RTL, 0);
        assertThat(mEditText.getText().toString(), isEmptyString());
        assertThat(mEditText.getHint(), nullValue());
@@ -193,27 +190,19 @@ public class EditorCursorTest extends ActivityInstrumentationTestCase2<TextViewA
    }

    private void setEditTextProperties(final String text, final String hint,
            final Integer textDirection, final Integer selection) {
        getActivity().runOnUiThread(new Runnable() {
            @Override
            public void run() {
            final Integer textDirection, final Integer selection) throws Throwable {
        mActivityRule.runOnUiThread(() -> {
            if (textDirection != null) mEditText.setTextDirection(textDirection);
            if (text != null) mEditText.setText(text);
            if (hint != null) mEditText.setHint(hint);
            if (selection != null) mEditText.setSelection(selection);
            }
        });
        getInstrumentation().waitForIdleSync();
        mInstrumentation.waitForIdleSync();

        // wait for cursor to be drawn. updateCursorPositions function is called during draw() and
        // only when cursor is visible during blink.
        final CountDownLatch latch = new CountDownLatch(1);
        mEditText.postOnAnimationDelayed(new Runnable() {
            @Override
            public void run() {
                latch.countDown();
            }
        }, CURSOR_BLINK_MS);
        mEditText.postOnAnimationDelayed(latch::countDown, CURSOR_BLINK_MS);
        try {
            assertThat("Problem while waiting for the cursor to blink",
                    latch.await(10, TimeUnit.SECONDS), equalTo(true));
@@ -222,11 +211,12 @@ public class EditorCursorTest extends ActivityInstrumentationTestCase2<TextViewA
        }
    }

    private void setEditTextHint(final String hint, final int textDirection, final int selection) {
    private void setEditTextHint(final String hint, final int textDirection, final int selection)
            throws Throwable {
        setEditTextProperties(null, hint, textDirection, selection);
    }

    private void setEditTextText(final String text, final Integer selection) {
    private void setEditTextText(final String text, final Integer selection) throws Throwable {
        setEditTextProperties(text, null, null, selection);
    }
}
+57 −46
Original line number Diff line number Diff line
@@ -42,32 +42,43 @@ import static android.widget.espresso.TextViewActions.mouseTripleClickOnTextAtIn
import static android.widget.espresso.TextViewAssertions.hasInsertionPointerAtIndex;
import static android.widget.espresso.TextViewAssertions.hasSelection;

import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.SmallTest;
import android.app.Activity;
import android.support.test.filters.MediumTest;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.view.MotionEvent;
import android.view.textclassifier.TextClassificationManager;
import android.view.textclassifier.TextClassifier;

import com.android.frameworks.coretests.R;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

/**
 * Tests mouse interaction of the TextView widget from an Activity
 */
public class TextViewActivityMouseTest extends ActivityInstrumentationTestCase2<TextViewActivity>{
@RunWith(AndroidJUnit4.class)
@MediumTest
public class TextViewActivityMouseTest {

    public TextViewActivityMouseTest() {
        super(TextViewActivity.class);
    }
    @Rule
    public ActivityTestRule<TextViewActivity> mActivityRule = new ActivityTestRule<>(
            TextViewActivity.class);

    private Activity mActivity;

    @Override
    public void setUp() throws Exception {
        super.setUp();
        getActivity().getSystemService(TextClassificationManager.class)
    @Before
    public void setUp() {
        mActivity = mActivityRule.getActivity();
        mActivity.getSystemService(TextClassificationManager.class)
                .setTextClassifier(TextClassifier.NO_OP);
    }

    @SmallTest
    public void testSelectTextByDrag() throws Exception {
    @Test
    public void testSelectTextByDrag() {
        final String helloWorld = "Hello world!";
        onView(withId(R.id.textview)).perform(mouseClick());
        onView(withId(R.id.textview)).perform(replaceText(helloWorld));
@@ -90,8 +101,8 @@ public class TextViewActivityMouseTest extends ActivityInstrumentationTestCase2<
        assertNoSelectionHandles();
    }

    @SmallTest
    public void testSelectTextByDrag_reverse() throws Exception {
    @Test
    public void testSelectTextByDrag_reverse() {
        final String helloWorld = "Hello world!";
        onView(withId(R.id.textview)).perform(mouseClick());
        onView(withId(R.id.textview)).perform(replaceText(helloWorld));
@@ -101,8 +112,8 @@ public class TextViewActivityMouseTest extends ActivityInstrumentationTestCase2<
        onView(withId(R.id.textview)).check(hasSelection("llo wor"));
    }

    @SmallTest
    public void testContextMenu() throws Exception {
    @Test
    public void testContextMenu() {
        final String text = "abc def ghi.";
        onView(withId(R.id.textview)).perform(mouseClick());
        onView(withId(R.id.textview)).perform(replaceText(text));
@@ -113,9 +124,9 @@ public class TextViewActivityMouseTest extends ActivityInstrumentationTestCase2<
                mouseClickOnTextAtIndex(text.indexOf("d"), MotionEvent.BUTTON_SECONDARY));

        assertContextMenuContainsItemDisabled(
                getActivity().getString(com.android.internal.R.string.copy));
                mActivity.getString(com.android.internal.R.string.copy));
        assertContextMenuContainsItemDisabled(
                getActivity().getString(com.android.internal.R.string.undo));
                mActivity.getString(com.android.internal.R.string.undo));

        // Hide context menu.
        pressBack();
@@ -130,9 +141,9 @@ public class TextViewActivityMouseTest extends ActivityInstrumentationTestCase2<
                mouseClickOnTextAtIndex(text.indexOf("d"), MotionEvent.BUTTON_SECONDARY));

        assertContextMenuContainsItemDisabled(
                getActivity().getString(com.android.internal.R.string.copy));
                mActivity.getString(com.android.internal.R.string.copy));
        assertContextMenuContainsItemEnabled(
                getActivity().getString(com.android.internal.R.string.undo));
                mActivity.getString(com.android.internal.R.string.undo));

        // Hide context menu.
        pressBack();
@@ -144,9 +155,9 @@ public class TextViewActivityMouseTest extends ActivityInstrumentationTestCase2<
                mouseClickOnTextAtIndex(text.indexOf("d"), MotionEvent.BUTTON_SECONDARY));

        assertContextMenuContainsItemEnabled(
                getActivity().getString(com.android.internal.R.string.copy));
                mActivity.getString(com.android.internal.R.string.copy));
        assertContextMenuContainsItemEnabled(
                getActivity().getString(com.android.internal.R.string.undo));
                mActivity.getString(com.android.internal.R.string.undo));

        // Hide context menu.
        pressBack();
@@ -156,9 +167,9 @@ public class TextViewActivityMouseTest extends ActivityInstrumentationTestCase2<
        onView(withId(R.id.textview)).perform(
                mouseClickOnTextAtIndex(text.indexOf("i"), MotionEvent.BUTTON_SECONDARY));
        assertContextMenuContainsItemDisabled(
                getActivity().getString(com.android.internal.R.string.copy));
                mActivity.getString(com.android.internal.R.string.copy));
        assertContextMenuContainsItemEnabled(
                getActivity().getString(com.android.internal.R.string.undo));
                mActivity.getString(com.android.internal.R.string.undo));

        // Hide context menu.
        pressBack();
@@ -169,8 +180,8 @@ public class TextViewActivityMouseTest extends ActivityInstrumentationTestCase2<
        // TODO: Add tests for suggestions
    }

    @SmallTest
    public void testDragAndDrop() throws Exception {
    @Test
    public void testDragAndDrop() {
        final String text = "abc def ghi.";
        onView(withId(R.id.textview)).perform(mouseClick());
        onView(withId(R.id.textview)).perform(replaceText(text));
@@ -186,8 +197,8 @@ public class TextViewActivityMouseTest extends ActivityInstrumentationTestCase2<
        onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex("abc ghi.def".length()));
    }

    @SmallTest
    public void testDragAndDrop_longClick() throws Exception {
    @Test
    public void testDragAndDrop_longClick() {
        final String text = "abc def ghi.";
        onView(withId(R.id.textview)).perform(mouseClick());
        onView(withId(R.id.textview)).perform(replaceText(text));
@@ -203,8 +214,8 @@ public class TextViewActivityMouseTest extends ActivityInstrumentationTestCase2<
        onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex("abc ghi.def".length()));
    }

    @SmallTest
    public void testSelectTextByLongClick() throws Exception {
    @Test
    public void testSelectTextByLongClick() {
        final String helloWorld = "Hello world!";
        onView(withId(R.id.textview)).perform(mouseClick());
        onView(withId(R.id.textview)).perform(replaceText(helloWorld));
@@ -228,8 +239,8 @@ public class TextViewActivityMouseTest extends ActivityInstrumentationTestCase2<
        onView(withId(R.id.textview)).check(hasSelection("!"));
    }

    @SmallTest
    public void testSelectTextByDoubleClick() throws Exception {
    @Test
    public void testSelectTextByDoubleClick() {
        final String helloWorld = "hello world!";

        onView(withId(R.id.textview)).perform(mouseClick());
@@ -254,8 +265,8 @@ public class TextViewActivityMouseTest extends ActivityInstrumentationTestCase2<
        onView(withId(R.id.textview)).check(hasSelection("!"));
    }

    @SmallTest
    public void testSelectTextByDoubleClickAndDrag() throws Exception {
    @Test
    public void testSelectTextByDoubleClickAndDrag() {
        final String text = "abcd efg hijk lmn";
        onView(withId(R.id.textview)).perform(mouseClick());
        onView(withId(R.id.textview)).perform(replaceText(text));
@@ -265,8 +276,8 @@ public class TextViewActivityMouseTest extends ActivityInstrumentationTestCase2<
        onView(withId(R.id.textview)).check(hasSelection("efg hijk"));
    }

    @SmallTest
    public void testSelectTextByDoubleClickAndDrag_reverse() throws Exception {
    @Test
    public void testSelectTextByDoubleClickAndDrag_reverse() {
        final String text = "abcd efg hijk lmn";
        onView(withId(R.id.textview)).perform(mouseClick());
        onView(withId(R.id.textview)).perform(replaceText(text));
@@ -276,8 +287,8 @@ public class TextViewActivityMouseTest extends ActivityInstrumentationTestCase2<
        onView(withId(R.id.textview)).check(hasSelection("efg hijk"));
    }

    @SmallTest
    public void testSelectTextByLongPressAndDrag() throws Exception {
    @Test
    public void testSelectTextByLongPressAndDrag() {
        final String text = "abcd efg hijk lmn";
        onView(withId(R.id.textview)).perform(mouseClick());
        onView(withId(R.id.textview)).perform(replaceText(text));
@@ -287,8 +298,8 @@ public class TextViewActivityMouseTest extends ActivityInstrumentationTestCase2<
        onView(withId(R.id.textview)).check(hasSelection("efg hijk"));
    }

    @SmallTest
    public void testSelectTextByLongPressAndDrag_reverse() throws Exception {
    @Test
    public void testSelectTextByLongPressAndDrag_reverse() {
        final String text = "abcd efg hijk lmn";
        onView(withId(R.id.textview)).perform(mouseClick());
        onView(withId(R.id.textview)).perform(replaceText(text));
@@ -298,8 +309,8 @@ public class TextViewActivityMouseTest extends ActivityInstrumentationTestCase2<
        onView(withId(R.id.textview)).check(hasSelection("efg hijk"));
    }

    @SmallTest
    public void testSelectTextByTripleClick() throws Exception {
    @Test
    public void testSelectTextByTripleClick() {
        final StringBuilder builder = new StringBuilder();
        builder.append("First paragraph.\n");
        builder.append("Second paragraph.");
@@ -332,8 +343,8 @@ public class TextViewActivityMouseTest extends ActivityInstrumentationTestCase2<
                text.substring(text.indexOf("Second"), text.indexOf("Third"))));
    }

    @SmallTest
    public void testSelectTextByTripleClickAndDrag() throws Exception {
    @Test
    public void testSelectTextByTripleClickAndDrag() {
        final StringBuilder builder = new StringBuilder();
        builder.append("First paragraph.\n");
        builder.append("Second paragraph.");
@@ -361,8 +372,8 @@ public class TextViewActivityMouseTest extends ActivityInstrumentationTestCase2<
        onView(withId(R.id.textview)).check(hasSelection(text));
    }

    @SmallTest
    public void testSelectTextByTripleClickAndDrag_reverse() throws Exception {
    @Test
    public void testSelectTextByTripleClickAndDrag_reverse() {
        final StringBuilder builder = new StringBuilder();
        builder.append("First paragraph.\n");
        builder.append("Second paragraph.");
+192 −138

File changed.

Preview size limit exceeded, changes collapsed.

+24 −15
Original line number Diff line number Diff line
@@ -20,15 +20,20 @@ import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.MediumTest;
import android.support.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4;
import android.text.SpannedString;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class TextViewPerformanceTest extends AndroidTestCase {
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
public class TextViewPerformanceTest {

    private String mString = "The quick brown fox";
    private Canvas mCanvas;
@@ -36,16 +41,16 @@ public class TextViewPerformanceTest extends AndroidTestCase {
    private Paint mPaint;
    private PerformanceLabelView mLabelView;

    @Override
    protected void setUp() throws Exception {
        super.setUp();

    @Before
    public void setUp() {
        Bitmap mBitmap = Bitmap.createBitmap(320, 240, Bitmap.Config.RGB_565);
        mCanvas = new Canvas(mBitmap);

        ViewGroup.LayoutParams p = new ViewGroup.LayoutParams(320, 240);

        mLabelView = new PerformanceLabelView(mContext);
        final Context context = InstrumentationRegistry.getContext();

        mLabelView = new PerformanceLabelView(context);
        mLabelView.setText(mString);
        mLabelView.measure(View.MeasureSpec.AT_MOST | 320, View.MeasureSpec.AT_MOST | 240);
        mLabelView.mySetFrame(320, 240);
@@ -54,7 +59,7 @@ public class TextViewPerformanceTest extends AndroidTestCase {

        mPaint = new Paint();
        mCanvas.save();
        mTextView = new PerformanceTextView(mContext);
        mTextView = new PerformanceTextView(context);
        mTextView.setLayoutParams(p);
        mTextView.setText(mString);
        mTextView.mySetFrame(320, 240);
@@ -62,7 +67,8 @@ public class TextViewPerformanceTest extends AndroidTestCase {
    }

    @MediumTest
    public void testDrawTextViewLine() throws Exception {
    @Test
    public void testDrawTextViewLine() {
        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);
@@ -76,7 +82,8 @@ public class TextViewPerformanceTest extends AndroidTestCase {
    }

    @SmallTest
    public void testSpan() throws Exception {
    @Test
    public void testSpan() {
        CharSequence charSeq = new SpannedString(mString);
        mTextView.setText(charSeq);

@@ -93,12 +100,14 @@ public class TextViewPerformanceTest extends AndroidTestCase {
    }

    @SmallTest
    public void testCanvasDrawText() throws Exception {
    @Test
    public void testCanvasDrawText() {
        mCanvas.drawText(mString, 30, 30, mPaint);
    }

    @SmallTest
    public void testLabelViewDraw() throws Exception {
    @Test
    public void testLabelViewDraw() {
        mLabelView.myDraw(mCanvas);
    }

Loading