0

如何对 forexample() 函数进行单元测试以确保在延迟时间内调用该函数?

private var done : Boolean;

private function forexample():void
{
    done = false;
    TweenMax.delayedCall(3 , toBeCalledFunctionNane);
}

private function toBeCalledFunctionNane():void
{
    done  = true;
}
4

1 回答 1

0

我向你保证,它有效,但如果你想自己看,你可以试试这个:

private var callRegistered : uint = 0;

private function forexample():void
{
    callRegistered = getTimer();
    TweenMax.delayedCall(3 , toBeCalledFunctionNane);
}

private function toBeCalledFunctionNane():void
{
    trace("Function was called after:", getTimer() - callRegistered);
}

这将跟踪调用函数的时间(以毫秒为单位)。

PS您必须添加此导入语句才能使用该getTimer()方法:

import flash.utils.getTimer;
于 2013-07-09T08:29:16.333 回答