Ariver
2026-06-13 859c14d783dc31fe68550b114fc8adeea09dab2a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package main
 
import (
    "strings"
    "testing"
)
 
func TestLiveCaptionDisplayTextFitsOverlayBuffer(t *testing.T) {
    input := strings.Repeat("这是一句实时字幕", 12)
    got := liveCaptionDisplayText(input)
    if got == "" {
        t.Fatal("caption should not be empty")
    }
    if len([]byte(got)) > liveCaptionMaxBytes {
        t.Fatalf("caption bytes = %d, want <= %d", len([]byte(got)), liveCaptionMaxBytes)
    }
    if !strings.HasPrefix(got, "...") {
        t.Fatalf("caption = %q, want leading truncation marker", got)
    }
}