这两天查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...相关推荐

  1. C++-----深度探索C++对象模型-第四章-Function语意学(二)

    1.多态对象有某种形式执行期类型判断法,多态其实就是使用一个基类指针寻址出一个派生类对象的意思. 2.识别一个class是否支持多态,唯一的方法就是看它是否有任何虚函数. 1)编译期,找到虚函数表,每 ...

  2. 深度探索C++ 对象模型(1)-三种对象模型的设计

    1.类的成员 数据成员 . Static . Nonstatic 成员函数 . Static . Nonstatic . virtual Questions: C++封装带来的布局成本是多大? 由空类 ...

  3. 《深度探索C++对象模型(Inside The C++ Object Model )》学习笔记

    来源:http://dsqiu.iteye.com/blog/1669614 之前一直对C++内部的原理的完全空白,然后找到<Inside The C++ Object Model>这本书 ...

  4. 《深度探索C++对象模型》--5 构造析构拷贝 6 执行期语意学

     <深度探索C++对象模型>--5构造.析构.拷贝语意学 1.纯虚函数: (1)C++可以定义和调用一个纯虚函数,不过只可以静态调用,不可以由虚拟机制调用. 注意:pure virtu ...

  5. 深度探索C++ 对象模型(7)-Data member的布局(虚继承)

    虚拟继承 namespace ObjectMultiDerived {class Point2d {public:// has virtual functionsvirtual void print( ...

  6. 深度探索C++ 对象模型(7)-Data member的布局(多重继承)

    多重继承 namespace ObjectMultiDerived {class Point2d {public:// has virtual functionsvirtual void print( ...

  7. 深度探索C++ 对象模型(7)-Data member的布局(无继承、继承无多态、继承多态、多层继承)

    无继承 继承无多态 继承多态 虚表 : 用来存放基类的每一个虚函数,再加上首位的一个slots(支持RTTI). 每个class object导入一个vptr,提供执行期的链接,使得每一个class ...

  8. 深度探索C++ 对象模型(6)-Data member的存取

    nonstatic data member 需要在class object起始地址加上该member的偏移. class A {public: int x; int y;}; A a; a.y = 0 ...

  9. 深度探索C++ 对象模型(6)-Data member的绑定

    防御性程序设计 1).将class声明起头处放data member; 代码示例: class Point3d{ float x,y,z; public://etc } 2). class的声明处放i ...

最新文章

  1. 基于生成对抗网络(GAN)的人脸变形(附链接) | CSDN博文精选
  2. matlab sisotool工具箱实例,MATLAB工具箱Sisotool工具箱在控制系统补偿器中的应用
  3. 【知乎热议】算法岗平时需要自己写cuda吗?
  4. 线程池ThreadPool知识碎片和使用经验速记
  5. 1.9 池化层-深度学习第四课《卷积神经网络》-Stanford吴恩达教授
  6. Homebrew学习(六)之替换及重置homebrew、Homebred Core、Homebrew cask默认源
  7. SQL 连接字符串的说明(转)
  8. 前端学习(2752):global全局设置
  9. 我见过太多PhD,精神崩溃、心态失衡、身体垮掉、一事无成
  10. java泊松分布_Java中利用Math.random()产生服从泊松分布的随机数
  11. 计算机系统繁体环境,繁体简体转换
  12. 手机电视标准对峙激化
  13. HDU 2389 Rain on your Parade(二分匹配+Hopcroft-Carp算法模板题)
  14. bzoj3123【SDOI2013】森林
  15. 《增强现实:融合现实与虚拟世界》
  16. 用 Python 创作酷炫的几何图形
  17. 零束银河全栈技术解决方案之网络安全
  18. mysql 不免费了? java收费还远吗?
  19. windows和Linux未来,一家之言:Windows系统的未来就是变成Linux的一部分
  20. pta-7-5 字符串对比 (15 分)

热门文章

  1. WebStorm常用设置(转载)
  2. 设计模式学习笔记——命令模式(Command)
  3. Hadoop安装记录(伪分布式)
  4. 北京大力度建设城市绿道,我们身边处处是风景
  5. 人工智能突破!牛津大学的科学家用机器合成了“类人类思想”
  6. usb类调用失败解释
  7. Android Activity的理解
  8. jstat 内存泄漏_一次Java内存泄漏的排查!要了自己的老命!
  9. python语言的主要网站是_python语言主要是做什么的
  10. 040_Tooltip文字提示