feat: add compact progress decimal

This commit is contained in:
2026-10-17 18:26:39 +02:00
parent 117bf77902
commit 3368228537
4 changed files with 20 additions and 5 deletions
+3 -2
View File
@@ -33,9 +33,10 @@ struct SystemPlaybackChecks {
require(compactProgressText(position: position, duration: duration, format: .time) == expected,
"compact time uses total-duration units, truncation and bounded progress: \(expected)")
}
for (position, expected) in [(59.9, "59"), (100.0, "100"), (105.0, "100"), (-1.0, "0")] {
for (position, expected) in [(59.9, "59.9"), (59.99, "59.9"), (0.0, "0.0"),
(100.0, "100.0"), (105.0, "100.0"), (-1.0, "0.0")] {
require(compactProgressText(position: position, duration: 100, format: .percentage) == expected,
"compact percentage is a bounded integer: \(expected)")
"compact percentage has one decimal and stays bounded: \(expected)")
}
for duration in [0.0, -1.0, .nan, .infinity] {
require(compactProgressText(position: 10, duration: duration, format: .time) == nil &&