Skip to content

Commit 48140ba

Browse files
authored
Increase test data precision (#248)
1 parent 6605643 commit 48140ba

File tree

6 files changed

+79
-64
lines changed

6 files changed

+79
-64
lines changed

lib/sass/value/color.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,8 +569,8 @@ def _analogous_channel_missing?(original, output, output_channel_index)
569569

570570
return false if original.equal?(output)
571571

572-
output_channel = output.space.channels[output_channel_index]
573-
original_channel = original.space.channels.find do |channel|
572+
output_channel = output._space.channels[output_channel_index]
573+
original_channel = original._space.channels.find do |channel|
574574
output_channel.analogous?(channel)
575575
end
576576

spec/sass/value/color/interpolation_examples.rb

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{
88
weight: 0.5
99
},
10-
[58.614201646094955, 10.016665992350433, -8.387820174394456]
10+
[58.614201693004674, 10.016667522478151, -8.387819651868517]
1111
],
1212
[
1313
{
@@ -19,35 +19,35 @@
1919
{
2020
weight: 0
2121
},
22-
[38.95792456574883, -15.169549415088852, -17.792484605053115]
22+
[38.957924659568256, -15.169546354833418, -17.792483560001216]
2323
]
2424
],
2525
oklab: [
2626
[
2727
{
2828
weight: 0.5
2929
},
30-
[0.6476500020040917, 0.02748550994678843, -0.023408287379941606]
30+
[0.6476500060804854, 0.027485511076670896, -0.023408311310399166]
3131
],
3232
[
3333
{
3434
weight: 1
3535
},
36-
[0.8241000000000002, 0.10608808442731632, 0.0015900762693974446]
36+
[0.8241000051752044, 0.10608808769190603, 0.0015900461037656743]
3737
],
3838
[
3939
{
4040
weight: 0
4141
},
42-
[0.47120000400818335, -0.05111706453373946, -0.048406651029280656]
42+
[0.47120000698576636, -0.05111706553856424, -0.048406668724564006]
4343
]
4444
],
4545
lch: [
4646
[
4747
{
4848
weight: 0.5
4949
},
50-
[58.61420164622054, 29.299459370089924, 295.6021177856686]
50+
[58.614201693004674, 29.299457976259603, 295.6021198088788]
5151
],
5252
[
5353
{
@@ -59,83 +59,83 @@
5959
{
6060
weight: 0
6161
},
62-
[38.957924566, 23.38135449889311, 229.5496923459574]
62+
[38.957924659568256, 23.381351711232465, 229.54969639237788]
6363
],
6464
[
6565
{
6666
weight: 0.5,
6767
method: 'shorter'
6868
},
69-
[58.61420164622054, 29.299459370089924, 295.6021177856686]
69+
[58.614201693004674, 29.299457976259603, 295.6021198088788]
7070
],
7171
[
7272
{
7373
weight: 0.5,
7474
method: 'longer'
7575
},
76-
[58.61420164622054, 29.299459370089924, 115.60211778566858]
76+
[58.614201693004674, 29.299457976259603, 115.6021198088788]
7777
],
7878
[
7979
{
8080
weight: 0.5,
8181
method: 'increasing'
8282
},
83-
[58.61420164622054, 29.299459370089924, 115.60211778566858]
83+
[58.614201693004674, 29.299457976259603, 115.6021198088788]
8484
],
8585
[
8686
{
8787
weight: 0.5,
8888
method: 'decreasing'
8989
},
90-
[58.61420164622054, 29.299459370089924, 295.6021177856686]
90+
[58.614201693004674, 29.299457976259603, 295.6021198088788]
9191
]
9292
],
9393
oklch: [
9494
[
9595
{
9696
weight: 0.5
9797
},
98-
[0.6476500020040917, 0.08824999343187809, 292.1493505923757]
98+
[0.6476500060804854, 0.0882500012863419, 292.1493473823782]
9999
],
100100
[
101101
{
102102
weight: 1
103103
},
104-
[0.8241, 0.1061, 0.8586999999999989]
104+
[0.8241000051752044, 0.1061000028121472, 0.8586836854624949]
105105
],
106106
[
107107
{
108108
weight: 0
109109
},
110-
[0.47120000400818335, 0.07039998686375618, 223.4400011847514]
110+
[0.47120000698576636, 0.07039999976053661, 223.44001107929404]
111111
],
112112
[
113113
{
114114
weight: 0.5,
115115
method: 'shorter'
116116
},
117-
[0.6476500020040917, 0.08824999343187809, 292.1493505923757]
117+
[0.6476500060804854, 0.0882500012863419, 292.1493473823782]
118118
],
119119
[
120120
{
121121
weight: 0.5,
122122
method: 'longer'
123123
},
124-
[0.6476500020040917, 0.08824999343187809, 112.1493505923757]
124+
[0.6476500060804854, 0.0882500012863419, 112.14934738237824]
125125
],
126126
[
127127
{
128128
weight: 0.5,
129129
method: 'increasing'
130130
},
131-
[0.6476500020040917, 0.08824999343187809, 112.1493505923757]
131+
[0.6476500060804854, 0.0882500012863419, 112.14934738237824]
132132
],
133133
[
134134
{
135135
weight: 0.5,
136136
method: 'decreasing'
137137
},
138-
[0.6476500020040917, 0.08824999343187809, 292.1493505923757]
138+
[0.6476500060804854, 0.0882500012863419, 292.1493473823782]
139139
]
140140
],
141141
srgb: [
@@ -223,7 +223,7 @@
223223
{
224224
weight: 0.5
225225
},
226-
[0.5427623847027483, 0.4757813439417372, 0.5419635636962455]
226+
[0.5427628071521571, 0.4757810859208764, 0.5419635611723659]
227227
],
228228
[
229229
{
@@ -235,7 +235,7 @@
235235
{
236236
weight: 0
237237
},
238-
[0.2431790331963506, 0.3045087255847488, 0.38356879501347535]
238+
[0.24317987809516806, 0.304508209543027, 0.3835687899657161]
239239
]
240240
],
241241
rec2020: [
@@ -283,7 +283,7 @@
283283
{
284284
weight: 0.5
285285
},
286-
[0.3740759617070767, 0.3215358224064546, 0.2908164562135577]
286+
[0.37407596368010154, 0.32153582267804004, 0.29081645447205257]
287287
],
288288
[
289289
{
@@ -295,15 +295,15 @@
295295
{
296296
weight: 0
297297
},
298-
[0.08408207011375313, 0.10634498228480066, 0.14703708775508573]
298+
[0.08408207405980274, 0.10634498282797152, 0.14703708427207543]
299299
]
300300
],
301301
rgb: [
302302
[
303303
{
304304
weight: 0.5
305305
},
306-
[146.56944672156501, 134.1448156837381, 157.00580432872178]
306+
[146.49494601036622, 133.9494959758061, 156.77020571682615]
307307
],
308308
[
309309
{
@@ -315,7 +315,7 @@
315315
{
316316
weight: 0
317317
},
318-
[38.14436413378462, 100.00369046118837, 120.62648929056449]
318+
[37.99536271138702, 99.61305104532435, 120.15529206677323]
319319
]
320320
],
321321
hsl: [

spec/sass/value/color/spaces.rb

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
name: 'lab',
1010
is_legacy: false,
1111
is_polar: false,
12-
pink: [78.27047872644108, 35.20288139978972, 1.0168442562642044],
13-
blue: [38.95792456574883, -15.169549415088856, -17.792484605053115],
12+
pink: [78.27047872644108, 35.20288139978972, 1.0168442562641822],
13+
blue: [38.957924659568256, -15.169546354833418, -17.792483560001216],
1414
channels: %w[lightness a b],
1515
ranges: [
1616
[0, 100],
@@ -30,8 +30,8 @@
3030
name: 'oklab',
3131
is_legacy: false,
3232
is_polar: false,
33-
pink: [0.8241000000000002, 0.10608808442731632, 0.0015900762693974446],
34-
blue: [0.47120000400818335, -0.05111706453373946, -0.048406651029280656],
33+
pink: [0.8241000051752044, 0.10608808769190603, 0.0015900461037656743],
34+
blue: [0.47120000698576636, -0.05111706553856424, -0.048406668724564006],
3535
channels: %w[lightness a b],
3636
ranges: [
3737
[0, 1],
@@ -51,8 +51,8 @@
5151
name: 'lch',
5252
is_legacy: false,
5353
is_polar: true,
54-
pink: [78.27047872644108, 35.21756424128674, 1.6545432253797676],
55-
blue: [38.957924566, 23.38135449889311, 229.54969234595737],
54+
pink: [78.27047872644108, 35.21756424128674, 1.6545432253797117],
55+
blue: [38.957924659568256, 23.381351711232465, 229.54969639237788],
5656
channels: %w[lightness chroma hue],
5757
has_powerless: true,
5858
ranges: [
@@ -73,8 +73,8 @@
7373
name: 'oklch',
7474
is_legacy: false,
7575
is_polar: true,
76-
pink: [0.8241, 0.1061, 0.8587],
77-
blue: [0.47120000400818335, 0.07039998686375618, 223.44000118475142],
76+
pink: [0.8241000051752044, 0.1061000028121472, 0.8586836854624949],
77+
blue: [0.47120000698576636, 0.07039999976053661, 223.44001107929404],
7878
channels: %w[lightness chroma hue],
7979
has_powerless: true,
8080
ranges: [
@@ -95,7 +95,7 @@
9595
name: 'srgb',
9696
is_legacy: false,
9797
is_polar: false,
98-
pink: [0.9999785463111585, 0.6599448662991679, 0.758373017125016],
98+
pink: [0.9999785463111587, 0.6599448662991679, 0.7583730171250161],
9999
blue: [0.14900142239759614, 0.39063941586401707, 0.47119722379126755],
100100
channels: %w[red green blue],
101101
ranges: [
@@ -113,7 +113,7 @@
113113
name: 'srgb-linear',
114114
is_legacy: false,
115115
is_polar: false,
116-
pink: [0.999951196094508, 0.3930503811476254, 0.5356603778005655],
116+
pink: [0.9999511960945082, 0.39305038114762536, 0.5356603778005656],
117117
blue: [0.019378214827482948, 0.12640222770203852, 0.18834349393523495],
118118
channels: %w[red green blue],
119119
ranges: [
@@ -149,7 +149,7 @@
149149
name: 'a98-rgb',
150150
is_legacy: false,
151151
is_polar: false,
152-
pink: [0.9172837001828321, 0.6540226622083835, 0.7491144397116841],
152+
pink: [0.9172837001828322, 0.6540226622083833, 0.749114439711684],
153153
blue: [0.2557909283504703, 0.3904466064332277, 0.4651826475952292],
154154
channels: %w[red green blue],
155155
ranges: [
@@ -167,8 +167,8 @@
167167
name: 'prophoto-rgb',
168168
is_legacy: false,
169169
is_polar: false,
170-
pink: [0.842345736209146, 0.6470539622987257, 0.7003583323790157],
171-
blue: [0.24317903319635056, 0.3045087255847488, 0.38356879501347535],
170+
pink: [0.842345736209146, 0.6470539622987259, 0.7003583323790157],
171+
blue: [0.24317987809516806, 0.304508209543027, 0.3835687899657161],
172172
channels: %w[red green blue],
173173
ranges: [
174174
[0, 1],
@@ -185,8 +185,8 @@
185185
name: 'rec2020',
186186
is_legacy: false,
187187
is_polar: false,
188-
pink: [0.8837118321235519, 0.6578067923850563, 0.7273197917658354],
189-
blue: [0.2151122740532409, 0.32363973150195124, 0.4090033869684574],
188+
pink: [0.883711832123552, 0.6578067923850561, 0.7273197917658352],
189+
blue: [0.21511227405324085, 0.3236397315019512, 0.4090033869684574],
190190
channels: %w[red green blue],
191191
ranges: [
192192
[0, 1],
@@ -224,8 +224,8 @@
224224
name: 'xyz-d50',
225225
is_legacy: false,
226226
is_polar: false,
227-
pink: [0.6640698533004002, 0.5367266625281085, 0.4345958246720296],
228-
blue: [0.08408207011375313, 0.10634498228480066, 0.1470370877550857],
227+
pink: [0.6640698533004004, 0.5367266625281086, 0.43459582467202973],
228+
blue: [0.08408207405980274, 0.10634498282797152, 0.14703708427207543],
229229
channels: %w[x y z],
230230
ranges: [
231231
[0, 1],
@@ -266,8 +266,8 @@
266266
name: 'rgb',
267267
is_legacy: true,
268268
is_polar: false,
269-
pink: [254.9945293093454, 168.28594090628783, 193.38511936687908],
270-
blue: [38.144364133784602, 100.003690461188378, 120.626489290564506],
269+
pink: [254.99452930934547, 168.28594090628783, 193.3851193668791],
270+
blue: [37.99536271138702, 99.61305104532435, 120.15529206677323],
271271
channels: %w[red green blue],
272272
ranges: [
273273
[0, 255],
@@ -287,7 +287,7 @@
287287
name: 'hsl',
288288
is_legacy: true,
289289
is_polar: true,
290-
pink: [342.63204677447646, 99.98738302509669, 82.99617063051632],
290+
pink: [342.63204677447646, 99.98738302509679, 82.99617063051633],
291291
blue: [195.0016494775154, 51.95041997811069, 31.009932309443183],
292292
channels: %w[hue saturation lightness],
293293
has_powerless: true,
@@ -302,7 +302,7 @@
302302
[0.5, 110, 50],
303303
{
304304
clip: [0.5, 100, 50],
305-
'local-minde': [2.9140262667138472, 100, 52.05146874647547]
305+
'local-minde': [2.9140266584158057, 100, 52.05146824961835]
306306
}
307307
]
308308
]
@@ -312,7 +312,7 @@
312312
name: 'hwb',
313313
is_legacy: true,
314314
is_polar: true,
315-
pink: [342.63204677447646, 65.99448662991679, 0.002145368884157506],
315+
pink: [342.63204677447646, 65.9944866299168, 0.002145368884129084],
316316
blue: [195.0016494775154, 14.900142239759612, 52.880277620873244],
317317
channels: %w[hue whiteness blackness],
318318
has_powerless: true,
@@ -327,7 +327,7 @@
327327
[0.5, -3, -7],
328328
{
329329
clip: [0.5, 0, 0],
330-
'local-minde': [3.492121744609392, 11.26651892207301, 0]
330+
'local-minde': [3.492122559065345, 11.266517197307957, 0]
331331
}
332332
]
333333
]

spec/sass/value/color_4_conversions_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,5 +155,21 @@
155155
end
156156
end
157157
end
158+
159+
describe 'interpolate()' do
160+
it 'interpolates a rectangular space without options' do
161+
expect(
162+
described_class.new(red: 100, green: 200, blue: 50)
163+
.interpolate(described_class.new(red: 255, green: 255, blue: 255))
164+
).to eq(described_class.new(red: 177.5, green: 227.5, blue: 152.5))
165+
end
166+
167+
it 'interpolates a polar space without options' do
168+
expect(
169+
described_class.new(hue: 180, saturation: 100, lightness: 50)
170+
.interpolate(described_class.new(red: 100, green: 200, blue: 50))
171+
).to eq(described_class.new(hue: 140, saturation: 80, lightness: 49.509803921568626))
172+
end
173+
end
158174
end
159175
end

0 commit comments

Comments
 (0)