FileDocCategorySizeDatePackage
TextViewPerformanceTest.javaAPI DocAndroid 5.1 API4059Thu Mar 12 22:22:12 GMT 2015android.widget

TextViewPerformanceTest

public class TextViewPerformanceTest extends android.test.AndroidTestCase

Fields Summary
private String
mString
private android.graphics.Canvas
mCanvas
private PerformanceTextView
mTextView
private android.graphics.Paint
mPaint
private PerformanceLabelView
mLabelView
Constructors Summary
Methods Summary
protected voidsetUp()


    
         
        super.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);
        mLabelView.setText(mString);
        mLabelView.measure(View.MeasureSpec.AT_MOST | 320, View.MeasureSpec.AT_MOST | 240);
        mLabelView.mySetFrame(320, 240);
        mLabelView.setLayoutParams(p);
        mLabelView.myDraw(mCanvas);

        mPaint = new Paint();
        mCanvas.save();
        mTextView = new PerformanceTextView(mContext);
        mTextView.setLayoutParams(p);
        mTextView.setText(mString);
        mTextView.mySetFrame(320, 240);
        mTextView.measure(View.MeasureSpec.AT_MOST | 320, View.MeasureSpec.AT_MOST | 240);
    
public voidtestCanvasDrawText()

        mCanvas.drawText(mString, 30, 30, mPaint);
    
public voidtestDrawTextViewLine()

        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);
    
public voidtestLabelViewDraw()

        mLabelView.myDraw(mCanvas);
    
public voidtestSpan()

        CharSequence charSeq = new SpannedString(mString);
        mTextView.setText(charSeq);

        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);
        mTextView.myDraw(mCanvas);