1
0
قرینه از https://github.com/matomo-org/matomo.git synced 2025-08-22 23:17:46 +00:00
Files
matomo/node_modules/chroma-js/test/lcorrection-test.coffee
diosmosis b12946909f run npm update and include node_modules (#16079)
* update npm packages to latest

* fix javascript path location

* update screenshots

* Add node_modules for users that do not have npm insalled but use git to deploy.

* fix release checklist test

* Add old chroma-js + some files missing from node_module.

* remove npm install

* fix .travis.yml

* update expected screenshots

* update submodule

Co-authored-by: sgiehl <stefan@matomo.org>
2020-06-26 02:33:41 -07:00

48 خطوط
2.0 KiB
CoffeeScript
Vendored

require 'es6-shim'
vows = require 'vows'
assert = require 'assert'
chroma = require '../chroma'
vows
.describe('Testing lightess correction')
.addBatch
'simple two color linear interpolation':
topic: -> chroma.scale(['white', 'black']).mode('lab')
'center L is 50': (topic) ->
assert.equal Math.round(topic(0.5).lab()[0]), 50
'hot - w/o correction':
topic: -> chroma.scale(['white', 'yellow', 'red', 'black']).mode('lab')
'center L is 74': (topic) ->
assert.equal Math.round(topic(0.5).lab()[0]), 74
'hot - with correction':
topic: -> chroma.scale(['white', 'yellow', 'red', 'black']).mode('lab').correctLightness(true)
'center L is 50': (topic) ->
assert.equal Math.round(topic(0.5).lab()[0]), 50
'hot - w/o correction - domained [0,100]':
topic: -> chroma.scale(['white', 'yellow', 'red', 'black']).domain([0,100]).mode('lab')
'center L is 74': (topic) ->
assert.equal Math.round(topic(50).lab()[0]), 74
'hot - with correction - domained [0,100]':
topic: -> chroma.scale(['white', 'yellow', 'red', 'black']).domain([0,100]).mode('lab').correctLightness(true)
'center L is 50': (topic) ->
assert.equal Math.round(topic(50).lab()[0]), 50
'hot - w/o correction - domained [0,20,40,60,80,100]':
topic: -> chroma.scale(['white', 'yellow', 'red', 'black']).domain([0,20,40,60,80,100]).mode('lab')
'center L is 74': (topic) ->
assert.equal Math.round(topic(50).lab()[0]), 74
'hot - with correction - domained [0,20,40,60,80,100]':
topic: -> chroma.scale(['white', 'yellow', 'red', 'black']).domain([0,20,40,60,80,100]).mode('lab').correctLightness(true)
'center L is 50': (topic) ->
console.log '---'
assert.equal Math.round(topic(50).lab()[0]), 50
.export(module)