|
@@ -12,93 +12,55 @@ var frameDir = path.join(__dirname, "tmp", "frames");
|
12
|
12
|
|
13
|
13
|
var waveform = [[0, 1, 0], [1, 0.1, 1]];
|
14
|
14
|
|
15
|
|
-tape.test("Draw frame", function(test){
|
16
|
|
-
|
17
|
|
- var options = {
|
18
|
|
- width: 1280,
|
19
|
|
- height: 720,
|
20
|
|
- backgroundColor: "#f00",
|
21
|
|
- foregroundColor: "#fff",
|
22
|
|
- waveTop: 340,
|
23
|
|
- waveBottom: 380
|
24
|
|
- };
|
|
15
|
+function tester(options) {
|
25
|
16
|
|
26
|
|
- initializeCanvas(options, function(err, renderer){
|
|
17
|
+ return function(test) {
|
27
|
18
|
|
28
|
|
- test.error(err);
|
|
19
|
+ initializeCanvas(options, function(err, renderer){
|
29
|
20
|
|
30
|
|
- drawFrames(renderer, {
|
31
|
|
- numFrames: 2,
|
32
|
|
- frameDir: frameDir,
|
33
|
|
- width: options.width,
|
34
|
|
- height: options.height,
|
35
|
|
- waveform: waveform
|
36
|
|
- }, function(err){
|
37
|
21
|
test.error(err);
|
38
|
|
- checkFrame(test, options);
|
39
|
|
- });
|
40
|
|
-
|
41
|
|
- });
|
42
|
|
-
|
43
|
|
-});
|
44
|
22
|
|
45
|
|
-tape.test("Default colors", function(test){
|
|
23
|
+ drawFrames(renderer, {
|
|
24
|
+ numFrames: waveform.length,
|
|
25
|
+ frameDir: frameDir,
|
|
26
|
+ width: options.width,
|
|
27
|
+ height: options.height,
|
|
28
|
+ waveform: waveform
|
|
29
|
+ }, function(err){
|
|
30
|
+ test.error(err);
|
|
31
|
+ checkFrame(test, options);
|
|
32
|
+ });
|
46
|
33
|
|
47
|
|
- var options = {
|
48
|
|
- width: 1280,
|
49
|
|
- height: 720,
|
50
|
|
- waveTop: 340,
|
51
|
|
- waveBottom: 380
|
52
|
|
- };
|
53
|
|
-
|
54
|
|
- initializeCanvas(options, function(err, renderer){
|
55
|
|
-
|
56
|
|
- test.error(err);
|
57
|
|
-
|
58
|
|
- drawFrames(renderer, {
|
59
|
|
- numFrames: 2,
|
60
|
|
- frameDir: frameDir,
|
61
|
|
- width: options.width,
|
62
|
|
- height: options.height,
|
63
|
|
- waveform: waveform
|
64
|
|
- }, function(err){
|
65
|
|
- test.error(err);
|
66
|
|
- checkFrame(test, options);
|
67
|
34
|
});
|
68
|
35
|
|
69
|
|
- });
|
70
|
|
-
|
71
|
|
-});
|
72
|
|
-
|
73
|
|
-tape.test("Square frame", function(test){
|
74
|
|
-
|
75
|
|
- var options = {
|
76
|
|
- width: 720,
|
77
|
|
- height: 720,
|
78
|
|
- backgroundColor: "#f00",
|
79
|
|
- foregroundColor: "#fff",
|
80
|
|
- waveTop: 340,
|
81
|
|
- waveBottom: 380
|
82
|
36
|
};
|
83
|
37
|
|
84
|
|
- initializeCanvas(options, function(err, renderer){
|
85
|
|
-
|
86
|
|
- test.error(err);
|
87
|
|
-
|
88
|
|
- drawFrames(renderer, {
|
89
|
|
- numFrames: 2,
|
90
|
|
- frameDir: frameDir,
|
91
|
|
- width: options.width,
|
92
|
|
- height: options.height,
|
93
|
|
- waveform: waveform
|
94
|
|
- }, function(err){
|
95
|
|
- test.error(err);
|
96
|
|
- checkFrame(test, options);
|
97
|
|
- });
|
98
|
|
-
|
99
|
|
- });
|
|
38
|
+}
|
100
|
39
|
|
101
|
|
-});
|
|
40
|
+tape.test("Draw frame", tester({
|
|
41
|
+ width: 1280,
|
|
42
|
+ height: 720,
|
|
43
|
+ backgroundColor: "#f00",
|
|
44
|
+ foregroundColor: "#fff",
|
|
45
|
+ waveTop: 340,
|
|
46
|
+ waveBottom: 380
|
|
47
|
+}));
|
|
48
|
+
|
|
49
|
+tape.test("Default colors", tester({
|
|
50
|
+ width: 1280,
|
|
51
|
+ height: 720,
|
|
52
|
+ waveTop: 340,
|
|
53
|
+ waveBottom: 380
|
|
54
|
+}));
|
|
55
|
+
|
|
56
|
+tape.test("Square frame", tester({
|
|
57
|
+ width: 720,
|
|
58
|
+ height: 720,
|
|
59
|
+ backgroundColor: "#f00",
|
|
60
|
+ foregroundColor: "#fff",
|
|
61
|
+ waveTop: 340,
|
|
62
|
+ waveBottom: 380
|
|
63
|
+}));
|
102
|
64
|
|
103
|
65
|
function checkFrame(test, options) {
|
104
|
66
|
|