fix(video): preserve decimal latency display
This commit is contained in:
parent
218b5408f5
commit
fc4790baa9
2 changed files with 18 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
17
test/screens/channel/video/video_store_latency_js_test.dart
Normal file
17
test/screens/channel/video/video_store_latency_js_test.dart
Normal 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'")));
|
||||
},
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue