fix(video): preserve decimal latency display

This commit is contained in:
kaoru 2026-06-14 22:04:50 -04:00
parent 218b5408f5
commit fc4790baa9
2 changed files with 18 additions and 1 deletions

View file

@ -782,7 +782,7 @@ abstract class VideoStoreBase with Store {
// Convert to abbreviated unit: "4.69 sec." -> "4.69s"
const match = latencyText.match(/([0-9.]+)\s*sec/i);
if (match) {
latencyText = Math.round(parseFloat(match[1])) + 's';
latencyText = parseFloat(match[1]).toFixed(2) + 's';
this.hasInitialLatency = true;
}

View file

@ -0,0 +1,17 @@
import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
void main() {
test(
'webview latency tracker keeps two decimal places in overlay labels',
() {
final source = File(
'lib/screens/channel/video/video_store.dart',
).readAsStringSync();
expect(source, contains("parseFloat(match[1]).toFixed(2) + 's'"));
expect(source, isNot(contains("Math.round(parseFloat(match[1])) + 's'")));
},
);
}