Files
geo/server/internal/shared/digitocr/digitocr_test.go
T
root 9d6181260a
Desktop Client Build / Resolve Build Metadata (push) Successful in 43s
Frontend CI / Frontend (push) Successful in 3m49s
Backend CI / Backend (push) Failing after 7m10s
Desktop Client Build / Build Desktop Client (push) Successful in 23m4s
Desktop Client Build / Publish Client Artifacts to NAS (push) Successful in 28s
feat(media-supply): add media resource supply marketplace
Introduce an end-to-end media-supply feature: tenant-side resource sync
service/worker backed by a Meijiequan supplier client, ops-side management
APIs, and admin/ops web views for resources, orders, favorites and
submission. Adds a shared digitocr helper, MediaSupply config blocks for
tenant and ops, shared types, and migrations for supplier media resources,
price overrides, customer visibility and order refunds.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-29 23:17:01 +08:00

31 lines
773 B
Go

package digitocr
import (
"image"
"image/color"
"testing"
)
// 用一张内存图测试链路:4 个矩形色块,颜色满足 IsOrange,等距排布。
// 训练前 Templates 全 0,所以匹配结果都是 0,但能验证切分和归一化不 panic。
func TestRecognizeImage_SmokeTest(t *testing.T) {
img := image.NewRGBA(image.Rect(0, 0, 50, 25))
orange := color.RGBA{R: 240, G: 130, B: 40, A: 255}
// 4 个 8x16 的实心块,模拟 4 个数字
for d := 0; d < 4; d++ {
x0 := 5 + d*10
for y := 5; y < 21; y++ {
for x := x0; x < x0+8; x++ {
img.Set(x, y, orange)
}
}
}
got, err := RecognizeImage(img, Options{})
if err != nil {
t.Fatalf("RecognizeImage: %v", err)
}
if len(got) != 4 {
t.Fatalf("want 4 digits, got %q", got)
}
}