-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrender_test.go
More file actions
44 lines (36 loc) · 1.46 KB
/
render_test.go
File metadata and controls
44 lines (36 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package render
import (
"testing"
"github.com/gotracker/playback/mixing/volume"
"github.com/gotracker/playback/note"
)
type stubChannelData struct{}
func (stubChannelData) HasNote() bool { return false }
func (stubChannelData) GetNote() note.Note { return note.EmptyNote{} }
func (stubChannelData) HasInstrument() bool { return false }
func (stubChannelData) GetInstrument() int { return 0 }
func (stubChannelData) HasVolume() bool { return false }
func (stubChannelData) GetVolumeGeneric() volume.Volume { return 0 }
func (stubChannelData) HasCommand() bool { return false }
func (stubChannelData) Channel() uint8 { return 0 }
func (stubChannelData) String() string { return "AAA" }
func (stubChannelData) ShortString() string { return "A" }
func TestRowTextShortAndLong(t *testing.T) {
vm := NewRowViewModel[stubChannelData](3)
vm.Channels[0] = stubChannelData{}
vm.Channels[1] = stubChannelData{}
vm.Channels[2] = stubChannelData{}
short := FormatRowText(vm, false).String()
if short != "|A|A|A|" {
t.Fatalf("unexpected short row text: %q", short)
}
long := FormatRowText(vm, true).String()
if long != "|AAA|AAA|AAA|" {
t.Fatalf("unexpected long row text: %q", long)
}
vm.MaxChannels = 2
truncated := FormatRowText(vm, false).String()
if truncated != "|A|A|" {
t.Fatalf("expected truncation to 2 channels, got %q", truncated)
}
}