test(mac): compare the pill fade start with a tolerance

100/112 is not exactly representable; the CI runner rounds the last bit
differently from the dev machine and the equality failed on main.
This commit is contained in:
iamtoruk 2026-09-02 06:24:28 -07:00
parent 91a11cb89e
commit f223a64bb7

View file

@ -65,7 +65,7 @@ struct CapacityDockGlanceTests {
@Test("The tint's fade tail never inverts on a short fill")
func pillFadeStart() {
// A long band keeps a 12pt tail, so the fade starts near its end.
#expect(CapacityDockGlance.pillFadeStart(filledWidth: 112, scale: 1) == 100.0 / 112.0)
#expect(abs(CapacityDockGlance.pillFadeStart(filledWidth: 112, scale: 1) - 100.0 / 112.0) < 1e-9)
// Shorter than the tail, the whole band is the fade.
#expect(CapacityDockGlance.pillFadeStart(filledWidth: 8, scale: 1) == 0)
#expect(CapacityDockGlance.pillFadeStart(filledWidth: 0, scale: 1) == 0)