-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
acade2b
commit 102180a
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as _ from 'radashi' | ||
import { Color } from 'radashi' | ||
|
||
describe('colorMixCMYK', () => { | ||
test('mixes black and white', () => { | ||
expect(_.colorMixCMYK('#000000', '#FFFFFF', 0.5)).toEqual( | ||
new Color(0.5, 0.5, 0.5, 1), | ||
) | ||
}) | ||
test('mixes blue and yellow', () => { | ||
expect(_.colorMixCMYK('#0000FF', '#FFFF00', 0.5)).toEqual( | ||
new Color(0.5, 0.5, 0.5, 1), | ||
) | ||
}) | ||
test('mixes red and green with different ratios', () => { | ||
expect(_.colorMixCMYK('#FF0000', '#00FF00', 0.25)).toEqual( | ||
new Color(0.75, 0, 0.25, 1), | ||
) | ||
expect(_.colorMixCMYK('#FF0000', '#00FF00', 0.75)).toEqual( | ||
new Color(0.25, 0, 0.75, 1), | ||
) | ||
}) | ||
test('handles alpha channel', () => { | ||
expect(_.colorMixCMYK('#FF0000', '#00FF0000', 0.5)).toEqual( | ||
new Color(0.5, 0, 0.5, 0.5), | ||
) | ||
}) | ||
test('mixes CMYK colors', () => { | ||
expect( | ||
_.colorMixCMYK( | ||
{ cyan: 0, magenta: 1, yellow: 0.75, key: 0.5, alpha: 1 }, | ||
{ cyan: 1, magenta: 0.5, yellow: 0.25, key: 0, alpha: 1 }, | ||
0.5, | ||
), | ||
).toEqual(new Color(0.375, 0.375, 0.1875, 1)) | ||
}) | ||
}) |