gomu/playingbar_test.go

48 lines
660 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-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
limit := 100
2020-07-23 15:15:39 +08:00
p.newProgress("sample", full, limit)
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.limit != limit {
2020-07-16 22:16:02 +08:00
t.Errorf("Expected %d; got %d", limit, p.limit)
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)
}
}