mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-17 09:30:58 -07:00
Improve tracking of animated components. (#12618)
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
FRAME_TIMESTAMP_CAPACITY,
|
||||
} from './DebugProfiler.js';
|
||||
import { FixedDeque } from 'mnemonist';
|
||||
import { debugState } from '../debug.js';
|
||||
|
||||
describe('DebugProfiler', () => {
|
||||
beforeEach(() => {
|
||||
@@ -29,12 +30,14 @@ describe('DebugProfiler', () => {
|
||||
Array,
|
||||
ACTION_TIMESTAMP_CAPACITY,
|
||||
);
|
||||
debugState.debugNumAnimatedComponents = 0;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
profiler.actionTimestamps.clear();
|
||||
profiler.possiblyIdleFrameTimestamps.clear();
|
||||
debugState.debugNumAnimatedComponents = 0;
|
||||
});
|
||||
|
||||
it('should not exceed action timestamp capacity', () => {
|
||||
@@ -193,4 +196,20 @@ describe('DebugProfiler', () => {
|
||||
|
||||
expect(profiler.totalIdleFrames).toBe(0);
|
||||
});
|
||||
|
||||
it('should not report frames as idle if debugNumAnimatedComponents > 0', async () => {
|
||||
const startTime = Date.now();
|
||||
vi.setSystemTime(startTime);
|
||||
debugState.debugNumAnimatedComponents = 1;
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
profiler.reportFrameRendered();
|
||||
vi.advanceTimersByTime(20);
|
||||
}
|
||||
|
||||
vi.advanceTimersByTime(1000);
|
||||
profiler.checkForIdleFrames();
|
||||
|
||||
expect(profiler.totalIdleFrames).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user