From 2547282e0942a09b67fccfd53cf62a403ccd4a52 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Wed, 01 Jul 2026 23:21:18 +0800
Subject: [PATCH] Add slow recognition diagnostics

---
 privatevoice.src/app_live_caption_test.go |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/privatevoice.src/app_live_caption_test.go b/privatevoice.src/app_live_caption_test.go
index c8380a7..321f388 100644
--- a/privatevoice.src/app_live_caption_test.go
+++ b/privatevoice.src/app_live_caption_test.go
@@ -38,12 +38,12 @@
 	}
 }
 
-func TestReleaseTailCaptureDelayDefaultsToProtectionWindow(t *testing.T) {
+func TestReleaseTailCaptureDelayDefaultsToNoProtectionWindow(t *testing.T) {
 	a := &App{}
 	a.replaceEngine(plainTestEngine{})
 
-	if got := a.releaseTailCaptureDelay(); got != defaultReleaseTailDelay {
-		t.Fatalf("releaseTailCaptureDelay() = %v, want %v", got, defaultReleaseTailDelay)
+	if got := a.releaseTailCaptureDelay(); got != 0 {
+		t.Fatalf("releaseTailCaptureDelay() = %v, want 0", got)
 	}
 }
 
@@ -56,6 +56,28 @@
 	}
 }
 
+func TestSlowRecognitionReason(t *testing.T) {
+	tests := []struct {
+		name        string
+		recognizeMS int64
+		totalMS     int64
+		want        string
+	}{
+		{name: "fast", recognizeMS: 2000, totalMS: 2500, want: ""},
+		{name: "recognize", recognizeMS: 2001, totalMS: 2400, want: "recognize"},
+		{name: "total", recognizeMS: 1000, totalMS: 2501, want: "total"},
+		{name: "both", recognizeMS: 2001, totalMS: 2501, want: "recognize,total"},
+	}
+
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := slowRecognitionReason(tt.recognizeMS, tt.totalMS); got != tt.want {
+				t.Fatalf("slowRecognitionReason(%d, %d) = %q, want %q", tt.recognizeMS, tt.totalMS, got, tt.want)
+			}
+		})
+	}
+}
+
 func TestHoldPreCaptureUsesEngineCapability(t *testing.T) {
 	a := &App{}
 	a.replaceEngine(holdPreCaptureTestEngine{enabled: true})

--
Gitblit v1.9.3