sugarcube 1.1.0 → 1.3.0
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.
- data/Gemfile.lock +1 -1
- data/README.md +73 -10
- data/lib/sugarcube-animations/caanimation.rb +31 -0
- data/lib/sugarcube-animations/calayer.rb +7 -0
- data/lib/sugarcube-animations/uiview.rb +59 -34
- data/lib/sugarcube-attributedstring/nsattributedstring.rb +7 -0
- data/lib/sugarcube-color/nsstring.rb +1 -1
- data/lib/sugarcube-color/symbol.rb +2 -2
- data/lib/sugarcube-color/uicolor.rb +56 -10
- data/lib/sugarcube-corelocation/core_location.rb +12 -3
- data/lib/sugarcube-factories/uiactionsheet.rb +5 -4
- data/lib/sugarcube-factories/uialertview.rb +4 -5
- data/lib/sugarcube-image/ciimage.rb +2 -3
- data/lib/sugarcube-image/uiimage.rb +245 -97
- data/lib/sugarcube-nsdate/date_parser.rb +14 -12
- data/lib/sugarcube-nsdate/nsstring.rb +5 -0
- data/lib/sugarcube-nsdate/{fixnum.rb → numeric.rb} +12 -3
- data/lib/sugarcube-numbers/numeric.rb +7 -0
- data/lib/sugarcube-to_s/uilabel.rb +1 -1
- data/lib/sugarcube-to_s/uiview.rb +1 -2
- data/lib/sugarcube-uikit/uiview.rb +75 -5
- data/lib/sugarcube/version.rb +1 -1
- data/spec/nsattributedstring_spec.rb +4 -0
- data/spec/nsstring_files_spec.rb +18 -15
- data/spec/uiactionsheet_spec.rb +40 -2
- data/spec/uialertview_spec.rb +10 -3
- data/spec/uicolor_spec.rb +39 -0
- data/spec/uiimage_spec.rb +471 -0
- data/spec/uiview_spec.rb +90 -22
- metadata +9 -3
data/spec/uiview_spec.rb
CHANGED
@@ -28,28 +28,96 @@ describe "UIView" do
|
|
28
28
|
image.scale.should == UIScreen.mainScreen.scale
|
29
29
|
end
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
31
|
+
describe "should convert bounds" do
|
32
|
+
before do
|
33
|
+
@view1 = UIView.alloc.initWithFrame([[0, 0], [100, 100]])
|
34
|
+
@view2 = UIView.alloc.initWithFrame([[10, 5], [80, 90]])
|
35
|
+
@view1 << @view2
|
36
|
+
@view3 = UIView.alloc.initWithFrame([[10, 5], [60, 80]])
|
37
|
+
@view2 << @view3
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should convert_frame_to" do
|
41
|
+
frame = @view3.convert_frame_to(@view1)
|
42
|
+
frame.origin.x.should == 20
|
43
|
+
frame.origin.y.should == 10
|
44
|
+
frame.size.width.should == 60
|
45
|
+
frame.size.height.should == 80
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should convert_frame_from" do
|
49
|
+
frame = @view1.convert_frame_from(@view3)
|
50
|
+
frame.origin.x.should == 20
|
51
|
+
frame.origin.y.should == 10
|
52
|
+
frame.size.width.should == 60
|
53
|
+
frame.size.height.should == 80
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe "should convert point" do
|
58
|
+
before do
|
59
|
+
@view1 = UIView.alloc.initWithFrame([[0, 0], [100, 100]])
|
60
|
+
@view2 = UIView.alloc.initWithFrame([[10, 5], [80, 90]])
|
61
|
+
@view1 << @view2
|
62
|
+
@view3 = UIView.alloc.initWithFrame([[10, 5], [60, 80]])
|
63
|
+
@view2 << @view3
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should convert_origin_to" do
|
67
|
+
point = @view3.convert_origin_to(@view1)
|
68
|
+
point.x.should == 20
|
69
|
+
point.y.should == 10
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should convert_origin_from" do
|
73
|
+
point = @view1.convert_origin_from(@view3)
|
74
|
+
point.x.should == 20
|
75
|
+
point.y.should == 10
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should return x" do
|
80
|
+
view = UIView.alloc.initWithFrame([[100, 200], [300, 400]])
|
81
|
+
view.x.should == view.frame.origin.x
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should set x" do
|
85
|
+
view = UIView.alloc.initWithFrame([[100, 200], [300, 400]])
|
86
|
+
view.x = 500
|
87
|
+
view.x.should == 500
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should return y" do
|
91
|
+
view = UIView.alloc.initWithFrame([[100, 200], [300, 400]])
|
92
|
+
view.y.should == view.frame.origin.y
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should set y" do
|
96
|
+
view = UIView.alloc.initWithFrame([[100, 200], [300, 400]])
|
97
|
+
view.y = 500
|
98
|
+
view.y.should == 500
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should return width" do
|
102
|
+
view = UIView.alloc.initWithFrame([[100, 200], [300, 400]])
|
103
|
+
view.width.should == view.frame.size.width
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should set width" do
|
107
|
+
view = UIView.alloc.initWithFrame([[100, 200], [300, 400]])
|
108
|
+
view.width = 500
|
109
|
+
view.width.should == 500
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should return height" do
|
113
|
+
view = UIView.alloc.initWithFrame([[100, 200], [300, 400]])
|
114
|
+
view.height.should == view.frame.size.height
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should set height" do
|
118
|
+
view = UIView.alloc.initWithFrame([[100, 200], [300, 400]])
|
119
|
+
view.height = 500
|
120
|
+
view.height.should == 500
|
53
121
|
end
|
54
122
|
|
55
123
|
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: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-
|
15
|
+
date: 2013-10-09 00:00:00.000000000 Z
|
16
16
|
dependencies: []
|
17
17
|
description: ! '== Description
|
18
18
|
|
@@ -57,6 +57,8 @@ files:
|
|
57
57
|
- lib/sugarcube-all.rb
|
58
58
|
- lib/sugarcube-animations.rb
|
59
59
|
- lib/sugarcube-animations/animation_chain.rb
|
60
|
+
- lib/sugarcube-animations/caanimation.rb
|
61
|
+
- lib/sugarcube-animations/calayer.rb
|
60
62
|
- lib/sugarcube-animations/uiview.rb
|
61
63
|
- lib/sugarcube-anonymous.rb
|
62
64
|
- lib/sugarcube-anonymous/anonymous.rb
|
@@ -133,10 +135,10 @@ files:
|
|
133
135
|
- lib/sugarcube-nsdata/uiimage.rb
|
134
136
|
- lib/sugarcube-nsdate.rb
|
135
137
|
- lib/sugarcube-nsdate/date_parser.rb
|
136
|
-
- lib/sugarcube-nsdate/fixnum.rb
|
137
138
|
- lib/sugarcube-nsdate/nsdate.rb
|
138
139
|
- lib/sugarcube-nsdate/nsdate_delta.rb
|
139
140
|
- lib/sugarcube-nsdate/nsstring.rb
|
141
|
+
- lib/sugarcube-nsdate/numeric.rb
|
140
142
|
- lib/sugarcube-nsuserdefaults.rb
|
141
143
|
- lib/sugarcube-nsuserdefaults/nsuserdefaults.rb
|
142
144
|
- lib/sugarcube-numbers.rb
|
@@ -237,7 +239,9 @@ files:
|
|
237
239
|
- spec/uiactionsheet_spec.rb
|
238
240
|
- spec/uialertview_spec.rb
|
239
241
|
- spec/uibarbuttonitem_spec.rb
|
242
|
+
- spec/uicolor_spec.rb
|
240
243
|
- spec/uicontrol_spec.rb
|
244
|
+
- spec/uiimage_spec.rb
|
241
245
|
- spec/uilabel_spec.rb
|
242
246
|
- spec/uitableviewcell_spec.rb
|
243
247
|
- spec/uiview_animation_spec.rb
|
@@ -312,7 +316,9 @@ test_files:
|
|
312
316
|
- spec/uiactionsheet_spec.rb
|
313
317
|
- spec/uialertview_spec.rb
|
314
318
|
- spec/uibarbuttonitem_spec.rb
|
319
|
+
- spec/uicolor_spec.rb
|
315
320
|
- spec/uicontrol_spec.rb
|
321
|
+
- spec/uiimage_spec.rb
|
316
322
|
- spec/uilabel_spec.rb
|
317
323
|
- spec/uitableviewcell_spec.rb
|
318
324
|
- spec/uiview_animation_spec.rb
|