|
@@ -53,7 +53,7 @@ func TestNewState(t *testing.T) {
|
|
|
if st.Name != DefaultName || st.Dirty || st.SampleCount != 0 {
|
|
if st.Name != DefaultName || st.Dirty || st.SampleCount != 0 {
|
|
|
t.Errorf("state %q dirty %v samples %d", st.Name, st.Dirty, st.SampleCount)
|
|
t.Errorf("state %q dirty %v samples %d", st.Name, st.Dirty, st.SampleCount)
|
|
|
}
|
|
}
|
|
|
- if len(st.Pads) != 128 || st.Pads[0].Label != "A01" || st.Pads[17].Label != "B02" || st.Pads[127].Label != "H16" {
|
|
|
|
|
|
|
+ if len(st.Pads) != 128 || st.Pads[0].Label != "A1" || st.Pads[17].Label != "B2" || st.Pads[127].Label != "H16" {
|
|
|
t.Fatalf("pads: %d", len(st.Pads))
|
|
t.Fatalf("pads: %d", len(st.Pads))
|
|
|
}
|
|
}
|
|
|
for _, p := range st.Pads {
|
|
for _, p := range st.Pads {
|
|
@@ -61,7 +61,7 @@ func TestNewState(t *testing.T) {
|
|
|
t.Fatalf("pad %s not empty", p.Label)
|
|
t.Fatalf("pad %s not empty", p.Label)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if st.SequenceCount != 1 || st.Sequences[0] != (Sequence{Slot: 0, Label: "A01", Name: "Sequence 01", BPM: 128, Bars: 2}) {
|
|
|
|
|
|
|
+ if st.SequenceCount != 1 || st.Sequences[0] != (Sequence{Slot: 0, Label: "A1", Name: "Sequence 01", BPM: 128, Bars: 2}) {
|
|
|
t.Errorf("sequences %+v", st.Sequences)
|
|
t.Errorf("sequences %+v", st.Sequences)
|
|
|
}
|
|
}
|
|
|
if st.Limits.MaxMuteGroup != 16 || st.Limits.MinBPM != 20 || st.Limits.MaxBPM != 999 || st.Limits.MinCoarse != -24 {
|
|
if st.Limits.MaxMuteGroup != 16 || st.Limits.MinBPM != 20 || st.Limits.MaxBPM != 999 || st.Limits.MinCoarse != -24 {
|
|
@@ -76,7 +76,7 @@ func TestStateJSON(t *testing.T) {
|
|
|
s, _ := newService()
|
|
s, _ := newService()
|
|
|
b, err := json.Marshal(s.State())
|
|
b, err := json.Marshal(s.State())
|
|
|
must(t, err)
|
|
must(t, err)
|
|
|
- for _, key := range []string{`"name":"NewKit"`, `"pads":[{"slot":0,"label":"A01"`, `"sequences":[{"slot":0`, `"limits":{`, `"muteGroup":0`, `"audio":""`} {
|
|
|
|
|
|
|
+ for _, key := range []string{`"name":"NewKit"`, `"pads":[{"slot":0,"label":"A1"`, `"sequences":[{"slot":0`, `"limits":{`, `"muteGroup":0`, `"audio":""`} {
|
|
|
if !strings.Contains(string(b), key) {
|
|
if !strings.Contains(string(b), key) {
|
|
|
t.Errorf("JSON lacks %s", key)
|
|
t.Errorf("JSON lacks %s", key)
|
|
|
}
|
|
}
|
|
@@ -396,7 +396,7 @@ func TestMoveCopySwap(t *testing.T) {
|
|
|
st, err = s.MovePad(40, 0)
|
|
st, err = s.MovePad(40, 0)
|
|
|
must(t, err)
|
|
must(t, err)
|
|
|
if st.Pads[40].File != "" || st.Pads[0].File != "Linn 9000 kick001.wav" || st.Pads[0].Coarse != 0 {
|
|
if st.Pads[40].File != "" || st.Pads[0].File != "Linn 9000 kick001.wav" || st.Pads[0].Coarse != 0 {
|
|
|
- t.Errorf("move: A01 %+v", st.Pads[0])
|
|
|
|
|
|
|
+ t.Errorf("move: A1 %+v", st.Pads[0])
|
|
|
}
|
|
}
|
|
|
if _, err := s.MovePad(0, 128); err == nil {
|
|
if _, err := s.MovePad(0, 128); err == nil {
|
|
|
t.Error("move to slot 128 accepted")
|
|
t.Error("move to slot 128 accepted")
|
|
@@ -420,14 +420,14 @@ func TestLoad(t *testing.T) {
|
|
|
if st.Name != "DemoFile" || st.Dirty || st.SampleCount != 6 || len(res.Warnings) != 0 || res.Path != d.project {
|
|
if st.Name != "DemoFile" || st.Dirty || st.SampleCount != 6 || len(res.Warnings) != 0 || res.Path != d.project {
|
|
|
t.Errorf("load: %q dirty %v samples %d warnings %v", st.Name, st.Dirty, st.SampleCount, res.Warnings)
|
|
t.Errorf("load: %q dirty %v samples %d warnings %v", st.Name, st.Dirty, st.SampleCount, res.Warnings)
|
|
|
}
|
|
}
|
|
|
- // DemoFile has notes on A01-A04 only.
|
|
|
|
|
|
|
+ // DemoFile has notes on A1-A4 only.
|
|
|
for i, p := range st.Pads {
|
|
for i, p := range st.Pads {
|
|
|
if p.HasNotes != (i < 4) {
|
|
if p.HasNotes != (i < 4) {
|
|
|
t.Errorf("%s hasNotes %v", p.Label, p.HasNotes)
|
|
t.Errorf("%s hasNotes %v", p.Label, p.HasNotes)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if !strings.HasPrefix(st.Pads[0].Audio, "/audio/0?k=") || st.Pads[0].End != 44099 {
|
|
if !strings.HasPrefix(st.Pads[0].Audio, "/audio/0?k=") || st.Pads[0].End != 44099 {
|
|
|
- t.Errorf("A01 %+v", st.Pads[0])
|
|
|
|
|
|
|
+ t.Errorf("A1 %+v", st.Pads[0])
|
|
|
}
|
|
}
|
|
|
if st.SequenceCount != 2 || st.Sequences[0].Name != "Intro" || !st.Sequences[0].HasNotes {
|
|
if st.SequenceCount != 2 || st.Sequences[0].Name != "Intro" || !st.Sequences[0].HasNotes {
|
|
|
t.Errorf("sequences %+v", st.Sequences)
|
|
t.Errorf("sequences %+v", st.Sequences)
|
|
@@ -444,7 +444,7 @@ func TestSequences(t *testing.T) {
|
|
|
s, _ := newService()
|
|
s, _ := newService()
|
|
|
st, err := s.AddSequence(20)
|
|
st, err := s.AddSequence(20)
|
|
|
must(t, err)
|
|
must(t, err)
|
|
|
- if st.SequenceCount != 2 || st.Sequences[1] != (Sequence{Slot: 20, Label: "B05", Name: "Sequence 21", BPM: 120, Bars: 2}) {
|
|
|
|
|
|
|
+ if st.SequenceCount != 2 || st.Sequences[1] != (Sequence{Slot: 20, Label: "B5", Name: "Sequence 21", BPM: 120, Bars: 2}) {
|
|
|
t.Errorf("add: %+v", st.Sequences)
|
|
t.Errorf("add: %+v", st.Sequences)
|
|
|
}
|
|
}
|
|
|
st, err = s.SetSequence(20, " Drop ", 140.5, 16)
|
|
st, err = s.SetSequence(20, " Drop ", 140.5, 16)
|
|
@@ -532,10 +532,10 @@ func TestMissingFiles(t *testing.T) {
|
|
|
}
|
|
}
|
|
|
a2 := st.Pads[1]
|
|
a2 := st.Pads[1]
|
|
|
if !a2.Missing || a2.Audio != "" || !strings.HasSuffix(a2.Source, "80s-Snr-Dreamer SA.wav") {
|
|
if !a2.Missing || a2.Audio != "" || !strings.HasSuffix(a2.Source, "80s-Snr-Dreamer SA.wav") {
|
|
|
- t.Errorf("A02 %+v", a2)
|
|
|
|
|
|
|
+ t.Errorf("A2 %+v", a2)
|
|
|
}
|
|
}
|
|
|
if st.Pads[0].Missing || st.Pads[0].Audio == "" {
|
|
if st.Pads[0].Missing || st.Pads[0].Audio == "" {
|
|
|
- t.Error("A01 marked missing")
|
|
|
|
|
|
|
+ t.Error("A1 marked missing")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Export names the missing file and writes nothing.
|
|
// Export names the missing file and writes nothing.
|
|
@@ -590,6 +590,6 @@ func TestLinkedFileIsMissing(t *testing.T) {
|
|
|
res, err := s.LoadPath(path)
|
|
res, err := s.LoadPath(path)
|
|
|
must(t, err)
|
|
must(t, err)
|
|
|
if st := res.State; st.MissingCount != 1 || !st.Pads[1].Missing {
|
|
if st := res.State; st.MissingCount != 1 || !st.Pads[1].Missing {
|
|
|
- t.Errorf("missing count %d, A02 missing %v; want 1, true", st.MissingCount, st.Pads[1].Missing)
|
|
|
|
|
|
|
+ t.Errorf("missing count %d, A2 missing %v; want 1, true", st.MissingCount, st.Pads[1].Missing)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|