6254c0431e
- Conversion now happens inline on the file list — status column updates from idle → converting... → done/error in place (no separate screen) - Fixed value-receiver bug in convertNext() that prevented 'converting' status from being displayed - Added cwebp fallback for PNG/JPEG → WebP (ffmpeg webp encoder often missing on macOS) - Format selector arrows hidden during conversion/results states - Simplified to 2 states: stateFileList + stateResults - Added tests for conversion state machine and view rendering
29 lines
628 B
Go
29 lines
628 B
Go
package converter
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestConvertImage(t *testing.T) {
|
|
// Find a test PNG file
|
|
testFile := filepath.Join("..", "..", "..", "public", "logo.png")
|
|
if _, err := os.Stat(testFile); err != nil {
|
|
t.Skipf("test file not found: %s", testFile)
|
|
}
|
|
|
|
outDir := t.TempDir()
|
|
result := Convert(testFile, "webp", outDir)
|
|
if result.Err != nil {
|
|
t.Fatalf("conversion failed: %v", result.Err)
|
|
}
|
|
|
|
info, err := os.Stat(result.OutputPath)
|
|
if err != nil {
|
|
t.Fatalf("output file not found: %v", err)
|
|
}
|
|
|
|
t.Logf("Converted %s -> %s (%d bytes)", testFile, result.OutputPath, info.Size())
|
|
}
|