sugarcube 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/cocoa/sugarcube-localized/nsstring.rb +1 -1
- data/lib/cocoa/sugarcube-pointer/nsarray.rb +11 -0
- data/lib/ios/sugarcube-constants/symbol.rb +30 -18
- data/lib/ios/sugarcube-image/cifilter.rb +3 -1
- data/lib/ios/sugarcube-image/uiimage.rb +12 -0
- data/lib/ios/sugarcube-uikit/uilabel.rb +5 -5
- data/lib/osx/sugarcube-constants/symbol.rb +23 -0
- data/lib/version.rb +1 -1
- data/spec/ios/animation_chain_spec.rb +23 -0
- data/spec/ios/date_parser_spec.rb +1 -1
- data/spec/ios/image_cifilters_spec.rb +97 -91
- data/spec/ios/image_uiimage_filters_spec.rb +15 -7
- data/spec/ios/nsdata_spec.rb +3 -3
- data/spec/ios/nsstring_files_spec.rb +1 -1
- data/spec/ios/symbol_constants_spec.rb +38 -16
- data/spec/ios/uiimage_spec.rb +2 -2
- data/spec/osx/symbol_constants_spec.rb +25 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf12c1ec6c187149c1cf88532de668af937ad888
|
4
|
+
data.tar.gz: 8f360b97c2eaa04c42c059136a0d692bebc01865
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29031d55a41d4fa2ebb6be17be7617a217a40d0f063b7c09d2a536065fd84c64f9c271b2bf4281401d99fbe11b3e96c4b50a13c947b30a7c53363cbc1e3b456f
|
7
|
+
data.tar.gz: 02cd003ce97a249f4b0359ed01f918af71902aa22dd4e323430411fbd92e75314ade30185be0acb49f21c1ccbf6ed3576df97674a3739cf33e28f413fb78ac36
|
data/README.md
CHANGED
@@ -456,6 +456,8 @@ image.in_rect([[10, 10], [100, 100]]) # get part of an image
|
|
456
456
|
|
457
457
|
image.darken # => good for "pressed" buttons
|
458
458
|
image.darken(brightness: -0.5, saturation: -0.2) # these are the defaults
|
459
|
+
image.gaussian_blur(radius: 5)
|
460
|
+
image.inverted
|
459
461
|
|
460
462
|
image.rotate(:left)
|
461
463
|
image.rotate(:right)
|
@@ -3,7 +3,7 @@ class NSString
|
|
3
3
|
# This can be called as `"Hello".localized` or `"Hello"._`. The `str._`
|
4
4
|
# syntax is meant to be reminiscent of gettext-style `_(str)`.
|
5
5
|
def localized(value=nil, table=nil)
|
6
|
-
|
6
|
+
NSBundle.mainBundle.localizedStringForKey(self, value: value, table: table)
|
7
7
|
end
|
8
8
|
alias _ localized
|
9
9
|
|
@@ -10,4 +10,15 @@ class NSArray
|
|
10
10
|
ret
|
11
11
|
end
|
12
12
|
|
13
|
+
# @param type [Symbol] type A pointer type from the list at {http://www.rubymotion.com/developer-center/guides/runtime/ RubyMotion Pointers Reference#_pointers}
|
14
|
+
# @return [Pointer] An array of pointers of the specified type
|
15
|
+
def to_pointers(type)
|
16
|
+
self.map do |val|
|
17
|
+
ptr = Pointer.new(type)
|
18
|
+
ptr[0] = val
|
19
|
+
ptr
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
13
24
|
end
|
@@ -60,9 +60,15 @@ class Symbol
|
|
60
60
|
alias nsalignment nstextalignment
|
61
61
|
|
62
62
|
def uilinebreakmode
|
63
|
-
SugarCube.
|
63
|
+
SugarCube.log('uilinebreakmode is deprecated. Use nslinebreakmode instead.')
|
64
|
+
SugarCube.look_in(self, Symbol.nslinebreakmode)
|
64
65
|
end
|
65
66
|
|
67
|
+
def nslinebreakmode
|
68
|
+
SugarCube.look_in(self, Symbol.nslinebreakmode)
|
69
|
+
end
|
70
|
+
alias nslinebreak nslinebreakmode
|
71
|
+
|
66
72
|
def uibaselineadjustment
|
67
73
|
SugarCube.look_in(self, Symbol.uibaselineadjustment, Symbol.uibaselineadjustment__deprecated)
|
68
74
|
end
|
@@ -242,8 +248,7 @@ class Symbol
|
|
242
248
|
attr :uikeyboardtype__deprecated
|
243
249
|
attr :uitextalignment
|
244
250
|
attr :nstextalignment
|
245
|
-
attr :
|
246
|
-
attr :uilinebreakmode__deprecated
|
251
|
+
attr :nslinebreakmode
|
247
252
|
attr :uibaselineadjustment__deprecated
|
248
253
|
attr :uibaselineadjustment
|
249
254
|
attr :uibordertype
|
@@ -415,20 +420,25 @@ class Symbol
|
|
415
420
|
center: NSTextAlignmentCenter,
|
416
421
|
}
|
417
422
|
|
418
|
-
@
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
head_truncation:
|
430
|
-
|
431
|
-
|
423
|
+
@nslinebreakmode = {
|
424
|
+
word_wrapping: NSLineBreakByWordWrapping,
|
425
|
+
word_wrap: NSLineBreakByWordWrapping,
|
426
|
+
word: NSLineBreakByWordWrapping,
|
427
|
+
char_wrapping: NSLineBreakByCharWrapping,
|
428
|
+
char_wrap: NSLineBreakByCharWrapping,
|
429
|
+
character_wrap: NSLineBreakByCharWrapping,
|
430
|
+
char: NSLineBreakByCharWrapping,
|
431
|
+
clipping: NSLineBreakByClipping,
|
432
|
+
clip: NSLineBreakByClipping,
|
433
|
+
truncating_head: NSLineBreakByTruncatingHead,
|
434
|
+
head_truncation: NSLineBreakByTruncatingHead,
|
435
|
+
head: NSLineBreakByTruncatingHead,
|
436
|
+
truncating_tail: NSLineBreakByTruncatingTail,
|
437
|
+
tail_truncation: NSLineBreakByTruncatingTail,
|
438
|
+
tail: NSLineBreakByTruncatingTail,
|
439
|
+
truncating_middle: NSLineBreakByTruncatingMiddle,
|
440
|
+
middle_truncation: NSLineBreakByTruncatingMiddle,
|
441
|
+
middle: NSLineBreakByTruncatingMiddle
|
432
442
|
}
|
433
443
|
|
434
444
|
@uibaselineadjustment__deprecated = {
|
@@ -547,8 +557,10 @@ class Symbol
|
|
547
557
|
info_dark: UIButtonTypeInfoDark,
|
548
558
|
contact: UIButtonTypeContactAdd,
|
549
559
|
contact_add: UIButtonTypeContactAdd,
|
550
|
-
system: UIButtonTypeSystem,
|
551
560
|
}
|
561
|
+
if defined?(UIButtonTypeSystem)
|
562
|
+
@uibuttontype[:system] = UIButtonTypeSystem
|
563
|
+
end
|
552
564
|
|
553
565
|
@uicontrolstate = {
|
554
566
|
normal: UIControlStateNormal,
|
@@ -97,7 +97,9 @@ class CIFilter
|
|
97
97
|
end
|
98
98
|
|
99
99
|
options.each do |key, value|
|
100
|
-
# translate the keys, but if there is no translation key then
|
100
|
+
# translate the keys, but if there is no translation key then try to
|
101
|
+
# assign the key as the user specified. This means you can pass options
|
102
|
+
# like `'inputRadius'` directly, without using an alias
|
101
103
|
key = names[key] || key.to_s
|
102
104
|
|
103
105
|
# translate the value if a block was given for that. `key` is always going
|
@@ -414,6 +414,18 @@ class UIImage
|
|
414
414
|
return UIImage.imageWithCIImage(output, scale:self.scale, orientation:self.imageOrientation)
|
415
415
|
end
|
416
416
|
|
417
|
+
# Invert the image
|
418
|
+
# @options - none
|
419
|
+
#
|
420
|
+
# @example
|
421
|
+
# image.inverted
|
422
|
+
#
|
423
|
+
# similar to (image | CIFilter.color_invert).uiimage
|
424
|
+
def inverted
|
425
|
+
output = self.apply_filter(CIFilter.color_invert)
|
426
|
+
return UIImage.imageWithCIImage(output, scale:self.scale, orientation:self.imageOrientation)
|
427
|
+
end
|
428
|
+
|
417
429
|
# Apply a gaussian filter
|
418
430
|
# @options radius, default: 10
|
419
431
|
#
|
@@ -1,17 +1,17 @@
|
|
1
1
|
class UILabel
|
2
|
-
|
3
|
-
# forces the given text to fit inside the label's frame starting at a given font size
|
2
|
+
|
3
|
+
# forces the given text to fit inside the label's frame starting at a given font size
|
4
4
|
def fit_to_size(max_size)
|
5
5
|
#enforce word wrap
|
6
|
-
self.lineBreakMode =
|
7
|
-
|
6
|
+
self.lineBreakMode = NSLineBreakByWordWrapping
|
7
|
+
|
8
8
|
dynamic_font = self.font.fontWithSize(max_size + 2)
|
9
9
|
constraintSize = CGSizeMake(self.frame.size.width, 10000)
|
10
10
|
|
11
11
|
# does it fit yet?
|
12
12
|
begin
|
13
13
|
dynamic_font = dynamic_font.fontWithSize(dynamic_font.pointSize - 2)
|
14
|
-
current_size = self.text.sizeWithFont(dynamic_font, constrainedToSize:constraintSize, lineBreakMode:
|
14
|
+
current_size = self.text.sizeWithFont(dynamic_font, constrainedToSize:constraintSize, lineBreakMode: NSLineBreakByWordWrapping)
|
15
15
|
end while self.frame.size.height <= current_size.height
|
16
16
|
|
17
17
|
#now set to font size we have settled on
|
@@ -48,6 +48,11 @@ class Symbol
|
|
48
48
|
SugarCube.look_in(self, Symbol.nsfocusringtype)
|
49
49
|
end
|
50
50
|
|
51
|
+
def nslinebreakmode
|
52
|
+
SugarCube.look_in(self, Symbol.nslinebreakmode)
|
53
|
+
end
|
54
|
+
alias nslinebreak nslinebreakmode
|
55
|
+
|
51
56
|
def catimingfunction
|
52
57
|
SugarCube.look_in(self, Symbol.catimingfunction)
|
53
58
|
end
|
@@ -71,6 +76,7 @@ class Symbol
|
|
71
76
|
attr :nsbuttontype
|
72
77
|
attr :nsbezelstyle
|
73
78
|
attr :nsfocusringtype
|
79
|
+
attr :nslinebreakmode
|
74
80
|
attr :catimingfunction
|
75
81
|
attr :cglinecap
|
76
82
|
attr :cglinejoin
|
@@ -162,6 +168,23 @@ class Symbol
|
|
162
168
|
exterior: NSFocusRingTypeExterior,
|
163
169
|
}
|
164
170
|
|
171
|
+
@nslinebreakmode = {
|
172
|
+
word_wrapping: NSLineBreakByWordWrapping,
|
173
|
+
word_wrap: NSLineBreakByWordWrapping,
|
174
|
+
word: NSLineBreakByWordWrapping,
|
175
|
+
char_wrapping: NSLineBreakByCharWrapping,
|
176
|
+
char_wrap: NSLineBreakByCharWrapping,
|
177
|
+
char: NSLineBreakByCharWrapping,
|
178
|
+
clipping: NSLineBreakByClipping,
|
179
|
+
clip: NSLineBreakByClipping,
|
180
|
+
truncating_head: NSLineBreakByTruncatingHead,
|
181
|
+
head: NSLineBreakByTruncatingHead,
|
182
|
+
truncating_tail: NSLineBreakByTruncatingTail,
|
183
|
+
tail: NSLineBreakByTruncatingTail,
|
184
|
+
truncating_middle: NSLineBreakByTruncatingMiddle,
|
185
|
+
middle: NSLineBreakByTruncatingMiddle
|
186
|
+
}
|
187
|
+
|
165
188
|
@catimingfunction = {
|
166
189
|
linear: KCAMediaTimingFunctionLinear,
|
167
190
|
ease_in: KCAMediaTimingFunctionEaseIn,
|
data/lib/version.rb
CHANGED
@@ -1,6 +1,29 @@
|
|
1
1
|
describe "SugarCube::AnimationChain" do
|
2
2
|
tests SugarCube::AnimationChainController
|
3
3
|
|
4
|
+
it 'should not crash with a memory error' do
|
5
|
+
@did_run_1 = false
|
6
|
+
@did_run_2 = false
|
7
|
+
@did_run_3 = false
|
8
|
+
|
9
|
+
UIView.animation_chain(duration: 0.01) do
|
10
|
+
@did_run_1 = true
|
11
|
+
controller.view.scale_to 0.9, 0
|
12
|
+
end.and_then(duration: 0.01) do
|
13
|
+
@did_run_2 = true
|
14
|
+
controller.view.scale_to 1.1, 0
|
15
|
+
end.and_then(duration: 0.01) do
|
16
|
+
@did_run_3 = true
|
17
|
+
controller.view.scale_to 1, 0
|
18
|
+
end.start
|
19
|
+
|
20
|
+
wait 0.1 do
|
21
|
+
@did_run_1.should == true
|
22
|
+
@did_run_2.should == true
|
23
|
+
@did_run_3.should == true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
4
27
|
it "should support chains" do
|
5
28
|
SugarCube::AnimationChain.chains.length.should == 0
|
6
29
|
@variable_a = nil
|
@@ -3,7 +3,7 @@ describe "Base Methods" do
|
|
3
3
|
it "parses a relative natural language string, returning a date" do
|
4
4
|
today = Time.now
|
5
5
|
t = SugarCube::DateParser.parse_date("tomorrow at 7:30 PM")
|
6
|
-
t.should.
|
6
|
+
t.should.be.kind_of Time
|
7
7
|
t.hour.should == 19
|
8
8
|
t.min.should == 30
|
9
9
|
t.sec.should == 0
|
@@ -2,547 +2,553 @@ describe "CIFilter extensions" do
|
|
2
2
|
|
3
3
|
it "should implement the CIAdditionCompositing filter" do
|
4
4
|
-> {
|
5
|
-
CIFilter.addition_compositing.should.
|
5
|
+
CIFilter.addition_compositing.should.be.kind_of(CIFilter)
|
6
6
|
}.should.not.raise
|
7
7
|
end
|
8
8
|
|
9
9
|
it "should implement the CIAffineClamp filter" do
|
10
10
|
-> {
|
11
|
-
CIFilter.affine_clamp.should.
|
11
|
+
CIFilter.affine_clamp.should.be.kind_of(CIFilter)
|
12
12
|
}.should.not.raise
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should implement the CIAffineTile filter" do
|
16
16
|
-> {
|
17
|
-
CIFilter.affine_tile.should.
|
17
|
+
CIFilter.affine_tile.should.be.kind_of(CIFilter)
|
18
18
|
}.should.not.raise
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should implement the CIAffineTransform filter" do
|
22
22
|
-> {
|
23
|
-
CIFilter.affine_transform.should.
|
23
|
+
CIFilter.affine_transform.should.be.kind_of(CIFilter)
|
24
24
|
}.should.not.raise
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should implement the CIBarsSwipeTransition filter" do
|
28
28
|
-> {
|
29
|
-
CIFilter.bars_swipe_transition.should.
|
29
|
+
CIFilter.bars_swipe_transition.should.be.kind_of(CIFilter)
|
30
30
|
}.should.not.raise
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should implement the CIBlendWithMask filter" do
|
34
34
|
-> {
|
35
|
-
CIFilter.blend_with_mask.should.
|
35
|
+
CIFilter.blend_with_mask.should.be.kind_of(CIFilter)
|
36
36
|
}.should.not.raise
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should implement the CIBloom filter" do
|
40
40
|
-> {
|
41
|
-
CIFilter.bloom.should.
|
41
|
+
CIFilter.bloom.should.be.kind_of(CIFilter)
|
42
42
|
}.should.not.raise
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should implement the CIBumpDistortion filter" do
|
46
46
|
-> {
|
47
|
-
CIFilter.bump_distortion.should.
|
47
|
+
CIFilter.bump_distortion.should.be.kind_of(CIFilter)
|
48
48
|
}.should.not.raise
|
49
49
|
end
|
50
50
|
|
51
51
|
it "should implement the CIBumpDistortionLinear filter" do
|
52
52
|
-> {
|
53
|
-
CIFilter.bump_distortion_linear.should.
|
53
|
+
CIFilter.bump_distortion_linear.should.be.kind_of(CIFilter)
|
54
54
|
}.should.not.raise
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should implement the CICheckerboardGenerator filter" do
|
58
58
|
-> {
|
59
|
-
CIFilter.checkerboard_generator.should.
|
59
|
+
CIFilter.checkerboard_generator.should.be.kind_of(CIFilter)
|
60
60
|
}.should.not.raise
|
61
61
|
end
|
62
62
|
|
63
63
|
it "should implement the CICircleSplashDistortion filter" do
|
64
64
|
-> {
|
65
|
-
CIFilter.circle_splash_distortion.should.
|
65
|
+
CIFilter.circle_splash_distortion.should.be.kind_of(CIFilter)
|
66
66
|
}.should.not.raise
|
67
67
|
end
|
68
68
|
|
69
69
|
it "should implement the CICircularScreen filter" do
|
70
70
|
-> {
|
71
|
-
CIFilter.circular_screen.should.
|
71
|
+
CIFilter.circular_screen.should.be.kind_of(CIFilter)
|
72
72
|
}.should.not.raise
|
73
73
|
end
|
74
74
|
|
75
75
|
it "should implement the CIColorBlendMode filter" do
|
76
76
|
-> {
|
77
|
-
CIFilter.color_blend_mode.should.
|
77
|
+
CIFilter.color_blend_mode.should.be.kind_of(CIFilter)
|
78
78
|
}.should.not.raise
|
79
79
|
end
|
80
80
|
|
81
81
|
it "should implement the CIColorBurnBlendMode filter" do
|
82
82
|
-> {
|
83
|
-
CIFilter.color_burn_blend_mode.should.
|
83
|
+
CIFilter.color_burn_blend_mode.should.be.kind_of(CIFilter)
|
84
84
|
}.should.not.raise
|
85
85
|
end
|
86
86
|
|
87
87
|
it "should implement the CIColorControls filter" do
|
88
88
|
-> {
|
89
|
-
CIFilter.color_controls.should.
|
89
|
+
CIFilter.color_controls.should.be.kind_of(CIFilter)
|
90
90
|
}.should.not.raise
|
91
91
|
end
|
92
92
|
|
93
93
|
it "should implement the CIColorCube filter" do
|
94
94
|
-> {
|
95
|
-
CIFilter.color_cube.should.
|
95
|
+
CIFilter.color_cube.should.be.kind_of(CIFilter)
|
96
96
|
}.should.not.raise
|
97
97
|
end
|
98
98
|
|
99
99
|
it "should implement the CIColorDodgeBlendMode filter" do
|
100
100
|
-> {
|
101
|
-
CIFilter.color_dodge_blend_mode.should.
|
101
|
+
CIFilter.color_dodge_blend_mode.should.be.kind_of(CIFilter)
|
102
|
+
}.should.not.raise
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should implement the CIColorInvert filter" do
|
106
|
+
-> {
|
107
|
+
CIFilter.color_invert.should.be.kind_of(CIFilter)
|
102
108
|
}.should.not.raise
|
103
109
|
end
|
104
110
|
|
105
111
|
it "should implement the CIColorMap filter" do
|
106
112
|
-> {
|
107
|
-
CIFilter.color_map.should.
|
113
|
+
CIFilter.color_map.should.be.kind_of(CIFilter)
|
108
114
|
}.should.not.raise
|
109
115
|
end
|
110
116
|
|
111
117
|
it "should implement the CIColorMatrix filter" do
|
112
118
|
-> {
|
113
|
-
CIFilter.color_matrix.should.
|
119
|
+
CIFilter.color_matrix.should.be.kind_of(CIFilter)
|
114
120
|
}.should.not.raise
|
115
121
|
end
|
116
122
|
|
117
123
|
it "should implement the CIColorMonochrome filter" do
|
118
124
|
-> {
|
119
|
-
CIFilter.color_monochrome.should.
|
125
|
+
CIFilter.color_monochrome.should.be.kind_of(CIFilter)
|
120
126
|
}.should.not.raise
|
121
127
|
end
|
122
128
|
|
123
129
|
it "should implement the CIColorPosterize filter" do
|
124
130
|
-> {
|
125
|
-
CIFilter.color_posterize.should.
|
131
|
+
CIFilter.color_posterize.should.be.kind_of(CIFilter)
|
126
132
|
}.should.not.raise
|
127
133
|
end
|
128
134
|
|
129
135
|
it "should implement the CIConstantColorGenerator filter" do
|
130
136
|
-> {
|
131
|
-
CIFilter.constant_color_generator.should.
|
137
|
+
CIFilter.constant_color_generator.should.be.kind_of(CIFilter)
|
132
138
|
}.should.not.raise
|
133
139
|
end
|
134
140
|
|
135
141
|
it "should implement the CICopyMachineTransition filter" do
|
136
142
|
-> {
|
137
|
-
CIFilter.copy_machine_transition.should.
|
143
|
+
CIFilter.copy_machine_transition.should.be.kind_of(CIFilter)
|
138
144
|
}.should.not.raise
|
139
145
|
end
|
140
146
|
|
141
147
|
it "should implement the CICrop filter" do
|
142
148
|
-> {
|
143
|
-
CIFilter.crop.should.
|
149
|
+
CIFilter.crop.should.be.kind_of(CIFilter)
|
144
150
|
}.should.not.raise
|
145
151
|
end
|
146
152
|
|
147
153
|
it "should implement the CIDarkenBlendMode filter" do
|
148
154
|
-> {
|
149
|
-
CIFilter.darken_blend_mode.should.
|
155
|
+
CIFilter.darken_blend_mode.should.be.kind_of(CIFilter)
|
150
156
|
}.should.not.raise
|
151
157
|
end
|
152
158
|
|
153
159
|
it "should implement the CIDifferenceBlendMode filter" do
|
154
160
|
-> {
|
155
|
-
CIFilter.difference_blend_mode.should.
|
161
|
+
CIFilter.difference_blend_mode.should.be.kind_of(CIFilter)
|
156
162
|
}.should.not.raise
|
157
163
|
end
|
158
164
|
|
159
165
|
it "should implement the CIDisintegrateWithMaskTransition filter" do
|
160
166
|
-> {
|
161
|
-
CIFilter.disintegrate_with_mask_transition.should.
|
167
|
+
CIFilter.disintegrate_with_mask_transition.should.be.kind_of(CIFilter)
|
162
168
|
}.should.not.raise
|
163
169
|
end
|
164
170
|
|
165
171
|
it "should implement the CIDissolveTransition filter" do
|
166
172
|
-> {
|
167
|
-
CIFilter.dissolve_transition.should.
|
173
|
+
CIFilter.dissolve_transition.should.be.kind_of(CIFilter)
|
168
174
|
}.should.not.raise
|
169
175
|
end
|
170
176
|
|
171
177
|
it "should implement the CIDotScreen filter" do
|
172
178
|
-> {
|
173
|
-
CIFilter.dot_screen.should.
|
179
|
+
CIFilter.dot_screen.should.be.kind_of(CIFilter)
|
174
180
|
}.should.not.raise
|
175
181
|
end
|
176
182
|
|
177
183
|
it "should implement the CIEightfoldReflectedTile filter" do
|
178
184
|
-> {
|
179
|
-
CIFilter.eightfold_reflected_tile.should.
|
185
|
+
CIFilter.eightfold_reflected_tile.should.be.kind_of(CIFilter)
|
180
186
|
}.should.not.raise
|
181
187
|
end
|
182
188
|
|
183
189
|
it "should implement the CIExclusionBlendMode filter" do
|
184
190
|
-> {
|
185
|
-
CIFilter.exclusion_blend_mode.should.
|
191
|
+
CIFilter.exclusion_blend_mode.should.be.kind_of(CIFilter)
|
186
192
|
}.should.not.raise
|
187
193
|
end
|
188
194
|
|
189
195
|
it "should implement the CIExposureAdjust filter" do
|
190
196
|
-> {
|
191
|
-
CIFilter.exposure_adjust.should.
|
197
|
+
CIFilter.exposure_adjust.should.be.kind_of(CIFilter)
|
192
198
|
}.should.not.raise
|
193
199
|
end
|
194
200
|
|
195
201
|
it "should implement the CIFalseColor filter" do
|
196
202
|
-> {
|
197
|
-
CIFilter.false_color.should.
|
203
|
+
CIFilter.false_color.should.be.kind_of(CIFilter)
|
198
204
|
}.should.not.raise
|
199
205
|
end
|
200
206
|
|
201
207
|
it "should implement the CIFlashTransition filter" do
|
202
208
|
-> {
|
203
|
-
CIFilter.flash_transition.should.
|
209
|
+
CIFilter.flash_transition.should.be.kind_of(CIFilter)
|
204
210
|
}.should.not.raise
|
205
211
|
end
|
206
212
|
|
207
213
|
it "should implement the CIFourfoldReflectedTile filter" do
|
208
214
|
-> {
|
209
|
-
CIFilter.fourfold_reflected_tile.should.
|
215
|
+
CIFilter.fourfold_reflected_tile.should.be.kind_of(CIFilter)
|
210
216
|
}.should.not.raise
|
211
217
|
end
|
212
218
|
|
213
219
|
it "should implement the CIFourfoldRotatedTile filter" do
|
214
220
|
-> {
|
215
|
-
CIFilter.fourfold_rotated_tile.should.
|
221
|
+
CIFilter.fourfold_rotated_tile.should.be.kind_of(CIFilter)
|
216
222
|
}.should.not.raise
|
217
223
|
end
|
218
224
|
|
219
225
|
it "should implement the CIFourfoldTranslatedTile filter" do
|
220
226
|
-> {
|
221
|
-
CIFilter.fourfold_translated_tile.should.
|
227
|
+
CIFilter.fourfold_translated_tile.should.be.kind_of(CIFilter)
|
222
228
|
}.should.not.raise
|
223
229
|
end
|
224
230
|
|
225
231
|
it "should implement the CIGammaAdjust filter" do
|
226
232
|
-> {
|
227
|
-
CIFilter.gamma_adjust.should.
|
233
|
+
CIFilter.gamma_adjust.should.be.kind_of(CIFilter)
|
228
234
|
}.should.not.raise
|
229
235
|
end
|
230
236
|
|
231
237
|
it "should implement the CIGaussianBlur filter" do
|
232
238
|
-> {
|
233
|
-
CIFilter.gaussian_blur.should.
|
239
|
+
CIFilter.gaussian_blur.should.be.kind_of(CIFilter)
|
234
240
|
}.should.not.raise
|
235
241
|
end
|
236
242
|
|
237
243
|
it "should implement the CIGaussianGradient filter" do
|
238
244
|
-> {
|
239
|
-
CIFilter.gaussian_gradient.should.
|
245
|
+
CIFilter.gaussian_gradient.should.be.kind_of(CIFilter)
|
240
246
|
}.should.not.raise
|
241
247
|
end
|
242
248
|
|
243
249
|
it "should implement the CIGlideReflectedTile filter" do
|
244
250
|
-> {
|
245
|
-
CIFilter.glide_reflected_tile.should.
|
251
|
+
CIFilter.glide_reflected_tile.should.be.kind_of(CIFilter)
|
246
252
|
}.should.not.raise
|
247
253
|
end
|
248
254
|
|
249
255
|
it "should implement the CIGloom filter" do
|
250
256
|
-> {
|
251
|
-
CIFilter.gloom.should.
|
257
|
+
CIFilter.gloom.should.be.kind_of(CIFilter)
|
252
258
|
}.should.not.raise
|
253
259
|
end
|
254
260
|
|
255
261
|
it "should implement the CIHardLightBlendMode filter" do
|
256
262
|
-> {
|
257
|
-
CIFilter.hard_light_blend_mode.should.
|
263
|
+
CIFilter.hard_light_blend_mode.should.be.kind_of(CIFilter)
|
258
264
|
}.should.not.raise
|
259
265
|
end
|
260
266
|
|
261
267
|
it "should implement the CIHatchedScreen filter" do
|
262
268
|
-> {
|
263
|
-
CIFilter.hatched_screen.should.
|
269
|
+
CIFilter.hatched_screen.should.be.kind_of(CIFilter)
|
264
270
|
}.should.not.raise
|
265
271
|
end
|
266
272
|
|
267
273
|
it "should implement the CIHighlightShadowAdjust filter" do
|
268
274
|
-> {
|
269
|
-
CIFilter.highlight_shadow_adjust.should.
|
275
|
+
CIFilter.highlight_shadow_adjust.should.be.kind_of(CIFilter)
|
270
276
|
}.should.not.raise
|
271
277
|
end
|
272
278
|
|
273
279
|
it "should implement the CIHoleDistortion filter" do
|
274
280
|
-> {
|
275
|
-
CIFilter.hole_distortion.should.
|
281
|
+
CIFilter.hole_distortion.should.be.kind_of(CIFilter)
|
276
282
|
}.should.not.raise
|
277
283
|
end
|
278
284
|
|
279
285
|
it "should implement the CIHueAdjust filter" do
|
280
286
|
-> {
|
281
|
-
CIFilter.hue_adjust.should.
|
287
|
+
CIFilter.hue_adjust.should.be.kind_of(CIFilter)
|
282
288
|
}.should.not.raise
|
283
289
|
end
|
284
290
|
|
285
291
|
it "should implement the CIHueBlendMode filter" do
|
286
292
|
-> {
|
287
|
-
CIFilter.hue_blend_mode.should.
|
293
|
+
CIFilter.hue_blend_mode.should.be.kind_of(CIFilter)
|
288
294
|
}.should.not.raise
|
289
295
|
end
|
290
296
|
|
291
297
|
it "should implement the CILanczosScaleTransform filter" do
|
292
298
|
-> {
|
293
|
-
CIFilter.lanczos_scale_transform.should.
|
299
|
+
CIFilter.lanczos_scale_transform.should.be.kind_of(CIFilter)
|
294
300
|
}.should.not.raise
|
295
301
|
end
|
296
302
|
|
297
303
|
it "should implement the CILightenBlendMode filter" do
|
298
304
|
-> {
|
299
|
-
CIFilter.lighten_blend_mode.should.
|
305
|
+
CIFilter.lighten_blend_mode.should.be.kind_of(CIFilter)
|
300
306
|
}.should.not.raise
|
301
307
|
end
|
302
308
|
|
303
309
|
it "should implement the CILightTunnel filter" do
|
304
310
|
-> {
|
305
|
-
CIFilter.light_tunnel.should.
|
311
|
+
CIFilter.light_tunnel.should.be.kind_of(CIFilter)
|
306
312
|
}.should.not.raise
|
307
313
|
end
|
308
314
|
|
309
315
|
it "should implement the CILinearGradient filter" do
|
310
316
|
-> {
|
311
|
-
CIFilter.linear_gradient.should.
|
317
|
+
CIFilter.linear_gradient.should.be.kind_of(CIFilter)
|
312
318
|
}.should.not.raise
|
313
319
|
end
|
314
320
|
|
315
321
|
it "should implement the CILineScreen filter" do
|
316
322
|
-> {
|
317
|
-
CIFilter.line_screen.should.
|
323
|
+
CIFilter.line_screen.should.be.kind_of(CIFilter)
|
318
324
|
}.should.not.raise
|
319
325
|
end
|
320
326
|
|
321
327
|
it "should implement the CILuminosityBlendMode filter" do
|
322
328
|
-> {
|
323
|
-
CIFilter.luminosity_blend_mode.should.
|
329
|
+
CIFilter.luminosity_blend_mode.should.be.kind_of(CIFilter)
|
324
330
|
}.should.not.raise
|
325
331
|
end
|
326
332
|
|
327
333
|
it "should implement the CIMaximumCompositing filter" do
|
328
334
|
-> {
|
329
|
-
CIFilter.maximum_compositing.should.
|
335
|
+
CIFilter.maximum_compositing.should.be.kind_of(CIFilter)
|
330
336
|
}.should.not.raise
|
331
337
|
end
|
332
338
|
|
333
339
|
it "should implement the CIMinimumCompositing filter" do
|
334
340
|
-> {
|
335
|
-
CIFilter.minimum_compositing.should.
|
341
|
+
CIFilter.minimum_compositing.should.be.kind_of(CIFilter)
|
336
342
|
}.should.not.raise
|
337
343
|
end
|
338
344
|
|
339
345
|
it "should implement the CIModTransition filter" do
|
340
346
|
-> {
|
341
|
-
CIFilter.mod_transition.should.
|
347
|
+
CIFilter.mod_transition.should.be.kind_of(CIFilter)
|
342
348
|
}.should.not.raise
|
343
349
|
end
|
344
350
|
|
345
351
|
it "should implement the CIMultiplyBlendMode filter" do
|
346
352
|
-> {
|
347
|
-
CIFilter.multiply_blend_mode.should.
|
353
|
+
CIFilter.multiply_blend_mode.should.be.kind_of(CIFilter)
|
348
354
|
}.should.not.raise
|
349
355
|
end
|
350
356
|
|
351
357
|
it "should implement the CIMultiplyCompositing filter" do
|
352
358
|
-> {
|
353
|
-
CIFilter.multiply_compositing.should.
|
359
|
+
CIFilter.multiply_compositing.should.be.kind_of(CIFilter)
|
354
360
|
}.should.not.raise
|
355
361
|
end
|
356
362
|
|
357
363
|
it "should implement the CIOverlayBlendMode filter" do
|
358
364
|
-> {
|
359
|
-
CIFilter.overlay_blend_mode.should.
|
365
|
+
CIFilter.overlay_blend_mode.should.be.kind_of(CIFilter)
|
360
366
|
}.should.not.raise
|
361
367
|
end
|
362
368
|
|
363
369
|
it "should implement the CIPerspectiveTile filter" do
|
364
370
|
-> {
|
365
|
-
CIFilter.perspective_tile.should.
|
371
|
+
CIFilter.perspective_tile.should.be.kind_of(CIFilter)
|
366
372
|
}.should.not.raise
|
367
373
|
end
|
368
374
|
|
369
375
|
it "should implement the CIPerspectiveTransform filter" do
|
370
376
|
-> {
|
371
|
-
CIFilter.perspective_transform.should.
|
377
|
+
CIFilter.perspective_transform.should.be.kind_of(CIFilter)
|
372
378
|
}.should.not.raise
|
373
379
|
end
|
374
380
|
|
375
381
|
it "should implement the CIPerspectiveTransformWithExtent filter" do
|
376
382
|
-> {
|
377
|
-
CIFilter.perspective_transform_with_extent.should.
|
383
|
+
CIFilter.perspective_transform_with_extent.should.be.kind_of(CIFilter)
|
378
384
|
}.should.not.raise
|
379
385
|
end
|
380
386
|
|
381
387
|
it "should implement the CIPinchDistortion filter" do
|
382
388
|
-> {
|
383
|
-
CIFilter.pinch_distortion.should.
|
389
|
+
CIFilter.pinch_distortion.should.be.kind_of(CIFilter)
|
384
390
|
}.should.not.raise
|
385
391
|
end
|
386
392
|
|
387
393
|
it "should implement the CIPixellate filter" do
|
388
394
|
-> {
|
389
|
-
CIFilter.pixellate.should.
|
395
|
+
CIFilter.pixellate.should.be.kind_of(CIFilter)
|
390
396
|
}.should.not.raise
|
391
397
|
end
|
392
398
|
|
393
399
|
it "should implement the CIRadialGradient filter" do
|
394
400
|
-> {
|
395
|
-
CIFilter.radial_gradient.should.
|
401
|
+
CIFilter.radial_gradient.should.be.kind_of(CIFilter)
|
396
402
|
}.should.not.raise
|
397
403
|
end
|
398
404
|
|
399
405
|
it "should implement the CISaturationBlendMode filter" do
|
400
406
|
-> {
|
401
|
-
CIFilter.saturation_blend_mode.should.
|
407
|
+
CIFilter.saturation_blend_mode.should.be.kind_of(CIFilter)
|
402
408
|
}.should.not.raise
|
403
409
|
end
|
404
410
|
|
405
411
|
it "should implement the CIScreenBlendMode filter" do
|
406
412
|
-> {
|
407
|
-
CIFilter.screen_blend_mode.should.
|
413
|
+
CIFilter.screen_blend_mode.should.be.kind_of(CIFilter)
|
408
414
|
}.should.not.raise
|
409
415
|
end
|
410
416
|
|
411
417
|
it "should implement the CISepiaTone filter" do
|
412
418
|
-> {
|
413
|
-
CIFilter.sepia_tone.should.
|
419
|
+
CIFilter.sepia_tone.should.be.kind_of(CIFilter)
|
414
420
|
}.should.not.raise
|
415
421
|
end
|
416
422
|
|
417
423
|
it "should implement the CISharpenLuminance filter" do
|
418
424
|
-> {
|
419
|
-
CIFilter.sharpen_luminance.should.
|
425
|
+
CIFilter.sharpen_luminance.should.be.kind_of(CIFilter)
|
420
426
|
}.should.not.raise
|
421
427
|
end
|
422
428
|
|
423
429
|
it "should implement the CISixfoldReflectedTile filter" do
|
424
430
|
-> {
|
425
|
-
CIFilter.sixfold_reflected_tile.should.
|
431
|
+
CIFilter.sixfold_reflected_tile.should.be.kind_of(CIFilter)
|
426
432
|
}.should.not.raise
|
427
433
|
end
|
428
434
|
|
429
435
|
it "should implement the CISixfoldRotatedTile filter" do
|
430
436
|
-> {
|
431
|
-
CIFilter.sixfold_rotated_tile.should.
|
437
|
+
CIFilter.sixfold_rotated_tile.should.be.kind_of(CIFilter)
|
432
438
|
}.should.not.raise
|
433
439
|
end
|
434
440
|
|
435
441
|
it "should implement the CISoftLightBlendMode filter" do
|
436
442
|
-> {
|
437
|
-
CIFilter.soft_light_blend_mode.should.
|
443
|
+
CIFilter.soft_light_blend_mode.should.be.kind_of(CIFilter)
|
438
444
|
}.should.not.raise
|
439
445
|
end
|
440
446
|
|
441
447
|
it "should implement the CISourceAtopCompositing filter" do
|
442
448
|
-> {
|
443
|
-
CIFilter.source_atop_compositing.should.
|
449
|
+
CIFilter.source_atop_compositing.should.be.kind_of(CIFilter)
|
444
450
|
}.should.not.raise
|
445
451
|
end
|
446
452
|
|
447
453
|
it "should implement the CISourceInCompositing filter" do
|
448
454
|
-> {
|
449
|
-
CIFilter.source_in_compositing.should.
|
455
|
+
CIFilter.source_in_compositing.should.be.kind_of(CIFilter)
|
450
456
|
}.should.not.raise
|
451
457
|
end
|
452
458
|
|
453
459
|
it "should implement the CISourceOutCompositing filter" do
|
454
460
|
-> {
|
455
|
-
CIFilter.source_out_compositing.should.
|
461
|
+
CIFilter.source_out_compositing.should.be.kind_of(CIFilter)
|
456
462
|
}.should.not.raise
|
457
463
|
end
|
458
464
|
|
459
465
|
it "should implement the CISourceOverCompositing filter" do
|
460
466
|
-> {
|
461
|
-
CIFilter.source_over_compositing.should.
|
467
|
+
CIFilter.source_over_compositing.should.be.kind_of(CIFilter)
|
462
468
|
}.should.not.raise
|
463
469
|
end
|
464
470
|
|
465
471
|
it "should implement the CIStarShineGenerator filter" do
|
466
472
|
-> {
|
467
|
-
CIFilter.star_shine_generator.should.
|
473
|
+
CIFilter.star_shine_generator.should.be.kind_of(CIFilter)
|
468
474
|
}.should.not.raise
|
469
475
|
end
|
470
476
|
|
471
477
|
it "should implement the CIStraightenFilter filter" do
|
472
478
|
-> {
|
473
|
-
CIFilter.straighten_filter.should.
|
479
|
+
CIFilter.straighten_filter.should.be.kind_of(CIFilter)
|
474
480
|
}.should.not.raise
|
475
481
|
end
|
476
482
|
|
477
483
|
it "should implement the CIStripesGenerator filter" do
|
478
484
|
-> {
|
479
|
-
CIFilter.stripes_generator.should.
|
485
|
+
CIFilter.stripes_generator.should.be.kind_of(CIFilter)
|
480
486
|
}.should.not.raise
|
481
487
|
end
|
482
488
|
|
483
489
|
it "should implement the CISwipeTransition filter" do
|
484
490
|
-> {
|
485
|
-
CIFilter.swipe_transition.should.
|
491
|
+
CIFilter.swipe_transition.should.be.kind_of(CIFilter)
|
486
492
|
}.should.not.raise
|
487
493
|
end
|
488
494
|
|
489
495
|
it "should implement the CITemperatureAndTint filter" do
|
490
496
|
-> {
|
491
|
-
CIFilter.temperature_and_tint.should.
|
497
|
+
CIFilter.temperature_and_tint.should.be.kind_of(CIFilter)
|
492
498
|
}.should.not.raise
|
493
499
|
end
|
494
500
|
|
495
501
|
it "should implement the CIToneCurve filter" do
|
496
502
|
-> {
|
497
|
-
CIFilter.tone_curve.should.
|
503
|
+
CIFilter.tone_curve.should.be.kind_of(CIFilter)
|
498
504
|
}.should.not.raise
|
499
505
|
end
|
500
506
|
|
501
507
|
it "should implement the CITriangleKaleidoscope filter" do
|
502
508
|
-> {
|
503
|
-
CIFilter.triangle_kaleidoscope.should.
|
509
|
+
CIFilter.triangle_kaleidoscope.should.be.kind_of(CIFilter)
|
504
510
|
}.should.not.raise
|
505
511
|
end
|
506
512
|
|
507
513
|
it "should implement the CITwelvefoldReflectedTile filter" do
|
508
514
|
-> {
|
509
|
-
CIFilter.twelvefold_reflected_tile.should.
|
515
|
+
CIFilter.twelvefold_reflected_tile.should.be.kind_of(CIFilter)
|
510
516
|
}.should.not.raise
|
511
517
|
end
|
512
518
|
|
513
519
|
it "should implement the CITwirlDistortion filter" do
|
514
520
|
-> {
|
515
|
-
CIFilter.twirl_distortion.should.
|
521
|
+
CIFilter.twirl_distortion.should.be.kind_of(CIFilter)
|
516
522
|
}.should.not.raise
|
517
523
|
end
|
518
524
|
|
519
525
|
it "should implement the CIUnsharpMask filter" do
|
520
526
|
-> {
|
521
|
-
CIFilter.unsharp_mask.should.
|
527
|
+
CIFilter.unsharp_mask.should.be.kind_of(CIFilter)
|
522
528
|
}.should.not.raise
|
523
529
|
end
|
524
530
|
|
525
531
|
it "should implement the CIVibrance filter" do
|
526
532
|
-> {
|
527
|
-
CIFilter.vibrance.should.
|
533
|
+
CIFilter.vibrance.should.be.kind_of(CIFilter)
|
528
534
|
}.should.not.raise
|
529
535
|
end
|
530
536
|
|
531
537
|
it "should implement the CIVignette filter" do
|
532
538
|
-> {
|
533
|
-
CIFilter.vignette.should.
|
539
|
+
CIFilter.vignette.should.be.kind_of(CIFilter)
|
534
540
|
}.should.not.raise
|
535
541
|
end
|
536
542
|
|
537
543
|
it "should implement the CIVortexDistortion filter" do
|
538
544
|
-> {
|
539
|
-
CIFilter.vortex_distortion.should.
|
545
|
+
CIFilter.vortex_distortion.should.be.kind_of(CIFilter)
|
540
546
|
}.should.not.raise
|
541
547
|
end
|
542
548
|
|
543
549
|
it "should implement the CIWhitePointAdjust filter" do
|
544
550
|
-> {
|
545
|
-
CIFilter.white_point_adjust.should.
|
551
|
+
CIFilter.white_point_adjust.should.be.kind_of(CIFilter)
|
546
552
|
}.should.not.raise
|
547
553
|
end
|
548
554
|
|
@@ -6,17 +6,25 @@ describe "UIImage effects w/ CIImage & CIFilter" do
|
|
6
6
|
describe 'should apply a gaussian blur' do
|
7
7
|
it 'should have a gaussian_blur method' do
|
8
8
|
-> {
|
9
|
-
@image.gaussian_blur.should.
|
9
|
+
@image.gaussian_blur.should.be.kind_of(UIImage)
|
10
10
|
}.should.not.raise
|
11
11
|
end
|
12
12
|
it 'should accept a :radius option' do
|
13
13
|
-> {
|
14
|
-
@image.gaussian_blur(radius: 5).should.
|
14
|
+
@image.gaussian_blur(radius: 5).should.be.kind_of(UIImage)
|
15
15
|
}.should.not.raise
|
16
16
|
end
|
17
17
|
it 'should accept a :radius argument in 0th position' do
|
18
18
|
-> {
|
19
|
-
@image.gaussian_blur(5).should.
|
19
|
+
@image.gaussian_blur(5).should.be.kind_of(UIImage)
|
20
|
+
}.should.not.raise
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'should apply inverted colors' do
|
25
|
+
it 'should have inverted method' do
|
26
|
+
-> {
|
27
|
+
@image.inverted.should.be.kind_of(UIImage)
|
20
28
|
}.should.not.raise
|
21
29
|
end
|
22
30
|
end
|
@@ -24,22 +32,22 @@ describe "UIImage effects w/ CIImage & CIFilter" do
|
|
24
32
|
describe 'should apply a darken filter' do
|
25
33
|
it 'should have a darken method' do
|
26
34
|
-> {
|
27
|
-
@image.darken.should.
|
35
|
+
@image.darken.should.be.kind_of(UIImage)
|
28
36
|
}.should.not.raise
|
29
37
|
end
|
30
38
|
it 'should accept a :saturation option' do
|
31
39
|
-> {
|
32
|
-
@image.darken(saturation: 5).should.
|
40
|
+
@image.darken(saturation: 5).should.be.kind_of(UIImage)
|
33
41
|
}.should.not.raise
|
34
42
|
end
|
35
43
|
it 'should accept a :brightness option' do
|
36
44
|
-> {
|
37
|
-
@image.darken(brightness: 5).should.
|
45
|
+
@image.darken(brightness: 5).should.be.kind_of(UIImage)
|
38
46
|
}.should.not.raise
|
39
47
|
end
|
40
48
|
it 'should accept a :saturation and a :brightness option' do
|
41
49
|
-> {
|
42
|
-
@image.darken(saturation: 5, brightness: 5).should.
|
50
|
+
@image.darken(saturation: 5, brightness: 5).should.be.kind_of(UIImage)
|
43
51
|
}.should.not.raise
|
44
52
|
end
|
45
53
|
end
|
data/spec/ios/nsdata_spec.rb
CHANGED
@@ -34,21 +34,21 @@ describe "NSData" do
|
|
34
34
|
|
35
35
|
it "shouldn't need a format" do
|
36
36
|
new_image = @image.nsdata.uiimage
|
37
|
-
new_image.should.
|
37
|
+
new_image.should.be.kind_of UIImage
|
38
38
|
new_image.size.width.should == @image.size.width * @image.scale
|
39
39
|
new_image.size.height.should == @image.size.height * @image.scale
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should support :png" do
|
43
43
|
new_image = @image.nsdata(:png).uiimage
|
44
|
-
new_image.should.
|
44
|
+
new_image.should.be.kind_of UIImage
|
45
45
|
new_image.size.width.should == @image.size.width * @image.scale
|
46
46
|
new_image.size.height.should == @image.size.height * @image.scale
|
47
47
|
end
|
48
48
|
|
49
49
|
it "should support :jpg" do
|
50
50
|
new_image = @image.nsdata(:jpg).uiimage
|
51
|
-
new_image.should.
|
51
|
+
new_image.should.be.kind_of UIImage
|
52
52
|
new_image.size.width.should == @image.size.width * @image.scale
|
53
53
|
new_image.size.height.should == @image.size.height * @image.scale
|
54
54
|
end
|
@@ -194,7 +194,7 @@ describe 'NSString' do
|
|
194
194
|
describe 'file_url' do
|
195
195
|
|
196
196
|
it 'should convert path String to NSURL' do
|
197
|
-
'test'.resource_path.file_url.should.
|
197
|
+
'test'.resource_path.file_url.should.be.kind_of(NSURL)
|
198
198
|
end
|
199
199
|
|
200
200
|
it 'should be a file path' do
|
@@ -99,13 +99,25 @@ describe "Symbol - constants" do
|
|
99
99
|
:center.nstextalignment.should == NSTextAlignmentCenter
|
100
100
|
end
|
101
101
|
|
102
|
-
it 'should support `
|
103
|
-
:
|
104
|
-
:
|
105
|
-
:
|
106
|
-
:
|
107
|
-
:
|
108
|
-
:
|
102
|
+
it 'should support `nslinebreakmode`' do
|
103
|
+
:word_wrapping.nslinebreakmode.should == NSLineBreakByWordWrapping
|
104
|
+
:word_wrap.nslinebreakmode.should == NSLineBreakByWordWrapping
|
105
|
+
:word.nslinebreakmode.should == NSLineBreakByWordWrapping
|
106
|
+
:char_wrapping.nslinebreakmode.should == NSLineBreakByCharWrapping
|
107
|
+
:char_wrap.nslinebreakmode.should == NSLineBreakByCharWrapping
|
108
|
+
:character_wrap.nslinebreakmode.should == NSLineBreakByCharWrapping
|
109
|
+
:char.nslinebreakmode.should == NSLineBreakByCharWrapping
|
110
|
+
:clipping.nslinebreakmode.should == NSLineBreakByClipping
|
111
|
+
:clip.nslinebreakmode.should == NSLineBreakByClipping
|
112
|
+
:truncating_head.nslinebreakmode.should == NSLineBreakByTruncatingHead
|
113
|
+
:head_truncation.nslinebreakmode.should == NSLineBreakByTruncatingHead
|
114
|
+
:head.nslinebreakmode.should == NSLineBreakByTruncatingHead
|
115
|
+
:truncating_tail.nslinebreakmode.should == NSLineBreakByTruncatingTail
|
116
|
+
:tail_truncation.nslinebreakmode.should == NSLineBreakByTruncatingTail
|
117
|
+
:tail.nslinebreakmode.should == NSLineBreakByTruncatingTail
|
118
|
+
:truncating_middle.nslinebreakmode.should == NSLineBreakByTruncatingMiddle
|
119
|
+
:middle_truncation.nslinebreakmode.should == NSLineBreakByTruncatingMiddle
|
120
|
+
:middle.nslinebreakmode.should == NSLineBreakByTruncatingMiddle
|
109
121
|
end
|
110
122
|
|
111
123
|
it 'should support `uibaselineadjustment`' do
|
@@ -482,6 +494,17 @@ describe "Symbol - constants" do
|
|
482
494
|
|
483
495
|
it 'should support `uitextalignment`' do
|
484
496
|
:left.uialignment.should == :left.uitextalignment
|
497
|
+
SugarCube.log.length.should > 0
|
498
|
+
end
|
499
|
+
|
500
|
+
it 'should support `uilinebreakmode`' do
|
501
|
+
:word_wrap.uilinebreakmode.should == NSLineBreakByWordWrapping
|
502
|
+
:character_wrap.uilinebreakmode.should == NSLineBreakByCharWrapping
|
503
|
+
:clip.uilinebreakmode.should == NSLineBreakByClipping
|
504
|
+
:head_truncation.uilinebreakmode.should == NSLineBreakByTruncatingHead
|
505
|
+
:tail_truncation.uilinebreakmode.should == NSLineBreakByTruncatingTail
|
506
|
+
:middle_truncation.uilinebreakmode.should == NSLineBreakByTruncatingMiddle
|
507
|
+
SugarCube.log.length.should > 0
|
485
508
|
end
|
486
509
|
|
487
510
|
it 'should support `uibaselineadjustment`' do
|
@@ -509,15 +532,6 @@ describe "Symbol - constants" do
|
|
509
532
|
SugarCube.log.length.should > 0
|
510
533
|
end
|
511
534
|
|
512
|
-
it 'should support `uilinebreakmode`' do
|
513
|
-
:wordwrap.uilinebreakmode.should == :word_wrap.uilinebreakmode
|
514
|
-
:characterwrap.uilinebreakmode.should == :character_wrap.uilinebreakmode
|
515
|
-
:headtruncation.uilinebreakmode.should == :head_truncation.uilinebreakmode
|
516
|
-
:tailtruncation.uilinebreakmode.should == :tail_truncation.uilinebreakmode
|
517
|
-
:middletruncation.uilinebreakmode.should == :middle_truncation.uilinebreakmode
|
518
|
-
SugarCube.log.length.should > 0
|
519
|
-
end
|
520
|
-
|
521
535
|
it 'should support `nsnumberstyle`' do
|
522
536
|
:spellout.nsnumberstyle.should == :spell_out.nsnumberstyle
|
523
537
|
SugarCube.log.length.should > 0
|
@@ -598,6 +612,10 @@ describe "Symbol - constants" do
|
|
598
612
|
:align_baselines.uibaseline.should == :align_baselines.uibaselineadjustment
|
599
613
|
end
|
600
614
|
|
615
|
+
it 'should have alias for `nslinebreakmode`' do
|
616
|
+
:head.nslinebreakmode.should == :head.nslinebreak
|
617
|
+
end
|
618
|
+
|
601
619
|
it 'should have alias for `uibordertype`' do
|
602
620
|
:none.uiborderstyle.should == :none.uibordertype
|
603
621
|
end
|
@@ -731,6 +749,10 @@ describe "Symbol - constants" do
|
|
731
749
|
should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.uilinebreakmode }
|
732
750
|
end
|
733
751
|
|
752
|
+
it 'should not find nonexistant `nslinebreakmode`' do
|
753
|
+
should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.nslinebreakmode }
|
754
|
+
end
|
755
|
+
|
734
756
|
it 'should not find nonexistant `uibaselineadjustment`' do
|
735
757
|
should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.uibaselineadjustment }
|
736
758
|
end
|
data/spec/ios/uiimage_spec.rb
CHANGED
@@ -3,7 +3,7 @@ describe 'UIImage' do
|
|
3
3
|
describe 'UIImage.canvas' do
|
4
4
|
|
5
5
|
it 'should create an image' do
|
6
|
-
UIImage.canvas(size: [10, 10]).should.
|
6
|
+
UIImage.canvas(size: [10, 10]).should.be.kind_of UIImage
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'should have the right size' do
|
@@ -486,7 +486,7 @@ describe 'UIImage' do
|
|
486
486
|
CGContextAddRect(context, [[0, 0], [10, 10]])
|
487
487
|
CGContextFillPath(context)
|
488
488
|
end
|
489
|
-
red.overlay(:white).should.
|
489
|
+
red.overlay(:white).should.be.kind_of UIImage
|
490
490
|
end
|
491
491
|
|
492
492
|
it 'should return an image that is the same size' do
|
@@ -88,6 +88,23 @@ describe "Symbol - constants" do
|
|
88
88
|
:exterior.nsfocusringtype.should == NSFocusRingTypeExterior
|
89
89
|
end
|
90
90
|
|
91
|
+
it 'should support `nslinebreakmode`' do
|
92
|
+
:word_wrapping.nslinebreakmode.should == NSLineBreakByWordWrapping
|
93
|
+
:word_wrap.nslinebreakmode.should == NSLineBreakByWordWrapping
|
94
|
+
:word.nslinebreakmode.should == NSLineBreakByWordWrapping
|
95
|
+
:char_wrapping.nslinebreakmode.should == NSLineBreakByCharWrapping
|
96
|
+
:char_wrap.nslinebreakmode.should == NSLineBreakByCharWrapping
|
97
|
+
:char.nslinebreakmode.should == NSLineBreakByCharWrapping
|
98
|
+
:clipping.nslinebreakmode.should == NSLineBreakByClipping
|
99
|
+
:clip.nslinebreakmode.should == NSLineBreakByClipping
|
100
|
+
:truncating_head.nslinebreakmode.should == NSLineBreakByTruncatingHead
|
101
|
+
:head.nslinebreakmode.should == NSLineBreakByTruncatingHead
|
102
|
+
:truncating_tail.nslinebreakmode.should == NSLineBreakByTruncatingTail
|
103
|
+
:tail.nslinebreakmode.should == NSLineBreakByTruncatingTail
|
104
|
+
:truncating_middle.nslinebreakmode.should == NSLineBreakByTruncatingMiddle
|
105
|
+
:middle.nslinebreakmode.should == NSLineBreakByTruncatingMiddle
|
106
|
+
end
|
107
|
+
|
91
108
|
it 'should support `catimingfunction`' do
|
92
109
|
:linear.catimingfunction.should == KCAMediaTimingFunctionLinear
|
93
110
|
:ease_in.catimingfunction.should == KCAMediaTimingFunctionEaseIn
|
@@ -140,6 +157,10 @@ describe "Symbol - constants" do
|
|
140
157
|
:miter.cglinejoinstyle.should == :miter.cglinejoin
|
141
158
|
end
|
142
159
|
|
160
|
+
it 'should have alias for `nslinebreakmode`' do
|
161
|
+
:head.nslinebreakmode.should == :head.nslinebreak
|
162
|
+
end
|
163
|
+
|
143
164
|
end
|
144
165
|
|
145
166
|
describe "not found" do
|
@@ -171,6 +192,10 @@ describe "Symbol - constants" do
|
|
171
192
|
should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.nsfocusringtype }
|
172
193
|
end
|
173
194
|
|
195
|
+
it 'should not find nonexistant `nslinebreakmode`' do
|
196
|
+
should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.nslinebreakmode }
|
197
|
+
end
|
198
|
+
|
174
199
|
it 'should not find nonexistant `catimingfunction`' do
|
175
200
|
should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.catimingfunction }
|
176
201
|
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: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colin T.A. Gray
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-
|
14
|
+
date: 2014-08-26 00:00:00.000000000 Z
|
15
15
|
dependencies: []
|
16
16
|
description: |
|
17
17
|
== Description
|