Fix About page byte size formatting boundaries

SA
1d ago
+36-9

Summary

Fixes #4790.

SettingsPaneAboutViewModel.BytesToReadableString now formats exact unit boundaries as the larger unit (1024 -> 1 KB), formats one byte as 1 B, and promotes a unit when two-decimal rounding would otherwise display 1024 of the smaller unit (1048575 -> 1 MB). Counts below 1 KB remain in bytes (1023 -> 1023 B). The helper is internal to the existing test assembly through InternalsVisibleTo, with culture-pinned NUnit coverage for 0, 1, 1023, 1024, 1536, 1048575, 1048576, and 1073741824 bytes.

Verification

  • Reproduced before the fix by invoking the actual compiled helper on Linux: 1 -> 0 B, 1024 -> 1024 B, 1048576 -> 1024 KB, and 1073741824 -> 1024 MB; after the fix all eight expected outputs passed, including 1024 -> 1 KB, 1536 -> 1.5 KB, and 1048575 -> 1 MB.
  • dotnet build Flow.Launcher.Test/Flow.Launcher.Test.csproj -p:EnableWindowsTargeting=true --no-restore --verbosity minimal: passed with 0 errors. The exact Linux checkout initially hit existing Linux-only build blockers (Localize generation failures in projects using Flow.Launcher.Localization 0.0.6, then the unconditional Windows taskkill pre-build command), so compilation was verified with a temporary local-only 0.0.7 package bump and a no-op taskkill shim; neither workaround is included in this PR.
  • dotnet test Flow.Launcher.Test/Flow.Launcher.Test.csproj -p:EnableWindowsTargeting=true --filter FullyQualifiedName~SettingsPaneAboutViewModelTest: the test assembly compiled, but execution is not possible on Linux because the Windows-targeted testhost requires the unavailable Microsoft.WindowsDesktop.App runtime. The NUnit cases therefore compile here but still need Windows CI to execute.
  • git diff --check: passed.
  • dotnet format whitespace --verify-no-changes --include <changed files> is not clean in this Linux checkout because the files are checked out with LF endings while .editorconfig requests CRLF; it also reports pre-existing whitespace outside this change.