-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
51 lines (44 loc) · 867 Bytes
/
test.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
40
41
42
43
44
45
46
47
48
49
50
51
var test = require('tape')
var { composite, over } = require('./')
test('over function', function (t) {
t.plan(3)
t.same(
over('rgba(127, 195, 255, 0.5)', 'rgba(195, 127, 255, 0.75)'),
{
space: 'rgb',
values: [ 156, 166, 255 ],
alpha: 0.875
}
)
t.same(
over('rgba(255, 0, 0, 0.5)', 'rgba(0, 255, 0, 0.5)'),
{
space: 'rgb',
values: [ 170, 85, 0 ],
alpha: 0.75
}
)
t.same(
over('rgba(180, 26, 60, 0.25)', 'rgba(57, 124, 142, 0.75)'),
{
space: 'rgb',
values: [ 95, 94, 117 ],
alpha: 0.8125
}
)
})
test('layer function', function (t) {
t.plan(1)
t.same(
composite([
'rgba(255, 0, 0, 0.3)',
'rgba(0, 255, 0, 0.3)',
'rgba(0, 0, 255, 0.3)'
]),
{
space: 'rgb',
values: [ 116, 82, 57 ],
alpha: 0.657
}
)
})