Fix benchmark progress bar percentage calculation

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 <noreply@anthropic.com>
This commit is contained in:
Stu Leak 2025-12-13 14:04:20 -05:00
parent 1447e1478f
commit b01e83b97c
2 changed files with 10 additions and 3 deletions

View File

@ -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()

View File

@ -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()