Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase test data precision #248

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/sass/value/color.rb
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,8 @@ def _analogous_channel_missing?(original, output, output_channel_index)

return false if original.equal?(output)

output_channel = output.space.channels[output_channel_index]
original_channel = original.space.channels.find do |channel|
output_channel = output._space.channels[output_channel_index]
original_channel = original._space.channels.find do |channel|
output_channel.analogous?(channel)
end

Expand Down
48 changes: 24 additions & 24 deletions spec/sass/value/color/interpolation_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
weight: 0.5
},
[58.614201646094955, 10.016665992350433, -8.387820174394456]
[58.614201693004674, 10.016667522478151, -8.387819651868517]
],
[
{
Expand All @@ -19,35 +19,35 @@
{
weight: 0
},
[38.95792456574883, -15.169549415088852, -17.792484605053115]
[38.957924659568256, -15.169546354833418, -17.792483560001216]
]
],
oklab: [
[
{
weight: 0.5
},
[0.6476500020040917, 0.02748550994678843, -0.023408287379941606]
[0.6476500060804854, 0.027485511076670896, -0.023408311310399166]
],
[
{
weight: 1
},
[0.8241000000000002, 0.10608808442731632, 0.0015900762693974446]
[0.8241000051752044, 0.10608808769190603, 0.0015900461037656743]
],
[
{
weight: 0
},
[0.47120000400818335, -0.05111706453373946, -0.048406651029280656]
[0.47120000698576636, -0.05111706553856424, -0.048406668724564006]
]
],
lch: [
[
{
weight: 0.5
},
[58.61420164622054, 29.299459370089924, 295.6021177856686]
[58.614201693004674, 29.299457976259603, 295.6021198088788]
],
[
{
Expand All @@ -59,83 +59,83 @@
{
weight: 0
},
[38.957924566, 23.38135449889311, 229.5496923459574]
[38.957924659568256, 23.381351711232465, 229.54969639237788]
],
[
{
weight: 0.5,
method: 'shorter'
},
[58.61420164622054, 29.299459370089924, 295.6021177856686]
[58.614201693004674, 29.299457976259603, 295.6021198088788]
],
[
{
weight: 0.5,
method: 'longer'
},
[58.61420164622054, 29.299459370089924, 115.60211778566858]
[58.614201693004674, 29.299457976259603, 115.6021198088788]
],
[
{
weight: 0.5,
method: 'increasing'
},
[58.61420164622054, 29.299459370089924, 115.60211778566858]
[58.614201693004674, 29.299457976259603, 115.6021198088788]
],
[
{
weight: 0.5,
method: 'decreasing'
},
[58.61420164622054, 29.299459370089924, 295.6021177856686]
[58.614201693004674, 29.299457976259603, 295.6021198088788]
]
],
oklch: [
[
{
weight: 0.5
},
[0.6476500020040917, 0.08824999343187809, 292.1493505923757]
[0.6476500060804854, 0.0882500012863419, 292.1493473823782]
],
[
{
weight: 1
},
[0.8241, 0.1061, 0.8586999999999989]
[0.8241000051752044, 0.1061000028121472, 0.8586836854624949]
],
[
{
weight: 0
},
[0.47120000400818335, 0.07039998686375618, 223.4400011847514]
[0.47120000698576636, 0.07039999976053661, 223.44001107929404]
],
[
{
weight: 0.5,
method: 'shorter'
},
[0.6476500020040917, 0.08824999343187809, 292.1493505923757]
[0.6476500060804854, 0.0882500012863419, 292.1493473823782]
],
[
{
weight: 0.5,
method: 'longer'
},
[0.6476500020040917, 0.08824999343187809, 112.1493505923757]
[0.6476500060804854, 0.0882500012863419, 112.14934738237824]
],
[
{
weight: 0.5,
method: 'increasing'
},
[0.6476500020040917, 0.08824999343187809, 112.1493505923757]
[0.6476500060804854, 0.0882500012863419, 112.14934738237824]
],
[
{
weight: 0.5,
method: 'decreasing'
},
[0.6476500020040917, 0.08824999343187809, 292.1493505923757]
[0.6476500060804854, 0.0882500012863419, 292.1493473823782]
]
],
srgb: [
Expand Down Expand Up @@ -223,7 +223,7 @@
{
weight: 0.5
},
[0.5427623847027483, 0.4757813439417372, 0.5419635636962455]
[0.5427628071521571, 0.4757810859208764, 0.5419635611723659]
],
[
{
Expand All @@ -235,7 +235,7 @@
{
weight: 0
},
[0.2431790331963506, 0.3045087255847488, 0.38356879501347535]
[0.24317987809516806, 0.304508209543027, 0.3835687899657161]
]
],
rec2020: [
Expand Down Expand Up @@ -283,7 +283,7 @@
{
weight: 0.5
},
[0.3740759617070767, 0.3215358224064546, 0.2908164562135577]
[0.37407596368010154, 0.32153582267804004, 0.29081645447205257]
],
[
{
Expand All @@ -295,15 +295,15 @@
{
weight: 0
},
[0.08408207011375313, 0.10634498228480066, 0.14703708775508573]
[0.08408207405980274, 0.10634498282797152, 0.14703708427207543]
]
],
rgb: [
[
{
weight: 0.5
},
[146.56944672156501, 134.1448156837381, 157.00580432872178]
[146.49494601036622, 133.9494959758061, 156.77020571682615]
],
[
{
Expand All @@ -315,7 +315,7 @@
{
weight: 0
},
[38.14436413378462, 100.00369046118837, 120.62648929056449]
[37.99536271138702, 99.61305104532435, 120.15529206677323]
]
],
hsl: [
Expand Down
46 changes: 23 additions & 23 deletions spec/sass/value/color/spaces.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
name: 'lab',
is_legacy: false,
is_polar: false,
pink: [78.27047872644108, 35.20288139978972, 1.0168442562642044],
blue: [38.95792456574883, -15.169549415088856, -17.792484605053115],
pink: [78.27047872644108, 35.20288139978972, 1.0168442562641822],
blue: [38.957924659568256, -15.169546354833418, -17.792483560001216],
channels: %w[lightness a b],
ranges: [
[0, 100],
Expand All @@ -30,8 +30,8 @@
name: 'oklab',
is_legacy: false,
is_polar: false,
pink: [0.8241000000000002, 0.10608808442731632, 0.0015900762693974446],
blue: [0.47120000400818335, -0.05111706453373946, -0.048406651029280656],
pink: [0.8241000051752044, 0.10608808769190603, 0.0015900461037656743],
blue: [0.47120000698576636, -0.05111706553856424, -0.048406668724564006],
channels: %w[lightness a b],
ranges: [
[0, 1],
Expand All @@ -51,8 +51,8 @@
name: 'lch',
is_legacy: false,
is_polar: true,
pink: [78.27047872644108, 35.21756424128674, 1.6545432253797676],
blue: [38.957924566, 23.38135449889311, 229.54969234595737],
pink: [78.27047872644108, 35.21756424128674, 1.6545432253797117],
blue: [38.957924659568256, 23.381351711232465, 229.54969639237788],
channels: %w[lightness chroma hue],
has_powerless: true,
ranges: [
Expand All @@ -73,8 +73,8 @@
name: 'oklch',
is_legacy: false,
is_polar: true,
pink: [0.8241, 0.1061, 0.8587],
blue: [0.47120000400818335, 0.07039998686375618, 223.44000118475142],
pink: [0.8241000051752044, 0.1061000028121472, 0.8586836854624949],
blue: [0.47120000698576636, 0.07039999976053661, 223.44001107929404],
channels: %w[lightness chroma hue],
has_powerless: true,
ranges: [
Expand All @@ -95,7 +95,7 @@
name: 'srgb',
is_legacy: false,
is_polar: false,
pink: [0.9999785463111585, 0.6599448662991679, 0.758373017125016],
pink: [0.9999785463111587, 0.6599448662991679, 0.7583730171250161],
blue: [0.14900142239759614, 0.39063941586401707, 0.47119722379126755],
channels: %w[red green blue],
ranges: [
Expand All @@ -113,7 +113,7 @@
name: 'srgb-linear',
is_legacy: false,
is_polar: false,
pink: [0.999951196094508, 0.3930503811476254, 0.5356603778005655],
pink: [0.9999511960945082, 0.39305038114762536, 0.5356603778005656],
blue: [0.019378214827482948, 0.12640222770203852, 0.18834349393523495],
channels: %w[red green blue],
ranges: [
Expand Down Expand Up @@ -149,7 +149,7 @@
name: 'a98-rgb',
is_legacy: false,
is_polar: false,
pink: [0.9172837001828321, 0.6540226622083835, 0.7491144397116841],
pink: [0.9172837001828322, 0.6540226622083833, 0.749114439711684],
blue: [0.2557909283504703, 0.3904466064332277, 0.4651826475952292],
channels: %w[red green blue],
ranges: [
Expand All @@ -167,8 +167,8 @@
name: 'prophoto-rgb',
is_legacy: false,
is_polar: false,
pink: [0.842345736209146, 0.6470539622987257, 0.7003583323790157],
blue: [0.24317903319635056, 0.3045087255847488, 0.38356879501347535],
pink: [0.842345736209146, 0.6470539622987259, 0.7003583323790157],
blue: [0.24317987809516806, 0.304508209543027, 0.3835687899657161],
channels: %w[red green blue],
ranges: [
[0, 1],
Expand All @@ -185,8 +185,8 @@
name: 'rec2020',
is_legacy: false,
is_polar: false,
pink: [0.8837118321235519, 0.6578067923850563, 0.7273197917658354],
blue: [0.2151122740532409, 0.32363973150195124, 0.4090033869684574],
pink: [0.883711832123552, 0.6578067923850561, 0.7273197917658352],
blue: [0.21511227405324085, 0.3236397315019512, 0.4090033869684574],
channels: %w[red green blue],
ranges: [
[0, 1],
Expand Down Expand Up @@ -224,8 +224,8 @@
name: 'xyz-d50',
is_legacy: false,
is_polar: false,
pink: [0.6640698533004002, 0.5367266625281085, 0.4345958246720296],
blue: [0.08408207011375313, 0.10634498228480066, 0.1470370877550857],
pink: [0.6640698533004004, 0.5367266625281086, 0.43459582467202973],
blue: [0.08408207405980274, 0.10634498282797152, 0.14703708427207543],
channels: %w[x y z],
ranges: [
[0, 1],
Expand Down Expand Up @@ -266,8 +266,8 @@
name: 'rgb',
is_legacy: true,
is_polar: false,
pink: [254.9945293093454, 168.28594090628783, 193.38511936687908],
blue: [38.144364133784602, 100.003690461188378, 120.626489290564506],
pink: [254.99452930934547, 168.28594090628783, 193.3851193668791],
blue: [37.99536271138702, 99.61305104532435, 120.15529206677323],
channels: %w[red green blue],
ranges: [
[0, 255],
Expand All @@ -287,7 +287,7 @@
name: 'hsl',
is_legacy: true,
is_polar: true,
pink: [342.63204677447646, 99.98738302509669, 82.99617063051632],
pink: [342.63204677447646, 99.98738302509679, 82.99617063051633],
blue: [195.0016494775154, 51.95041997811069, 31.009932309443183],
channels: %w[hue saturation lightness],
has_powerless: true,
Expand All @@ -302,7 +302,7 @@
[0.5, 110, 50],
{
clip: [0.5, 100, 50],
'local-minde': [2.9140262667138472, 100, 52.05146874647547]
'local-minde': [2.9140266584158057, 100, 52.05146824961835]
}
]
]
Expand All @@ -312,7 +312,7 @@
name: 'hwb',
is_legacy: true,
is_polar: true,
pink: [342.63204677447646, 65.99448662991679, 0.002145368884157506],
pink: [342.63204677447646, 65.9944866299168, 0.002145368884129084],
blue: [195.0016494775154, 14.900142239759612, 52.880277620873244],
channels: %w[hue whiteness blackness],
has_powerless: true,
Expand All @@ -327,7 +327,7 @@
[0.5, -3, -7],
{
clip: [0.5, 0, 0],
'local-minde': [3.492121744609392, 11.26651892207301, 0]
'local-minde': [3.492122559065345, 11.266517197307957, 0]
}
]
]
Expand Down
16 changes: 16 additions & 0 deletions spec/sass/value/color_4_conversions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,21 @@
end
end
end

describe 'interpolate()' do
it 'interpolates a rectangular space without options' do
expect(
described_class.new(red: 100, green: 200, blue: 50)
.interpolate(described_class.new(red: 255, green: 255, blue: 255))
).to eq(described_class.new(red: 177.5, green: 227.5, blue: 152.5))
end

it 'interpolates a polar space without options' do
expect(
described_class.new(hue: 180, saturation: 100, lightness: 50)
.interpolate(described_class.new(red: 100, green: 200, blue: 50))
).to eq(described_class.new(hue: 140, saturation: 80, lightness: 49.509803921568626))
end
end
end
end
Loading