meme_captain 0.1.0 → 0.1.1
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/ChangeLog +62 -2
- data/Gemfile +3 -0
- data/README.md +6 -1
- data/config.ru +4 -0
- data/doc/lightweight_front_end.md +64 -0
- data/doc/setup.md +13 -0
- data/lib/meme_captain/image_list/fetch.rb +2 -0
- data/lib/meme_captain/meme.rb +16 -4
- data/lib/meme_captain/memebg.rb +62 -0
- data/lib/meme_captain/norm_params.rb +92 -0
- data/lib/meme_captain/pretty_format.rb +12 -0
- data/lib/meme_captain/server.rb +134 -74
- data/lib/meme_captain/upload.rb +30 -0
- data/lib/meme_captain/version.rb +1 -1
- data/lib/meme_captain.rb +4 -1
- data/meme_captain.gemspec +2 -0
- data/public/css/screen.css +14 -0
- data/public/favicon.ico +0 -0
- data/public/js/fabric.min.js +3 -3
- data/public/js/jquery-1.7.2.min.js +4 -0
- data/public/js/meme_captain.js +403 -0
- data/public/source_images.json +65 -1
- data/public/thumbs.jpg +0 -0
- data/public/thumbs_1330486916.jpg +0 -0
- data/public/thumbs_1333591668.jpg +0 -0
- data/public/thumbs_1334189407.jpg +0 -0
- data/public/thumbs_1334973608.jpg +0 -0
- data/script/thumb_sprites.rb +57 -14
- data/spec/caption_choice_spec.rb +53 -0
- data/spec/caption_spec.rb +45 -0
- data/spec/image_list/fetch_spec.rb +33 -0
- data/spec/meme_captain_spec.rb +8 -2
- data/spec/memebg_spec.rb +14 -0
- data/spec/norm_params_spec.rb +223 -0
- data/spec/pretty_format_spec.rb +9 -0
- data/spec/text_pos_spec.rb +29 -0
- data/views/index.erb +14 -335
- metadata +150 -161
- data/lib/meme_captain/file_body.rb +0 -15
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
require 'meme_captain'
|
|
2
|
+
|
|
3
|
+
describe MemeCaptain::CaptionChoice do
|
|
4
|
+
|
|
5
|
+
it 'should rank choices with text that fits higher' do
|
|
6
|
+
metrics = double('metrics', :width => 200, :height => 100)
|
|
7
|
+
|
|
8
|
+
caption_choice1 = MemeCaptain::CaptionChoice.new(12, metrics,
|
|
9
|
+
"the quick brown fox", 200, 99)
|
|
10
|
+
|
|
11
|
+
caption_choice2 = MemeCaptain::CaptionChoice.new(12, metrics,
|
|
12
|
+
"the quick brown fox", 200, 100)
|
|
13
|
+
|
|
14
|
+
caption_choice1.should be < caption_choice2
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'should rank choices with higher point size higher' do
|
|
18
|
+
metrics = double('metrics', :width => 200, :height => 100)
|
|
19
|
+
|
|
20
|
+
caption_choice1 = MemeCaptain::CaptionChoice.new(12, metrics,
|
|
21
|
+
"the quick brown fox", 200, 100)
|
|
22
|
+
|
|
23
|
+
caption_choice2 = MemeCaptain::CaptionChoice.new(13, metrics,
|
|
24
|
+
"the quick brown fox", 200, 100)
|
|
25
|
+
|
|
26
|
+
caption_choice1.should be < caption_choice2
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'should rank choices with less lines higher when the text fits' do
|
|
30
|
+
metrics = double('metrics', :width => 200, :height => 100)
|
|
31
|
+
|
|
32
|
+
caption_choice1 = MemeCaptain::CaptionChoice.new(12, metrics,
|
|
33
|
+
"the quick\nbrown fox", 200, 100)
|
|
34
|
+
|
|
35
|
+
caption_choice2 = MemeCaptain::CaptionChoice.new(12, metrics,
|
|
36
|
+
"the quick brown fox", 200, 100)
|
|
37
|
+
|
|
38
|
+
caption_choice1.should be < caption_choice2
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'should rank choices with more lines higher when the text does not fit' do
|
|
42
|
+
metrics = double('metrics', :width => 200, :height => 100)
|
|
43
|
+
|
|
44
|
+
caption_choice1 = MemeCaptain::CaptionChoice.new(12, metrics,
|
|
45
|
+
"the quick brown fox", 200, 99)
|
|
46
|
+
|
|
47
|
+
caption_choice2 = MemeCaptain::CaptionChoice.new(12, metrics,
|
|
48
|
+
"the quick\nbrown fox", 200, 99)
|
|
49
|
+
|
|
50
|
+
caption_choice1.should be < caption_choice2
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
require 'meme_captain'
|
|
2
|
+
|
|
3
|
+
describe MemeCaptain::Caption do
|
|
4
|
+
|
|
5
|
+
it 'should quote backslashes for ImageMagick annotate' do
|
|
6
|
+
MemeCaptain::Caption.new('\\foo\\bar\\').annotate_quote.should ==
|
|
7
|
+
'\\\\foo\\\\bar\\\\'
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it 'should quote percent signs for ImageMagick annotate' do
|
|
11
|
+
MemeCaptain::Caption.new('%foo%bar%').annotate_quote.should ==
|
|
12
|
+
'\%foo\%bar\%'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it 'should be drawable if it contains at least one non-whitespace character' do
|
|
16
|
+
MemeCaptain::Caption.new('a').should be_drawable
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'should not be drawable if it is all whitespace' do
|
|
20
|
+
MemeCaptain::Caption.new(' ').should_not be_drawable
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'should not be drawable if it is empty' do
|
|
24
|
+
MemeCaptain::Caption.new('').should_not be_drawable
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'should not be drawable if it is nil' do
|
|
28
|
+
MemeCaptain::Caption.new(nil).should_not be_drawable
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'should wrap a string into two roughly equal lines' do
|
|
32
|
+
MemeCaptain::Caption.new(
|
|
33
|
+
'the quick brown fox jumped over the lazy dog').wrap(2).should ==
|
|
34
|
+
"the quick brown fox\njumped over the lazy dog"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'should wrap a string into as many lines as it can' do
|
|
38
|
+
MemeCaptain::Caption.new('foo bar').wrap(3).should == "foo\nbar"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'should not wrap text with no whitespace' do
|
|
42
|
+
MemeCaptain::Caption.new('foobar').wrap(2).should == 'foobar'
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'base64'
|
|
2
|
+
|
|
3
|
+
require 'RMagick'
|
|
4
|
+
require 'webmock/rspec'
|
|
5
|
+
|
|
6
|
+
require 'meme_captain'
|
|
7
|
+
|
|
8
|
+
describe MemeCaptain::ImageList::Fetch do
|
|
9
|
+
|
|
10
|
+
it 'should load an image from a URL' do
|
|
11
|
+
stub_request(:get, 'http://memecaptain.com/good.jpg').to_return(
|
|
12
|
+
:body => Base64.decode64(
|
|
13
|
+
'iVBORw0KGgoAAAANSUhEUgAAAcwAAAAyAgMAAACsWgPIAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9wBHwQoJY1iyrwAAAAJUExURQAAAAAAAP///4Pdz9IAAAABdFJOUwBA5thmAAAAAWJLR0QB/wIt3gAAAHpJREFUWIXt1zESgCAMRNE03s9mG+9ns6e0EaKCqDOWf4sUJOHREvqciOn7Us0cEZiYmJhnc7HtVbJtS5LsVRo09DScZzmSG5iYmJit2RTVlduGquS920hFvxRMTEzMRzOv6TfKheMX9ThMTEzMnvlj5ld/S0xMTMxjNoGjc3pdi6L4AAAAAElFTkSuQmCC'))
|
|
14
|
+
|
|
15
|
+
i = Magick::ImageList.new
|
|
16
|
+
i.extend MemeCaptain::ImageList::Fetch
|
|
17
|
+
i.fetch! 'http://memecaptain.com/good.jpg'
|
|
18
|
+
|
|
19
|
+
i.columns.should == 460
|
|
20
|
+
i.rows.should == 50
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'should raise FetchError if the URL is not found' do
|
|
24
|
+
i = Magick::ImageList.new
|
|
25
|
+
i.extend MemeCaptain::ImageList::Fetch
|
|
26
|
+
stub_request(:get, 'http://memecaptain.com/does_not_exist.jpg').to_return(
|
|
27
|
+
:status => 404)
|
|
28
|
+
expect {
|
|
29
|
+
i.fetch! 'http://memecaptain.com/does_not_exist.jpg'
|
|
30
|
+
}.to raise_error(MemeCaptain::ImageList::FetchError)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
data/spec/meme_captain_spec.rb
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
require 'base64'
|
|
1
2
|
require 'open-uri'
|
|
2
3
|
|
|
4
|
+
require 'webmock/rspec'
|
|
5
|
+
|
|
3
6
|
require 'meme_captain'
|
|
4
7
|
|
|
5
8
|
describe MemeCaptain, '.meme_top_bottom' do
|
|
6
9
|
|
|
7
10
|
it 'generates a meme image with text at the top and bottom' do
|
|
11
|
+
stub_request(:get, 'http://memecaptain.com/good.jpg').to_return(
|
|
12
|
+
:body => Base64.decode64(
|
|
13
|
+
'iVBORw0KGgoAAAANSUhEUgAAAcwAAAAyAgMAAACsWgPIAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9wBHwQoJY1iyrwAAAAJUExURQAAAAAAAP///4Pdz9IAAAABdFJOUwBA5thmAAAAAWJLR0QB/wIt3gAAAHpJREFUWIXt1zESgCAMRNE03s9mG+9ns6e0EaKCqDOWf4sUJOHREvqciOn7Us0cEZiYmJhnc7HtVbJtS5LsVRo09DScZzmSG5iYmJit2RTVlduGquS920hFvxRMTEzMRzOv6TfKheMX9ThMTEzMnvlj5ld/S0xMTMxjNoGjc3pdi6L4AAAAAElFTkSuQmCC'))
|
|
14
|
+
|
|
8
15
|
i = MemeCaptain.meme_top_bottom(
|
|
9
|
-
open('http://memecaptain.com/
|
|
10
|
-
i.display
|
|
16
|
+
open('http://memecaptain.com/good.jpg'), 'top text', 'bottom text')
|
|
11
17
|
end
|
|
12
18
|
|
|
13
19
|
end
|
data/spec/memebg_spec.rb
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require 'meme_captain'
|
|
2
|
+
|
|
3
|
+
describe MemeCaptain, '.memebg' do
|
|
4
|
+
|
|
5
|
+
it 'generates a pie slice meme background image' do
|
|
6
|
+
size = 100
|
|
7
|
+
colors = %w{red blue yellow #bada55}
|
|
8
|
+
m = MemeCaptain.memebg(size, colors, 20)
|
|
9
|
+
|
|
10
|
+
m.columns.should == size
|
|
11
|
+
m.rows.should == size
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
end
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
require 'meme_captain'
|
|
2
|
+
|
|
3
|
+
describe MemeCaptain::NormParams do
|
|
4
|
+
|
|
5
|
+
def check(input, expected)
|
|
6
|
+
norm_params = MemeCaptain::NormParams.new(input)
|
|
7
|
+
expected.each { |k,v| norm_params.send(k).should == v }
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it 'should leave u as the default if u is not passed in' do
|
|
11
|
+
check({}, { :u => '' })
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'should set u to the empty string if u is passed in as nil' do
|
|
15
|
+
check({ :u => nil }, { :u => '' })
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'should set the u param' do
|
|
19
|
+
check({ :u => 'foo' }, { :u => 'foo' })
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'should leave t1 as the default if t1 is not passed in' do
|
|
23
|
+
check({}, { :t1 => '' })
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'should set t1 to the empty string if t1 is passed in as nil' do
|
|
27
|
+
check({ :t1 => nil }, { :t1 => '' })
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'should set the t1 param' do
|
|
31
|
+
check({ :t1 => 'foo' }, { :t1 => 'foo' })
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'should leave t2 as the default if t2 is not passed in' do
|
|
35
|
+
check({}, { :t2 => '' })
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'should set t2 to the empty string if t2 is passed in as nil' do
|
|
39
|
+
check({ :t2 => nil }, { :t2 => '' })
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'should set the t2 param' do
|
|
43
|
+
check({ :t2 => 'foo' }, { :t2 => 'foo' })
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it 'should leave t1x as the default if t1x is not passed in' do
|
|
47
|
+
check({}, { :t1x => 0.05 })
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'should leave t1x as the default if t1x is passed in as nil' do
|
|
51
|
+
check({ :t1x => nil }, { :t1x => 0.05 })
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it 'should leave t1x as the default if t1x is passed in as the empty string' do
|
|
55
|
+
check({ :t1x => '' }, { :t1x => 0.05 })
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it 'should convert a float t1x to a float' do
|
|
59
|
+
check({ :t1x => '1.2' }, { :t1x => 1.2 })
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it 'should convert an integer t1x to an integer' do
|
|
63
|
+
check({ :t1x => '34' }, { :t1x => 34 })
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it 'should leave t1y as the default if t1y is not passed in' do
|
|
67
|
+
check({}, { :t1y => 0 })
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it 'should leave t1y as the default if t1y is passed in as nil' do
|
|
71
|
+
check({ :t1y => nil }, { :t1y => 0 })
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it 'should leave t1y as the default if t1y is passed in as the empty string' do
|
|
75
|
+
check({ :t1y => '' }, { :t1y => 0 })
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it 'should convert a float t1y to a float' do
|
|
79
|
+
check({ :t1y => '1.2' }, { :t1y => 1.2 })
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it 'should convert an integer t1y to an integer' do
|
|
83
|
+
check({ :t1y => '34' }, { :t1y => 34 })
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
it 'should leave t1w as the default if t1w is not passed in' do
|
|
87
|
+
check({}, { :t1w => 0.9 })
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it 'should leave t1w as the default if t1w is passed in as nil' do
|
|
91
|
+
check({ :t1w => nil }, { :t1w => 0.9 })
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
it 'should leave t1w as the default if t1w is passed in as the empty string' do
|
|
95
|
+
check({ :t1w => '' }, { :t1w => 0.9 })
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it 'should convert a float t1w to a float' do
|
|
99
|
+
check({ :t1w => '1.2' }, { :t1w => 1.2 })
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
it 'should convert an integer t1w to an integer' do
|
|
103
|
+
check({ :t1w => '34' }, { :t1w => 34 })
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
it 'should leave t1h as the default if t1h is not passed in' do
|
|
107
|
+
check({}, { :t1h => 0.25 })
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
it 'should leave t1h as the default if t1h is passed in as nil' do
|
|
111
|
+
check({ :t1h => nil }, { :t1h => 0.25 })
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
it 'should leave t1h as the default if t1h is passed in as the empty string' do
|
|
115
|
+
check({ :t1h => '' }, { :t1h => 0.25 })
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
it 'should convert a float t1h to a float' do
|
|
119
|
+
check({ :t1h => '1.2' }, { :t1h => 1.2 })
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
it 'should convert an integer t1h to an integer' do
|
|
123
|
+
check({ :t1h => '34' }, { :t1h => 34 })
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
it 'should leave t2x as the default if t2x is not passed in' do
|
|
127
|
+
check({}, { :t2x => 0.05 })
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
it 'should leave t2x as the default if t2x is passed in as nil' do
|
|
131
|
+
check({ :t2x => nil }, { :t2x => 0.05 })
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
it 'should leave t2x as the default if t2x is passed in as the empty string' do
|
|
135
|
+
check({ :t2x => '' }, { :t2x => 0.05 })
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
it 'should convert a float t2x to a float' do
|
|
139
|
+
check({ :t2x => '1.2' }, { :t2x => 1.2 })
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
it 'should convert an integer t2x to an integer' do
|
|
143
|
+
check({ :t2x => '34' }, { :t2x => 34 })
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
it 'should leave t2y as the default if t2y is not passed in' do
|
|
147
|
+
check({}, { :t2y => 0.75 })
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
it 'should leave t2y as the default if t2y is passed in as nil' do
|
|
151
|
+
check({ :t2y => nil }, { :t2y => 0.75 })
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
it 'should leave t2y as the default if t2y is passed in as the empty string' do
|
|
155
|
+
check({ :t2y => '' }, { :t2y => 0.75 })
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
it 'should convert a float t2y to a float' do
|
|
159
|
+
check({ :t2y => '1.2' }, { :t2y => 1.2 })
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
it 'should convert an integer t2y to an integer' do
|
|
163
|
+
check({ :t2y => '34' }, { :t2y => 34 })
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
it 'should leave t2w as the default if t2w is not passed in' do
|
|
167
|
+
check({}, { :t2w => 0.9 })
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
it 'should leave t2w as the default if t2w is passed in as nil' do
|
|
171
|
+
check({ :t2w => nil }, { :t2w => 0.9 })
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
it 'should leave t2w as the default if t2w is passed in as the empty string' do
|
|
175
|
+
check({ :t2w => '' }, { :t2w => 0.9 })
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
it 'should convert a float t2w to a float' do
|
|
179
|
+
check({ :t2w => '1.2' }, { :t2w => 1.2 })
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
it 'should convert an integer t2w to an integer' do
|
|
183
|
+
check({ :t2w => '34' }, { :t2w => 34 })
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
it 'should leave t2h as the default if t2h is not passed in' do
|
|
187
|
+
check({}, { :t2h => 0.25 })
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
it 'should leave t2h as the default if t2h is passed in as nil' do
|
|
191
|
+
check({ :t2h => nil }, { :t2h => 0.25 })
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
it 'should leave t2h as the default if t2h is passed in as the empty string' do
|
|
195
|
+
check({ :t2h => '' }, { :t2h => 0.25 })
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
it 'should convert a float t2h to a float' do
|
|
199
|
+
check({ :t2h => '1.2' }, { :t2h => 1.2 })
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
it 'should convert an integer t2h to an integer' do
|
|
203
|
+
check({ :t2h => '34' }, { :t2h => 34 })
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
it 'should generate the correct signature' do
|
|
207
|
+
MemeCaptain::NormParams.new(
|
|
208
|
+
:t1 => 'text 1',
|
|
209
|
+
:t1h => '1',
|
|
210
|
+
:t1w => '2',
|
|
211
|
+
:t1x => '3',
|
|
212
|
+
:t1y => '4',
|
|
213
|
+
:t2 => 'text 2',
|
|
214
|
+
:t2h => '5',
|
|
215
|
+
:t2w => '6',
|
|
216
|
+
:t2x => '7',
|
|
217
|
+
:t2y => '8',
|
|
218
|
+
:u => 'some u'
|
|
219
|
+
).signature.should ==
|
|
220
|
+
't1text 1t1h1t1w2t1x3t1y4t2text 2t2h5t2w6t2x7t2y8usome u'
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'meme_captain'
|
|
2
|
+
|
|
3
|
+
describe MemeCaptain::TextPos do
|
|
4
|
+
|
|
5
|
+
it 'should store the required fields' do
|
|
6
|
+
t = MemeCaptain::TextPos.new('text', 0, 25, 50, 100)
|
|
7
|
+
t.text.should == 'text'
|
|
8
|
+
t.x.should == 0
|
|
9
|
+
t.y.should == 25
|
|
10
|
+
t.width.should == 50
|
|
11
|
+
t.height.should == 100
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'should store the max_lines option' do
|
|
15
|
+
MemeCaptain::TextPos.new('text', 0, 25, 50, 100,
|
|
16
|
+
:max_lines => 10).max_lines.should == 10
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'should store the min_pointsize option' do
|
|
20
|
+
MemeCaptain::TextPos.new('text', 0, 25, 50, 100,
|
|
21
|
+
:min_pointsize => 11).min_pointsize.should == 11
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'should pass store additional options in draw_options' do
|
|
25
|
+
MemeCaptain::TextPos.new('text', 0, 25, 50, 100,
|
|
26
|
+
:font => 'Comic Sans').draw_options[:font].should == 'Comic Sans'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|