From b01e83b97c80ffb605d1556ae6debdf8878b95da Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Sat, 13 Dec 2025 14:04:20 -0500 Subject: [PATCH] Fix benchmark progress bar percentage calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The progress bar was configured with Max=100 but we were setting values in the 0.0-1.0 range, causing it to always show ~0%. Fixed by multiplying the percentage by 100 before setting the value, so 4/22 = 0.18 becomes 18% instead of 0.18%. Also fixed SetComplete() to set 100.0 instead of 1.0. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- internal/benchmark/benchmark.go | 9 ++++++++- internal/ui/benchmarkview.go | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/internal/benchmark/benchmark.go b/internal/benchmark/benchmark.go index ad9175d..7e83c1f 100644 --- a/internal/benchmark/benchmark.go +++ b/internal/benchmark/benchmark.go @@ -200,14 +200,21 @@ func (s *Suite) RunFullSuite(ctx context.Context, availableEncoders []string) er } for _, preset := range test.presets { - current++ + // Report progress before starting test if s.Progress != nil { s.Progress(current, totalTests, test.encoder, preset) } + // Run the test result := s.TestEncoder(ctx, test.encoder, preset) s.Results = append(s.Results, result) + // Increment and report completion + current++ + if s.Progress != nil { + s.Progress(current, totalTests, test.encoder, preset) + } + // Check for context cancellation if ctx.Err() != nil { return ctx.Err() diff --git a/internal/ui/benchmarkview.go b/internal/ui/benchmarkview.go index 06eb6ff..48ba176 100644 --- a/internal/ui/benchmarkview.go +++ b/internal/ui/benchmarkview.go @@ -112,7 +112,7 @@ func (v *BenchmarkProgressView) GetContainer() *fyne.Container { // UpdateProgress updates the progress bar and labels func (v *BenchmarkProgressView) UpdateProgress(current, total int, encoder, preset string) { - pct := float64(current) / float64(total) + pct := (float64(current) / float64(total)) * 100 // Convert to 0-100 range fyne.CurrentApp().Driver().DoFromGoroutine(func() { v.progressBar.SetValue(pct) v.statusLabel.SetText(fmt.Sprintf("Testing encoder %d of %d", current, total)) @@ -174,7 +174,7 @@ func (v *BenchmarkProgressView) AddResult(result benchmark.Result) { func (v *BenchmarkProgressView) SetComplete() { fyne.CurrentApp().Driver().DoFromGoroutine(func() { v.statusLabel.SetText("Benchmark complete!") - v.progressBar.SetValue(1.0) + v.progressBar.SetValue(100.0) v.currentLabel.SetText("") v.cancelBtn.SetText("Close") v.statusLabel.Refresh()