sugarcube 3.3.2 → 3.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/osx/sugarcube-color/nsarray.rb +1 -1
- data/lib/version.rb +1 -1
- data/spec/ios/color_spec.rb +4 -4
- data/spec/osx/color_spec.rb +156 -15
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59c8482c83573e42f64f42c9aa90718298be515d
|
4
|
+
data.tar.gz: 58b279d2a997169e4ef3bb3582376c581257d484
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f199aad09635d42e99d6a352f813f3db32d64c1d01cdec9da5e3878f0b1462d3648a92dc78519936fdc49a7dd6ebcc8610c457e97d8799bb0c844b805bee5a9
|
7
|
+
data.tar.gz: c5a175dcf6a9c5502bc3d6757f9290b868ce52836aaafda2b4eba12cf5e79723d2a2b5f4dc034e59f4d214ccdc04a6b3eeb657e10be4ae14ff5ae510b8183eba
|
data/lib/version.rb
CHANGED
data/spec/ios/color_spec.rb
CHANGED
@@ -4,6 +4,10 @@ describe UIColor do
|
|
4
4
|
UIColor.redColor.uicolor.should == UIColor.redColor
|
5
5
|
end
|
6
6
|
|
7
|
+
it "should have a #uicolor(alpha) method" do
|
8
|
+
UIColor.redColor.uicolor(0.5).alpha.should == 0.5
|
9
|
+
end
|
10
|
+
|
7
11
|
it "should support #cgcolor" do
|
8
12
|
-> do
|
9
13
|
UIColor.redColor.cgcolor.should == UIColor.redColor.CGColor
|
@@ -14,10 +18,6 @@ describe UIColor do
|
|
14
18
|
UIColor.redColor.skcolor.should == UIColor.redColor
|
15
19
|
end
|
16
20
|
|
17
|
-
it "should have a #uicolor(alpha) method" do
|
18
|
-
UIColor.redColor.uicolor(0.5).alpha.should == 0.5
|
19
|
-
end
|
20
|
-
|
21
21
|
it "should have a #skcolor(alpha) method" do
|
22
22
|
UIColor.redColor.skcolor(0.5).alpha.should == 0.5
|
23
23
|
end
|
data/spec/osx/color_spec.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
-
describe
|
1
|
+
describe NSColor do
|
2
2
|
|
3
3
|
it "should support #nscolor" do
|
4
4
|
NSColor.redColor.nscolor.should == NSColor.redColor
|
5
5
|
end
|
6
6
|
|
7
|
+
it "should support #nscolor(alpha) method" do
|
8
|
+
NSColor.redColor.nscolor(0.5).alpha.should == 0.5
|
9
|
+
end
|
10
|
+
|
7
11
|
it "should support #cgcolor" do
|
8
12
|
-> do
|
9
13
|
NSColor.redColor.cgcolor.should == NSColor.redColor.CGColor
|
@@ -14,8 +18,8 @@ describe 'NSColor' do
|
|
14
18
|
NSColor.redColor.skcolor.should == NSColor.redColor
|
15
19
|
end
|
16
20
|
|
17
|
-
it "should
|
18
|
-
NSColor.redColor.
|
21
|
+
it "should have a #skcolor(alpha) method" do
|
22
|
+
NSColor.redColor.skcolor(0.5).alpha.should == 0.5
|
19
23
|
end
|
20
24
|
|
21
25
|
describe "should have a #+(color) method" do
|
@@ -86,23 +90,23 @@ describe 'NSColor' do
|
|
86
90
|
end
|
87
91
|
|
88
92
|
it "should have a #invert method" do
|
89
|
-
|
90
|
-
|
91
|
-
|
93
|
+
NSColor.redColor.invert.should == NSColor.cyanColor
|
94
|
+
NSColor.greenColor.invert.should == NSColor.magentaColor
|
95
|
+
NSColor.blueColor.invert.should == NSColor.yellowColor
|
92
96
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
end
|
97
|
+
NSColor.whiteColor.invert.red.should == 0
|
98
|
+
NSColor.whiteColor.invert.green.should == 0
|
99
|
+
NSColor.whiteColor.invert.blue.should == 0
|
97
100
|
|
98
|
-
|
99
|
-
NSColor.
|
101
|
+
NSColor.blackColor.invert.red.should == 1
|
102
|
+
NSColor.blackColor.invert.green.should == 1
|
103
|
+
NSColor.blackColor.invert.blue.should == 1
|
100
104
|
end
|
101
105
|
|
102
106
|
it "should have a #mix_with method" do
|
103
|
-
white =
|
104
|
-
black =
|
105
|
-
gray =
|
107
|
+
white = NSColor.whiteColor
|
108
|
+
black = NSColor.blackColor
|
109
|
+
gray = NSColor.grayColor
|
106
110
|
white.mix_with(black, 0).red.should == 1
|
107
111
|
white.mix_with(black, 0).green.should == 1
|
108
112
|
white.mix_with(black, 0).blue.should == 1
|
@@ -124,4 +128,141 @@ describe 'NSColor' do
|
|
124
128
|
white.mix_with(black, 0.75).blue.should == 0.25
|
125
129
|
end
|
126
130
|
|
131
|
+
it "should process system colors with a NSNamedColorSpace correctly" do
|
132
|
+
NSColor.controlTextColor.invert.should.not.raise(StandardError)
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
|
138
|
+
describe 'Fixnum NSColor extensions' do
|
139
|
+
it "should support #nscolor" do
|
140
|
+
color = 0xffffff.nscolor
|
141
|
+
color.red.should == 1
|
142
|
+
color.green.should == 1
|
143
|
+
color.blue.should == 1
|
144
|
+
color.alpha.should == 1
|
145
|
+
end
|
146
|
+
|
147
|
+
it "should support #cgcolor" do
|
148
|
+
-> do
|
149
|
+
0xffffff.cgcolor.class.should == NSColor.redColor.CGColor.class
|
150
|
+
end.should.not.raise
|
151
|
+
end
|
152
|
+
|
153
|
+
it "should support #skcolor" do
|
154
|
+
0xffffff.skcolor.should.be.kind_of(NSColor)
|
155
|
+
end
|
156
|
+
|
157
|
+
it "should have a 0x000000#nscolor(0.5) method" do
|
158
|
+
color = 0.nscolor(0.5)
|
159
|
+
color.red.should == 0
|
160
|
+
color.green.should == 0
|
161
|
+
color.blue.should == 0
|
162
|
+
color.alpha.should == 0.5
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
|
167
|
+
describe 'NSArray NSColor extensions' do
|
168
|
+
it "should support #nscolor" do
|
169
|
+
color = [255, 255, 255].nscolor
|
170
|
+
color.red.should == 1
|
171
|
+
color.green.should == 1
|
172
|
+
color.blue.should == 1
|
173
|
+
color.alpha.should == 1
|
174
|
+
end
|
175
|
+
|
176
|
+
it "should support #cgcolor" do
|
177
|
+
-> do
|
178
|
+
[255, 255, 255].cgcolor.class.should == NSColor.redColor.CGColor.class
|
179
|
+
end.should.not.raise
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should support #skcolor" do
|
183
|
+
[255, 255, 255].skcolor.should.be.kind_of(NSColor)
|
184
|
+
end
|
185
|
+
|
186
|
+
it "should have a [0, 0, 0]#nscolor(0.5) method" do
|
187
|
+
color = [0, 0, 0].nscolor(0.5)
|
188
|
+
color.red.should == 0
|
189
|
+
color.green.should == 0
|
190
|
+
color.blue.should == 0
|
191
|
+
color.alpha.should == 0.5
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
|
196
|
+
describe 'NSString NSColor extensions' do
|
197
|
+
|
198
|
+
it "should support #nscolor" do
|
199
|
+
color = '#ffffff'.nscolor
|
200
|
+
color.should.be.kind_of(NSColor)
|
201
|
+
color.red.should == 1.0
|
202
|
+
color.green.should == 1.0
|
203
|
+
color.blue.should == 1.0
|
204
|
+
|
205
|
+
color = '#808080'.nscolor
|
206
|
+
color.should.be.kind_of(NSColor)
|
207
|
+
((color.red * 2).round / 2.0).should == 0.5
|
208
|
+
((color.green * 2).round / 2.0).should == 0.5
|
209
|
+
((color.blue * 2).round / 2.0).should == 0.5
|
210
|
+
end
|
211
|
+
|
212
|
+
it "should support #cgcolor" do
|
213
|
+
-> do
|
214
|
+
'#ffffff'.cgcolor.class.should == NSColor.redColor.CGColor.class
|
215
|
+
end.should.not.raise
|
216
|
+
end
|
217
|
+
|
218
|
+
it "should support #skcolor" do
|
219
|
+
'#ffffff'.skcolor.should.be.kind_of(NSColor)
|
220
|
+
end
|
221
|
+
|
222
|
+
it "should have '#000000'.nscolor(0.5) method" do
|
223
|
+
color = '#000000'.nscolor(0.5)
|
224
|
+
color.should.be.kind_of(NSColor)
|
225
|
+
color.red.should == 0
|
226
|
+
color.green.should == 0
|
227
|
+
color.blue.should == 0
|
228
|
+
color.alpha.should == 0.5
|
229
|
+
end
|
230
|
+
|
231
|
+
it "that supports image names" do
|
232
|
+
a = 'little_square'.nscolor
|
233
|
+
b = 'little_square'.nsimage.nscolor
|
234
|
+
a.should.be.kind_of(NSColor)
|
235
|
+
b.should.be.kind_of(NSColor)
|
236
|
+
end
|
237
|
+
|
238
|
+
it "that supports non-existant image names" do
|
239
|
+
'this is not my beautiful house!'.nscolor.should == nil
|
240
|
+
end
|
241
|
+
|
242
|
+
end
|
243
|
+
|
244
|
+
|
245
|
+
describe 'NSImage NSColor extensions' do
|
246
|
+
it 'should support #nscolor' do
|
247
|
+
color = NSImage.imageNamed('little_square').nscolor
|
248
|
+
color.should.be.kind_of(NSColor)
|
249
|
+
end
|
250
|
+
|
251
|
+
it 'should support #cgcolor' do
|
252
|
+
-> do
|
253
|
+
NSImage.imageNamed('little_square').cgcolor.class.should == NSColor.redColor.CGColor.class
|
254
|
+
end.should.not.raise
|
255
|
+
end
|
256
|
+
|
257
|
+
it "should support #skcolor" do
|
258
|
+
NSImage.imageNamed('little_square').skcolor.should.be.kind_of(NSColor)
|
259
|
+
end
|
260
|
+
|
261
|
+
it 'should support #nscolor(0.5)' do
|
262
|
+
-> do
|
263
|
+
NSImage.imageNamed('little_square').nscolor(0.5)
|
264
|
+
# unfortunately, this doesn't work:
|
265
|
+
# image.alpha.should == 0.5 # alpha returns 0 because this is not an RGB or HSB color
|
266
|
+
end.should.not.raise
|
267
|
+
end
|
127
268
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sugarcube
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colin T.A. Gray
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2015-
|
15
|
+
date: 2015-03-12 00:00:00.000000000 Z
|
16
16
|
dependencies: []
|
17
17
|
description: |
|
18
18
|
== Description
|
@@ -306,12 +306,12 @@ require_paths:
|
|
306
306
|
- lib
|
307
307
|
required_ruby_version: !ruby/object:Gem::Requirement
|
308
308
|
requirements:
|
309
|
-
- -
|
309
|
+
- - ">="
|
310
310
|
- !ruby/object:Gem::Version
|
311
311
|
version: '0'
|
312
312
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
313
313
|
requirements:
|
314
|
-
- -
|
314
|
+
- - ">="
|
315
315
|
- !ruby/object:Gem::Version
|
316
316
|
version: '0'
|
317
317
|
requirements: []
|