squib 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +162 -133
- data/Gemfile +4 -4
- data/README.md +630 -550
- data/RELEASE TODO.md +18 -18
- data/Rakefile +99 -99
- data/lib/squib.rb +32 -32
- data/lib/squib/api/background.rb +20 -19
- data/lib/squib/api/data.rb +100 -99
- data/lib/squib/api/image.rb +90 -76
- data/lib/squib/api/save.rb +149 -103
- data/lib/squib/api/settings.rb +35 -37
- data/lib/squib/api/shapes.rb +230 -228
- data/lib/squib/api/text.rb +65 -66
- data/lib/squib/api/text_embed.rb +96 -66
- data/lib/squib/args/arg_loader.rb +138 -0
- data/lib/squib/args/box.rb +55 -0
- data/lib/squib/args/card_range.rb +32 -0
- data/lib/squib/args/color_validator.rb +12 -0
- data/lib/squib/args/coords.rb +33 -0
- data/lib/squib/args/dir_validator.rb +16 -0
- data/lib/squib/args/draw.rb +92 -0
- data/lib/squib/args/embed_adjust.rb +25 -0
- data/lib/squib/args/embed_key.rb +17 -0
- data/lib/squib/args/hand_special.rb +37 -0
- data/lib/squib/args/input_file.rb +37 -0
- data/lib/squib/args/paint.rb +44 -0
- data/lib/squib/args/paragraph.rb +115 -0
- data/lib/squib/args/save_batch.rb +60 -0
- data/lib/squib/args/scale_box.rb +53 -0
- data/lib/squib/args/sheet.rb +72 -0
- data/lib/squib/args/showcase_special.rb +38 -0
- data/lib/squib/args/svg_special.rb +37 -0
- data/lib/squib/args/transform.rb +25 -0
- data/lib/squib/args/typographer.rb +117 -117
- data/lib/squib/card.rb +67 -67
- data/lib/squib/conf.rb +117 -111
- data/lib/squib/constants.rb +178 -178
- data/lib/squib/deck.rb +113 -111
- data/lib/squib/graphics/cairo_context_wrapper.rb +99 -53
- data/lib/squib/graphics/gradient_regex.rb +46 -46
- data/lib/squib/graphics/hand.rb +42 -43
- data/lib/squib/graphics/image.rb +76 -73
- data/lib/squib/graphics/save_doc.rb +103 -137
- data/lib/squib/graphics/save_images.rb +33 -33
- data/lib/squib/graphics/shapes.rb +119 -152
- data/lib/squib/graphics/showcase.rb +85 -88
- data/lib/squib/graphics/text.rb +176 -216
- data/lib/squib/layout_parser.rb +91 -89
- data/lib/squib/layouts/economy.yml +85 -0
- data/lib/squib/layouts/fantasy.yml +101 -0
- data/lib/squib/layouts/hand.yml +62 -46
- data/lib/squib/layouts/playing-card.yml +35 -18
- data/lib/squib/project_template/config.yml +45 -40
- data/lib/squib/version.rb +10 -10
- data/samples/color_shortcuts.rb +6 -0
- data/samples/csv_import.rb +18 -18
- data/samples/custom-config.yml +5 -5
- data/samples/custom_config.rb +18 -18
- data/samples/draw_shapes.rb +45 -35
- data/samples/embed_text.rb +88 -90
- data/samples/hand.rb +24 -24
- data/samples/layouts.rb +62 -61
- data/samples/layouts_builtin.rb +51 -0
- data/samples/load_images.rb +78 -64
- data/samples/ranges.rb +64 -53
- data/samples/sample.csv +2 -2
- data/samples/text_options.rb +102 -94
- data/spec/api/api_data_spec.rb +57 -50
- data/spec/api/api_settings_spec.rb +37 -17
- data/spec/args/box_spec.rb +127 -0
- data/spec/args/draw_spec.rb +95 -0
- data/spec/args/embed_key_spec.rb +13 -0
- data/spec/args/input_file_spec.rb +21 -0
- data/spec/args/paint_spec.rb +22 -0
- data/spec/args/paragraph_spec.rb +153 -0
- data/spec/args/range_spec.rb +36 -0
- data/spec/args/save_batch_spec.rb +51 -0
- data/spec/args/scale_box_spec.rb +71 -0
- data/spec/args/sheet_spec.rb +58 -0
- data/spec/args/showcase_special_spec.rb +15 -0
- data/spec/data/samples/autoscale_font.rb.txt +84 -87
- data/spec/data/samples/basic.rb.txt +209 -203
- data/spec/data/samples/cairo_access.rb.txt +2 -2
- data/spec/data/samples/config_text_markup.rb.txt +72 -75
- data/spec/data/samples/csv_import.rb.txt +76 -80
- data/spec/data/samples/custom_config.rb.txt +48 -49
- data/spec/data/samples/draw_shapes.rb.txt +100 -42
- data/spec/data/samples/embed_text.rb.txt +283 -295
- data/spec/data/samples/excel.rb.txt +162 -171
- data/spec/data/samples/gradients.rb.txt +79 -67
- data/spec/data/samples/hand.rb.txt +538 -514
- data/spec/data/samples/hello_world.rb.txt +36 -38
- data/spec/data/samples/load_images.rb.txt +41 -5
- data/spec/data/samples/portrait-landscape.rb.txt +49 -51
- data/spec/data/samples/ranges.rb.txt +460 -429
- data/spec/data/samples/saves.rb.txt +801 -785
- data/spec/data/samples/showcase.rb.txt +5910 -5906
- data/spec/data/samples/text_options.rb.txt +1125 -981
- data/spec/data/samples/tgc_proofs.rb.txt +81 -79
- data/spec/data/samples/units.rb.txt +18 -12
- data/spec/data/xlsx/with_macros.xlsm +0 -0
- data/spec/graphics/cairo_context_wrapper_spec.rb +84 -75
- data/spec/graphics/graphics_images_spec.rb +94 -85
- data/spec/graphics/graphics_save_doc_spec.rb +67 -65
- data/spec/samples/expected/hand.png +0 -0
- data/spec/samples/expected/hand_pretty.png +0 -0
- data/spec/samples/expected/layout_00.png +0 -0
- data/spec/samples/expected/load_images_00.png +0 -0
- data/spec/samples/expected/ranges_00.png +0 -0
- data/spec/samples/expected/shape_00.png +0 -0
- data/spec/samples/expected/showcase.png +0 -0
- data/spec/samples/expected/showcase2.png +0 -0
- data/spec/samples/expected/showcase_individual_00.png +0 -0
- data/spec/samples/expected/showcase_individual_01.png +0 -0
- data/spec/samples/expected/showcase_individual_02.png +0 -0
- data/spec/samples/expected/showcase_individual_03.png +0 -0
- data/spec/samples/expected/text_00.png +0 -0
- data/spec/samples/expected/text_01.png +0 -0
- data/spec/samples/expected/text_02.png +0 -0
- data/spec/samples/samples_regression_spec.rb +82 -82
- data/spec/spec_helper.rb +3 -2
- data/squib.gemspec +48 -48
- data/squib.sublime-project +42 -36
- metadata +61 -33
- data/lib/squib/input_helpers.rb +0 -238
- data/spec/api/api_image_spec.rb +0 -38
- data/spec/api/api_text_spec.rb +0 -37
- data/spec/graphics/graphics_shapes_spec.rb +0 -85
- data/spec/graphics/graphics_text_spec.rb +0 -164
- data/spec/input_helpers_spec.rb +0 -238
- data/spec/samples/expected/embed_multi_00.png +0 -0
- data/spec/samples/expected/embed_multi_01.png +0 -0
- data/spec/samples/expected/embed_multi_02.png +0 -0
- data/spec/samples/expected/ranges_01.png +0 -0
- data/spec/samples/expected/ranges_02.png +0 -0
@@ -0,0 +1,153 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'squib/args/paragraph'
|
3
|
+
require 'squib/constants'
|
4
|
+
|
5
|
+
describe Squib::Args::Paragraph do
|
6
|
+
subject(:para) { Squib::Args::Paragraph.new('FooFont 32') }
|
7
|
+
|
8
|
+
context 'str validator' do
|
9
|
+
it 'converts everything to string' do
|
10
|
+
para.load!( {str: 5} )
|
11
|
+
expect(para.str).to eq ['5']
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'font validator' do
|
16
|
+
it 'uses deck font by default' do
|
17
|
+
para.load!( {} )
|
18
|
+
expect(para.font).to eq ['FooFont 32']
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'uses system default font when deck font is :default' do
|
22
|
+
para = Squib::Args::Paragraph.new(:default)
|
23
|
+
para.load!( {} )
|
24
|
+
expect(para.font).to eq [Squib::SYSTEM_DEFAULTS[:default_font]]
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'uses specified font when given' do
|
28
|
+
para.load!( {font: 'MyFont 8'})
|
29
|
+
expect(para.font).to eq ['MyFont 8']
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'align validator' do
|
34
|
+
it 'converts to pango left' do
|
35
|
+
para.load!( { align: :left } )
|
36
|
+
expect(para.align).to eq [Pango::ALIGN_LEFT]
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'converts to pango right' do
|
40
|
+
para.load!( { align: :RIGHT } )
|
41
|
+
expect(para.align).to eq [Pango::ALIGN_RIGHT]
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'converts to pango center' do
|
45
|
+
para.load!( { align: 'center' } )
|
46
|
+
expect(para.align).to eq [Pango::ALIGN_CENTER]
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'raises an exception on anything else' do
|
50
|
+
expect { para.load!( { align: 'foo' } ) }.to raise_error(ArgumentError, 'align must be one of: center, left, right')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'wrap validator' do
|
55
|
+
it 'converts to pango wrap word' do
|
56
|
+
para.load!( { wrap: 'word'} )
|
57
|
+
expect(para.wrap).to eq [Pango::WRAP_WORD]
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'converts to pango wrap char' do
|
61
|
+
para.load!( { wrap: 'WORD_ChAr'} )
|
62
|
+
expect(para.wrap).to eq [Pango::WRAP_WORD_CHAR]
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'converts to pango wrap char on true' do
|
66
|
+
para.load!( { wrap: true} )
|
67
|
+
expect(para.wrap).to eq [Pango::WRAP_WORD_CHAR]
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'converts to pango wrap char with false' do
|
71
|
+
para.load!( { wrap: false} )
|
72
|
+
expect(para.wrap).to eq [Pango::WRAP_CHAR]
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'raises an exception on anything else' do
|
76
|
+
expect { para.load!( {wrap: 'foo' }) }.to raise_error(ArgumentError, 'wrap must be one of: word, char, word_char, true, or false')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
context 'ellipsize validator' do
|
81
|
+
it 'converts to pango on none and false' do
|
82
|
+
para.load!( { ellipsize: 'none'} )
|
83
|
+
expect(para.ellipsize).to eq [Pango::Layout::ELLIPSIZE_NONE]
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'converts to pango with start' do
|
87
|
+
para.load!( { ellipsize: :StArt} )
|
88
|
+
expect(para.ellipsize).to eq [Pango::Layout::ELLIPSIZE_START]
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'converts to pango middle' do
|
92
|
+
para.load!( { ellipsize: 'middle'} )
|
93
|
+
expect(para.ellipsize).to eq [Pango::Layout::ELLIPSIZE_MIDDLE]
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'converts to pango end' do
|
97
|
+
para.load!( { ellipsize: 'END'} )
|
98
|
+
expect(para.ellipsize).to eq [Pango::Layout::ELLIPSIZE_END]
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'raises an exception on anything else' do
|
102
|
+
expect { para.load!( {ellipsize: 'foo' }) }.to raise_error(ArgumentError, 'ellipsize must be one of: none, start, middle, end, true, or false')
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
context 'justify validator' do
|
107
|
+
it 'allows nil' do
|
108
|
+
para.load!( { justify: nil} )
|
109
|
+
expect(para.justify).to eq [nil]
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'can be true' do
|
113
|
+
para.load!( { justify: true} )
|
114
|
+
expect(para.justify).to eq [true]
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'can be false' do
|
118
|
+
para.load!( { justify: false} )
|
119
|
+
expect(para.justify).to eq [false]
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'raises an exception on anything else' do
|
123
|
+
expect { para.load!( {justify: 'false' }) }.to raise_error(ArgumentError, 'justify must be one of: nil, true, or false')
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
context 'spacing validator' do
|
128
|
+
it 'allows nil' do
|
129
|
+
para.load!( { spacing: nil} )
|
130
|
+
expect(para.spacing).to eq [nil]
|
131
|
+
end
|
132
|
+
it 'is converted to Pango space' do
|
133
|
+
para.load!( { spacing: 519} )
|
134
|
+
expect(para.spacing).to eq [Pango::SCALE * 519.0]
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'raises an exception if not a float' do
|
138
|
+
expect { para.load!( {spacing: /foo/ }) }.to raise_error(ArgumentError, 'spacing must be a number or nil')
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
context 'valign validator' do
|
143
|
+
it 'converts top' do
|
144
|
+
para.load!( { valign: :top} )
|
145
|
+
expect(para.valign).to eq ['top']
|
146
|
+
end
|
147
|
+
|
148
|
+
it 'raises an exception if not one of the three' do
|
149
|
+
expect { para.load!( {valign: 'foo' }) }.to raise_error(ArgumentError, 'valign must be one of: top, middle, bottom')
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'squib/args/card_range'
|
3
|
+
|
4
|
+
describe Squib::Args::CardRange do
|
5
|
+
|
6
|
+
it 'must be within the card size range' do
|
7
|
+
expect {Squib::Args::CardRange.new(2..3, deck_size: 2)}
|
8
|
+
.to raise_error(ArgumentError, '2..3 is outside of deck range of 0..1')
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'defaults to range of all cards if :all' do
|
12
|
+
range = Squib::Args::CardRange.new(:all, deck_size: 5)
|
13
|
+
expect(range.to_a).to eq([0, 1, 2, 3, 4])
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'creates a range of cards for singleton' do
|
17
|
+
range = Squib::Args::CardRange.new(3, deck_size: 5)
|
18
|
+
expect(range.to_a).to eq([3])
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'lets arrays pass through unchanged' do
|
22
|
+
range = Squib::Args::CardRange.new([0, 2], deck_size: 5)
|
23
|
+
expect(range.to_a).to eq([0, 2])
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'raises an error on everything else' do
|
27
|
+
expect { Squib::Args::CardRange.new(:foo, deck_size: 5) }
|
28
|
+
.to raise_error(ArgumentError, 'foo must be Enumerable (i.e. respond_to :each).')
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'allows anything with :to_i' do
|
32
|
+
range = Squib::Args::CardRange.new(0.9, deck_size: 5)
|
33
|
+
expect(range.to_a).to eq([0])
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'squib/args/save_batch'
|
3
|
+
|
4
|
+
describe Squib::Args::SaveBatch do
|
5
|
+
subject(:save_batch) {Squib::Args::SaveBatch.new}
|
6
|
+
|
7
|
+
context 'dir' do
|
8
|
+
it 'is created if not exists (and warns)' do
|
9
|
+
opts = {dir: 'tocreate'}
|
10
|
+
Dir.chdir(output_dir) do
|
11
|
+
FileUtils.rm_rf('tocreate', secure: true)
|
12
|
+
expect(Squib.logger).to receive(:warn).with("Dir 'tocreate' does not exist, creating it.").once
|
13
|
+
save_batch.load! opts
|
14
|
+
expect(save_batch).to have_attributes({dir: ['tocreate']})
|
15
|
+
expect(Dir.exists? 'tocreate').to be true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'rotate' do
|
21
|
+
it 'does nothing by default' do
|
22
|
+
opts = {}
|
23
|
+
save_batch.load! opts
|
24
|
+
expect(save_batch[0]).to have_attributes({rotate: false, angle: 0})
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'rotates by pi/2 with true' do
|
28
|
+
opts = {rotate: true}
|
29
|
+
save_batch.load! opts
|
30
|
+
expect(save_batch[0]).to have_attributes({rotate: true, angle: Math::PI / 2})
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'rotates by pi/2' do
|
34
|
+
opts = {rotate: :clockwise}
|
35
|
+
save_batch.load! opts
|
36
|
+
expect(save_batch[0]).to have_attributes({rotate: true, angle: Math::PI / 2})
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'rotates by pi/2 with counterclockwise' do
|
40
|
+
opts = {rotate: :counterclockwise}
|
41
|
+
save_batch.load! opts
|
42
|
+
expect(save_batch[0]).to have_attributes({rotate: true, angle: 3 * Math::PI / 2})
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'raises error on a number' do
|
46
|
+
opts = {rotate: 5.0}
|
47
|
+
expect { save_batch.load!(opts) }.to raise_error('invalid option to rotate: only [true, false, :clockwise, :counterclockwise]')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'squib/args/scale_box'
|
3
|
+
|
4
|
+
describe Squib::Args::ScaleBox do
|
5
|
+
subject(:box) { Squib::Args::ScaleBox.new({}) }
|
6
|
+
|
7
|
+
context 'unit conversion' do
|
8
|
+
it 'converts units on all args' do
|
9
|
+
args = {x: ['1in', '2in'], y: 300, width: '1in', height: '1in'}
|
10
|
+
box.load!(args, expand_by: 2)
|
11
|
+
expect(box).to have_attributes(
|
12
|
+
x: [300, 600],
|
13
|
+
y: [300, 300],
|
14
|
+
width: [300, 300],
|
15
|
+
height: [300, 300],
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'validation' do
|
21
|
+
it 'replaces with deck width and height' do
|
22
|
+
args = {width: :deck, height: :deck}
|
23
|
+
deck = OpenStruct.new(width: 123, height: 456)
|
24
|
+
box = Squib::Args::Box.new(deck)
|
25
|
+
box.load!(args, expand_by: 1)
|
26
|
+
expect(box).to have_attributes(width: [123], height: [456])
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'allows :native' do
|
30
|
+
args = {width: :native, height: :native}
|
31
|
+
box.load!(args, expand_by: 1)
|
32
|
+
expect(box).to have_attributes(width: [:native], height: [:native])
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'allows native to be a string' do
|
36
|
+
args = {width: 'native'}
|
37
|
+
box.load!(args, expand_by: 1)
|
38
|
+
expect(box).to have_attributes(width: [:native], height: [:native])
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'allows :scale on width if height has to_f' do
|
42
|
+
args = {width: :scale, height: 75}
|
43
|
+
box.load!(args, expand_by: 1)
|
44
|
+
expect(box).to have_attributes(width: [:scale], height: [75])
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'allows :scale on width if height has to_f' do
|
48
|
+
args = {width: 75, height: :scale}
|
49
|
+
box.load!(args, expand_by: 1)
|
50
|
+
expect(box).to have_attributes(width: [75], height: [:scale])
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'disallows both :scale' do
|
54
|
+
args = {width: :scale, height: :scale}
|
55
|
+
expect { box.load!(args, expand_by: 1) }.to raise_error('if width is :scale, height must be a number')
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'disallows non-to_f on width' do
|
59
|
+
args = {width: :foo}
|
60
|
+
expect { box.load!(args, expand_by: 1) }.to raise_error('width must be a number, :scale, :native, or :deck')
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'disallows non-to_f on height' do
|
64
|
+
args = {height: :foo}
|
65
|
+
expect { box.load!(args, expand_by: 1) }.to raise_error('height must be a number, :scale, :native, or :deck')
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'squib/args/sheet'
|
3
|
+
|
4
|
+
describe Squib::Args::Sheet do
|
5
|
+
|
6
|
+
context 'dsl overrides' do
|
7
|
+
subject(:sheet) { Squib::Args::Sheet.new({}, {file: 'foo'}) }
|
8
|
+
|
9
|
+
it 'works when specified' do
|
10
|
+
sheet.load!({}) # go right to defaults
|
11
|
+
expect(sheet.file).to eq( 'foo' ) # dsl method default override
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'rows and colums' do
|
17
|
+
subject(:sheet) { Squib::Args::Sheet.new({}, {}, 4) }
|
18
|
+
|
19
|
+
it 'does nothing on a perfect fit' do
|
20
|
+
opts = { columns: 2, rows: 2 }
|
21
|
+
sheet.load! opts
|
22
|
+
expect(sheet).to have_attributes(columns: 2, rows: 2)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'keeps both if specified' do
|
26
|
+
opts = { columns: 1, rows: 1 }
|
27
|
+
sheet.load! opts
|
28
|
+
expect(sheet).to have_attributes(columns: 1, rows: 1)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'computes properly on non-integer' do
|
32
|
+
opts = {columns: 1, rows: :infinite}
|
33
|
+
sheet.load! opts
|
34
|
+
expect(sheet).to have_attributes( columns: 1, rows: 4 )
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'computes properly on unspecified rows' do
|
38
|
+
opts = {columns: 1}
|
39
|
+
sheet.load! opts
|
40
|
+
expect(sheet).to have_attributes( columns: 1, rows: 4 )
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'computes properly on unspecified, too-big column' do
|
44
|
+
opts = {}
|
45
|
+
sheet.load! opts
|
46
|
+
expect(sheet).to have_attributes( columns: 5, rows: 1 )
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'fails on a non-integer column' do
|
50
|
+
opts = {columns: :infinite}
|
51
|
+
expect { sheet.load!(opts) }.to raise_error('columns must be an integer')
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'squib/args/showcase_special'
|
3
|
+
|
4
|
+
describe Squib::Args::ShowcaseSpecial do
|
5
|
+
subject(:showcase_special) { Squib::Args::ShowcaseSpecial.new }
|
6
|
+
|
7
|
+
context '#face_right?' do
|
8
|
+
it 'compares face to right' do
|
9
|
+
opts = { face: 'LEFT ' }
|
10
|
+
showcase_special.load! opts
|
11
|
+
expect(showcase_special.face_right?).to be false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -1,87 +1,84 @@
|
|
1
|
-
cairo: antialias=(["subpixel"])
|
2
|
-
cairo: antialias=(["subpixel"])
|
3
|
-
cairo: antialias=(["subpixel"])
|
4
|
-
cairo: save([])
|
5
|
-
cairo: set_source_color([
|
6
|
-
cairo: paint([])
|
7
|
-
cairo: restore([])
|
8
|
-
cairo: save([])
|
9
|
-
cairo: set_source_color([
|
10
|
-
cairo: paint([])
|
11
|
-
cairo: restore([])
|
12
|
-
cairo: save([])
|
13
|
-
cairo: set_source_color([
|
14
|
-
cairo: paint([])
|
15
|
-
cairo: restore([])
|
16
|
-
cairo: save([])
|
17
|
-
cairo: set_source_color([
|
18
|
-
cairo: translate([65, 400])
|
19
|
-
cairo: rotate([0])
|
20
|
-
cairo: move_to([0, 0])
|
21
|
-
pango font: size=([128000])
|
22
|
-
pango: font_description=([MockDouble])
|
23
|
-
pango: text=(["ShortBig"])
|
24
|
-
pango: width=([716800])
|
25
|
-
pango: wrap=([#<Pango::Layout::WrapMode word-char>])
|
26
|
-
pango: ellipsize=([#<Pango::Layout::EllipsizeMode end>])
|
27
|
-
pango: alignment=([#<Pango::Layout::Alignment center>])
|
28
|
-
pango: justify=([false])
|
29
|
-
|
30
|
-
cairo:
|
31
|
-
cairo:
|
32
|
-
cairo:
|
33
|
-
cairo:
|
34
|
-
cairo:
|
35
|
-
cairo:
|
36
|
-
|
37
|
-
cairo:
|
38
|
-
cairo:
|
39
|
-
cairo:
|
40
|
-
cairo:
|
41
|
-
cairo:
|
42
|
-
cairo:
|
43
|
-
|
44
|
-
pango
|
45
|
-
pango:
|
46
|
-
pango:
|
47
|
-
pango:
|
48
|
-
pango:
|
49
|
-
pango:
|
50
|
-
pango:
|
51
|
-
|
52
|
-
|
53
|
-
cairo:
|
54
|
-
cairo:
|
55
|
-
cairo:
|
56
|
-
cairo:
|
57
|
-
cairo:
|
58
|
-
|
59
|
-
cairo:
|
60
|
-
cairo:
|
61
|
-
cairo:
|
62
|
-
cairo:
|
63
|
-
cairo:
|
64
|
-
cairo:
|
65
|
-
|
66
|
-
|
67
|
-
pango
|
68
|
-
pango:
|
69
|
-
pango:
|
70
|
-
pango:
|
71
|
-
pango:
|
72
|
-
pango:
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
cairo:
|
77
|
-
cairo:
|
78
|
-
cairo:
|
79
|
-
cairo:
|
80
|
-
|
81
|
-
cairo:
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
surface: write_to_png(["_output/autoscale_00.png"])
|
86
|
-
surface: write_to_png(["_output/autoscale_01.png"])
|
87
|
-
surface: write_to_png(["_output/autoscale_02.png"])
|
1
|
+
cairo: antialias=(["subpixel"])
|
2
|
+
cairo: antialias=(["subpixel"])
|
3
|
+
cairo: antialias=(["subpixel"])
|
4
|
+
cairo: save([])
|
5
|
+
cairo: set_source_color(["white"])
|
6
|
+
cairo: paint([])
|
7
|
+
cairo: restore([])
|
8
|
+
cairo: save([])
|
9
|
+
cairo: set_source_color(["white"])
|
10
|
+
cairo: paint([])
|
11
|
+
cairo: restore([])
|
12
|
+
cairo: save([])
|
13
|
+
cairo: set_source_color(["white"])
|
14
|
+
cairo: paint([])
|
15
|
+
cairo: restore([])
|
16
|
+
cairo: save([])
|
17
|
+
cairo: set_source_color(["black"])
|
18
|
+
cairo: translate([65, 400])
|
19
|
+
cairo: rotate([0])
|
20
|
+
cairo: move_to([0, 0])
|
21
|
+
pango font: size=([128000])
|
22
|
+
pango: font_description=([MockDouble])
|
23
|
+
pango: text=(["ShortBig"])
|
24
|
+
pango: width=([716800])
|
25
|
+
pango: wrap=([#<Pango::Layout::WrapMode word-char>])
|
26
|
+
pango: ellipsize=([#<Pango::Layout::EllipsizeMode end>])
|
27
|
+
pango: alignment=([#<Pango::Layout::Alignment center>])
|
28
|
+
pango: justify=([false])
|
29
|
+
cairo: move_to([0, 0])
|
30
|
+
cairo: move_to([0, 0])
|
31
|
+
cairo: show_pango_layout([MockDouble])
|
32
|
+
cairo: rounded_rectangle([0, 0, 0, 0, 0, 0])
|
33
|
+
cairo: set_source_color([:red])
|
34
|
+
cairo: set_line_width([2.0])
|
35
|
+
cairo: stroke([])
|
36
|
+
pango: ellipsized?([])
|
37
|
+
cairo: restore([])
|
38
|
+
cairo: save([])
|
39
|
+
cairo: set_source_color(["black"])
|
40
|
+
cairo: translate([65, 400])
|
41
|
+
cairo: rotate([0])
|
42
|
+
cairo: move_to([0, 0])
|
43
|
+
pango font: size=([46080])
|
44
|
+
pango: font_description=([MockDouble])
|
45
|
+
pango: text=(["Medium_Length_Name"])
|
46
|
+
pango: width=([716800])
|
47
|
+
pango: wrap=([#<Pango::Layout::WrapMode word-char>])
|
48
|
+
pango: ellipsize=([#<Pango::Layout::EllipsizeMode end>])
|
49
|
+
pango: alignment=([#<Pango::Layout::Alignment center>])
|
50
|
+
pango: justify=([false])
|
51
|
+
cairo: move_to([0, 0])
|
52
|
+
cairo: move_to([0, 0])
|
53
|
+
cairo: show_pango_layout([MockDouble])
|
54
|
+
cairo: rounded_rectangle([0, 0, 0, 0, 0, 0])
|
55
|
+
cairo: set_source_color([:red])
|
56
|
+
cairo: set_line_width([2.0])
|
57
|
+
cairo: stroke([])
|
58
|
+
pango: ellipsized?([])
|
59
|
+
cairo: restore([])
|
60
|
+
cairo: save([])
|
61
|
+
cairo: set_source_color(["black"])
|
62
|
+
cairo: translate([65, 400])
|
63
|
+
cairo: rotate([0])
|
64
|
+
cairo: move_to([0, 0])
|
65
|
+
pango font: size=([36864])
|
66
|
+
pango: font_description=([MockDouble])
|
67
|
+
pango: text=(["Super_Duper_Long_Name"])
|
68
|
+
pango: width=([716800])
|
69
|
+
pango: wrap=([#<Pango::Layout::WrapMode word-char>])
|
70
|
+
pango: ellipsize=([#<Pango::Layout::EllipsizeMode end>])
|
71
|
+
pango: alignment=([#<Pango::Layout::Alignment center>])
|
72
|
+
pango: justify=([false])
|
73
|
+
cairo: move_to([0, 0])
|
74
|
+
cairo: move_to([0, 0])
|
75
|
+
cairo: show_pango_layout([MockDouble])
|
76
|
+
cairo: rounded_rectangle([0, 0, 0, 0, 0, 0])
|
77
|
+
cairo: set_source_color([:red])
|
78
|
+
cairo: set_line_width([2.0])
|
79
|
+
cairo: stroke([])
|
80
|
+
pango: ellipsized?([])
|
81
|
+
cairo: restore([])
|
82
|
+
surface: write_to_png(["_output/autoscale_00.png"])
|
83
|
+
surface: write_to_png(["_output/autoscale_01.png"])
|
84
|
+
surface: write_to_png(["_output/autoscale_02.png"])
|