FileDocCategorySizeDatePackage
TextViewPerformanceTest.javaAPI DocAndroid 1.5 API4067Wed May 06 22:42:02 BST 2009com.android.unit_tests

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);