Reject file playback in tone-test mode
This commit is contained in:
committed by
Brandon McGinty
parent
1081d894c9
commit
219acad951
@@ -95,6 +95,16 @@ func TestCleanupConnectionAudioIsIdempotent(t *testing.T) {
|
|||||||
b.cleanupConnectionAudio()
|
b.cleanupConnectionAudio()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tone test mode intentionally does not create an OpenAL stream. Tree
|
||||||
|
// controls must therefore keep local mute state without trying to update one.
|
||||||
|
func TestUpdateUserGainAllowsToneTestWithoutStream(t *testing.T) {
|
||||||
|
(&Barnard{ToneTest: true}).updateUserGain(&gumble.User{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestToneTestRejectsFilePlayback(t *testing.T) {
|
||||||
|
(&Barnard{ToneTest: true, Connected: true}).CommandPlayFile(nil, "https://example.invalid/audio")
|
||||||
|
}
|
||||||
|
|
||||||
func TestUserChangeNotification(t *testing.T) {
|
func TestUserChangeNotification(t *testing.T) {
|
||||||
current := &gumble.Channel{ID: 1, Name: "Current"}
|
current := &gumble.Channel{ID: 1, Name: "Current"}
|
||||||
other := &gumble.Channel{ID: 2, Name: "Other"}
|
other := &gumble.Channel{ID: 2, Name: "Other"}
|
||||||
|
|||||||
@@ -240,11 +240,19 @@ func (b *Barnard) CommandPlayFile(ui *uiterm.Ui, cmd string) {
|
|||||||
b.AddOutputLine("Not connected to server")
|
b.AddOutputLine("Not connected to server")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if b.ToneTest {
|
||||||
|
b.AddOutputLine("File playback is unavailable in tone test mode")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
b.FileStreamMutex.Lock()
|
b.FileStreamMutex.Lock()
|
||||||
defer b.FileStreamMutex.Unlock()
|
defer b.FileStreamMutex.Unlock()
|
||||||
|
if b.FileStream == nil {
|
||||||
|
b.AddOutputLine("File playback is unavailable while reconnecting")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if b.FileStream != nil && b.FileStream.IsPlaying() {
|
if b.FileStream.IsPlaying() {
|
||||||
b.AddOutputLine("Already playing a file. Use /stop first.")
|
b.AddOutputLine("Already playing a file. Use /stop first.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user