Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
45 lines
1.4 KiB
Dart
45 lines
1.4 KiB
Dart
import 'dart:convert';
|
|
import 'dart:io';
|
|
|
|
import 'package:cutdex/diagnostics/agent_request_diagnostics.dart';
|
|
import 'package:cutdex/diagnostics/request_report.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
test('concurrent request publication retains the most recent 20 complete reports', () async {
|
|
final root = await Directory.systemTemp.createTemp(
|
|
'cutdex-request-retention-',
|
|
);
|
|
addTearDown(() => root.delete(recursive: true));
|
|
await Future.wait(
|
|
List.generate(
|
|
25,
|
|
(index) => AgentRequestDiagnostics.persist(
|
|
root,
|
|
RequestReport(
|
|
outcome: 'completed',
|
|
elapsedUs: index,
|
|
frames: const RequestFrameReport(
|
|
count: 0,
|
|
slowFrames: 0,
|
|
maxBuildUs: 0,
|
|
maxRasterUs: 0,
|
|
maxTimerDelayUs: 0,
|
|
),
|
|
runs: const [],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
final directory = Directory('${root.path}/diagnostics');
|
|
final files = await directory.list().cast<File>().toList();
|
|
expect(files, hasLength(20));
|
|
final reports = await Future.wait(
|
|
files.map((file) async => jsonDecode(await file.readAsString()) as Map),
|
|
);
|
|
final retained = reports.map((r) => r['elapsedUs'] as int).toList()..sort();
|
|
expect(retained, orderedEquals(List.generate(20, (i) => i + 5)));
|
|
expect(files.any((f) => f.path.endsWith('.tmp')), isFalse);
|
|
});
|
|
}
|