From c4e0c74f0608626ecf55a3afe0e74ef25dacb0b3 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 9 Apr 2026 08:42:36 +0300 Subject: Add shared-text test coverage --- android_shared_stub_test.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'android_shared_stub_test.go') diff --git a/android_shared_stub_test.go b/android_shared_stub_test.go index cc62f5d..7b42b3a 100644 --- a/android_shared_stub_test.go +++ b/android_shared_stub_test.go @@ -13,3 +13,39 @@ func TestReadSharedFromCacheStub(t *testing.T) { t.Errorf("stub returned non-empty text: %q", txt) } } + +func TestHandleSharedTextLoadAutoLogSkipsEmptyStubText(t *testing.T) { + var clearCalls int + + handleSharedTextLoad( + "", + true, + t.TempDir(), + func(string) { + t.Fatal("prefill should not be called for empty shared text") + }, + func() { + t.Fatal("focus should not be called for empty shared text") + }, + func() { + t.Fatal("resetInput should not be called for empty shared text") + }, + func() { + clearCalls++ + }, + func(string, string) error { + t.Fatal("logEntry should not be called for empty shared text") + return nil + }, + func(string, string) { + t.Fatal("info dialog should not be shown for empty shared text") + }, + func(error) { + t.Fatal("error dialog should not be shown for empty shared text") + }, + ) + + if clearCalls != 1 { + t.Fatalf("expected cache cleanup once, got %d", clearCalls) + } +} -- cgit v1.2.3