gomu/playingbar_test.go

44 lines
580 B
Go
Raw Normal View History

2020-07-15 21:38:27 +08:00
package main
import (
"testing"
)
func Test_NewPlayingBar(t *testing.T) {
2020-08-22 14:41:03 +08:00
gomu = newGomu()
2020-07-23 15:15:39 +08:00
p := newPlayingBar()
2020-07-15 21:38:27 +08:00
if p.progress == nil {
t.Errorf("chan int == nil")
}
}
func Test_NewProgress(t *testing.T) {
2020-07-23 15:15:39 +08:00
p := newPlayingBar()
2020-07-15 21:38:27 +08:00
full := 100
2020-08-22 14:51:16 +08:00
p.newProgress("sample", full)
2020-07-15 21:38:27 +08:00
if p.full != full {
2020-07-16 22:16:02 +08:00
t.Errorf("Expected %d; got %d", full, p.full)
2020-07-15 21:38:27 +08:00
}
if p._progress != 0 {
2020-07-16 22:16:02 +08:00
t.Errorf("Expected %d; got %d", 0, p._progress)
2020-07-15 21:38:27 +08:00
}
}
func Test_Stop(t *testing.T) {
2020-07-23 15:15:39 +08:00
p := newPlayingBar()
2020-07-15 21:38:27 +08:00
2020-07-23 15:15:39 +08:00
p.stop()
2020-07-15 21:38:27 +08:00
if p.skip == false {
t.Errorf("Expected %t; got %t", true, p.skip)
}
}