mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-19 14:52:40 +08:00
fix pacer-unit-test (#15461)
This commit is contained in:
@@ -111,7 +111,7 @@ export class Pacer {
|
||||
_handleRAF = () => {
|
||||
const elapseTime = performance.now() - this._startTime;
|
||||
const elapseFrame = Math.floor(elapseTime / this._frameTime);
|
||||
if (elapseFrame <= this._frameCount) {
|
||||
if (elapseFrame < this._frameCount) {
|
||||
this._rAF.call(window, this._handleRAF);
|
||||
} else {
|
||||
this._frameCount++;
|
||||
|
||||
@@ -37,7 +37,7 @@ test('pacer', (cb) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let currentCount = calledTime;
|
||||
setTimeout(() => {
|
||||
expect(calledTime).toBe(currentCount);
|
||||
expect(calledTime).toBe(currentCount + 1);
|
||||
}, 100);
|
||||
setTimeout(() => {
|
||||
expect(calledTime).toBeGreaterThan(currentCount);
|
||||
|
||||
Reference in New Issue
Block a user