| | |
| | | } |
| | | } |
| | | |
| | | func TestHoldPreCaptureUsesEngineCapability(t *testing.T) { |
| | | a := &App{} |
| | | a.replaceEngine(holdPreCaptureTestEngine{enabled: true}) |
| | | |
| | | if !a.holdPreCaptureEnabled.Load() { |
| | | t.Fatal("hold pre-capture should be enabled by engine capability") |
| | | } |
| | | } |
| | | |
| | | func TestHoldPreCaptureDefaultsToFalse(t *testing.T) { |
| | | a := &App{} |
| | | a.replaceEngine(plainTestEngine{}) |
| | | |
| | | if a.holdPreCaptureEnabled.Load() { |
| | | t.Fatal("hold pre-capture should default to false") |
| | | } |
| | | } |
| | | |
| | | func TestShouldStartHoldPreCaptureLocked(t *testing.T) { |
| | | a := &App{} |
| | | a.holdPreCaptureEnabled.Store(true) |
| | | |
| | | if !a.shouldStartHoldPreCaptureLocked() { |
| | | t.Fatal("expected hold pre-capture to start when enabled and idle") |
| | | } |
| | | |
| | | a.isRecording = true |
| | | if a.shouldStartHoldPreCaptureLocked() { |
| | | t.Fatal("should not pre-capture while already recording") |
| | | } |
| | | a.isRecording = false |
| | | |
| | | a.isStoppingRecording = true |
| | | if a.shouldStartHoldPreCaptureLocked() { |
| | | t.Fatal("should not pre-capture while stopping") |
| | | } |
| | | a.isStoppingRecording = false |
| | | |
| | | a.isFreetalking = true |
| | | if a.shouldStartHoldPreCaptureLocked() { |
| | | t.Fatal("should not pre-capture while tap recording is active") |
| | | } |
| | | a.isFreetalking = false |
| | | |
| | | a.lastStopTime = time.Now() |
| | | if a.shouldStartHoldPreCaptureLocked() { |
| | | t.Fatal("should not pre-capture during post-stop debounce") |
| | | } |
| | | } |
| | | |
| | | func TestStartRecordingIgnoredWhileStoppingRecording(t *testing.T) { |
| | | a := &App{isStoppingRecording: true} |
| | | |
| | |
| | | func (e tailCaptureTestEngine) ReleaseTailCaptureDelay() time.Duration { |
| | | return e.delay |
| | | } |
| | | |
| | | type holdPreCaptureTestEngine struct { |
| | | plainTestEngine |
| | | enabled bool |
| | | } |
| | | |
| | | func (e holdPreCaptureTestEngine) HoldPreCaptureEnabled() bool { |
| | | return e.enabled |
| | | } |