-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathflattenCommandArgs.js
39 lines (31 loc) · 951 Bytes
/
flattenCommandArgs.js
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
var test = require('tape')
var flatten = require('../lib/flattenCommandArgs')
function testFlatten (command, expectedArgs) {
test(command.type, function (t) {
var args = flatten(command)
t.same(args, expectedArgs)
t.end()
})
}
testFlatten(
{ type: 'M', relative: false, x: 10, y: 20 },
[10, 20])
testFlatten(
{ type: 'L', relative: false, x: 10, y: 20 },
[10, 20])
testFlatten(
{ type: 'C', relative: false, x1: 10, y1: 20, x2: 30, y2: 40, x: 50, y: 60 },
[10, 20, 30, 40, 50, 60])
testFlatten(
{ type: 'S', relative: false, x2: 30, y2: 40, x: 50, y: 60 },
[30, 40, 50, 60])
testFlatten(
{ type: 'Q', relative: false, x1: 10, y1: 20, x: 50, y: 60 },
[10, 20, 50, 60])
testFlatten(
{ type: 'T', relative: false, x: 10, y: 20 },
[10, 20])
testFlatten(
{ type: 'A', relative: false, rx: 10, ry: 20, x_axis_rotation: 30,
large_arc_flag: 0, sweep_flag: 0, x: 50, y: 60 },
[10, 20, 30, 0, 0, 50, 60])