android封装多肽,深度探索C++对象模型之(四)...-Android.animation cts fail-Rails helper_169IT.COM...
這兩天查cts 的fail, android.animation中有3個fail。
分別為testCurrentPlayTime,testCancel,testSetCurrentPlayTime,在此對著三個fail我的跟蹤解析情況做一說明。
1.??????testCancel:如前一封mail說的,是testCode本身有點問題,后來我改了testcode驗證:按照4.1的寫法,我寫了腳本跑整個包10遍,測了兩遍腳本,相當于20遍,未重現。注:按ICS的testcode,跑完10遍這個會fail2~3遍的。
2.??????testCurrentPlayTime:其測試用例如下:
public void testCurrentPlayTime()throws Throwable {
startAnimation(mValueAnimator);
Thread.sleep(200);
這里的值原來是100,我改成了200進行測試,也是用剛才的腳本共跑了20遍未出錯。
long currentPlayTime = mValueAnimator.getCurrentPlayTime();
assertTrue(currentPlayTime? >? 0);
}
我簡單說明為什么我把上面的100改成了200就ok了。因為startAnimation(mValueAnimator);會在UI線程去調用\framework\base\core\java\android\animation\ValueAnimator.java中的start函數,這個函數會進行一系列的處理,包括發送消息出去等。
mValueAnimator.getCurrentPlayTime();這個函數如下:?? ?public long getCurrentPlayTime() {
if(!mInitialized) Log.d(TAG,"mInitialized is false!!!");
if(mPlayingState ==STOPPED) Log.d(TAG, "mPlayingState == STOPPED!!!");
if (!mInitialized || mPlayingState ==STOPPED) {
Log.d(TAG,"getCurrentPlayTime");
return 0;
}
longcurrentTime=AnimationUtils.currentAnimationTimeMillis();
Log.d(TAG,"getCurrentPlayTime,currentTime is "+currentTime);
return currentTime - mStartTime;
}
其中的mPlayingState如果是STOPPED的話,就會返回0.而這個mPlayingState的初始值是STOPPED,是在上面所說的start函數中會發消息出去,然后有handler去處理。如果在100ms內處理的話,就不會fail,但是若getCurrentPlayTime在處理完之前調用,就會得到0,所以就fail。
錯誤時打的log:(getCurrentPlayTime在handleMessage之前)
D/ValueAnimator( 3336): ?animationHandler.sendEmptyMessage(ANIMATION_START)
D/ValueAnimator( 3336): Start the animation playing
D/ValueAnimator( 3336): ?This sets the initial value of the animation, prior to actually starting it running
D/ValueAnimator( 3336): mInitialized is false!!!
D/ValueAnimator( 3336): mPlayingState == STOPPED!!!
D/ValueAnimator( 3336): getCurrentPlayTime
D/ValueAnimator( 3336): setCurrentPlayTime!!!currentTime is 4215917
D/ValueAnimator( 3336): before animationFrame-----------mStartTime is 4215917
D/ValueAnimator( 3336): after animationFrame-----------mStartTime is 4215917
D/ValueAnimator( 3336): ?onAnimationStart
D/ValueAnimator( 3336): ?animationHandler.sendEmptyMessage(ANIMATION_START)
I/TAG ? ? ( 1828): sync time from stream----------------------@@@
D/ValueAnimator( 3336): mPlayingState == STOPPED!!!
D/ValueAnimator( 3336): getCurrentPlayTime
D/ValueAnimator( 3336): handleMessage:ANIMATION_START
D/ValueAnimator( 3336): startAnimation----Called internally to start an animation by adding it to the active animations list. Must be called on the UI thread
D/ValueAnimator( 3336): anim.startAnimation-----------
D/ValueAnimator( 3336): startAnimation----Called internally to start an animation by adding it to the active animations list. Must be called on the UI thread
D/ValueAnimator( 3336): anim.startAnimation-----------
D/ValueAnimator( 3336): handleMessage:ANIMATION_START
正確時打的log:(getCurrentPlayTime在handleMessage之后)
D/ValueAnimator( 3305): ?animationHandler.sendEmptyMessage(ANIMATION_START)
D/ValueAnimator( 3305): Start the animation playing
D/ValueAnimator( 3305): ?This sets the initial value of the animation, prior to actually starting it running
D/ValueAnimator( 3305): mInitialized is false!!!
D/ValueAnimator( 3305): mPlayingState == STOPPED!!!
D/ValueAnimator( 3305): getCurrentPlayTime
D/ValueAnimator( 3305): setCurrentPlayTime!!!currentTime is 4213321
D/ValueAnimator( 3305): before animationFrame-----------mStartTime is 4213321
D/ValueAnimator( 3305): after animationFrame-----------mStartTime is 4213321
D/ValueAnimator( 3305): ?onAnimationStart
D/ValueAnimator( 3305): ?animationHandler.sendEmptyMessage(ANIMATION_START)
D/ValueAnimator( 3305): handleMessage:ANIMATION_START
D/ValueAnimator( 3305): startAnimation----Called internally to start an animation by adding it to the active animations list. Must be called on the UI thread
D/ValueAnimator( 3305): anim.startAnimation-----------
D/ValueAnimator( 3305): startAnimation----Called internally to start an animation by adding it to the active animations list. Must be called on the UI thread
D/ValueAnimator( 3305): anim.startAnimation-----------
D/ValueAnimator( 3305): handleMessage:ANIMATION_S
總結
以上是生活随笔為你收集整理的android封装多肽,深度探索C++对象模型之(四)...-Android.animation cts fail-Rails helper_169IT.COM...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android自定义下载框架,Andro
- 下一篇: mvc html.hidden,MVC