skeptick 0.1.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/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +584 -0
- data/Rakefile +10 -0
- data/foo.rb +1 -0
- data/lib/skeptick.rb +2 -0
- data/lib/skeptick/chain.rb +55 -0
- data/lib/skeptick/chain/dsl_context.rb +21 -0
- data/lib/skeptick/command.rb +46 -0
- data/lib/skeptick/convert.rb +109 -0
- data/lib/skeptick/convert/dsl_context.rb +27 -0
- data/lib/skeptick/core.rb +46 -0
- data/lib/skeptick/error.rb +4 -0
- data/lib/skeptick/helper.rb +26 -0
- data/lib/skeptick/image.rb +69 -0
- data/lib/skeptick/image/dsl_context.rb +29 -0
- data/lib/skeptick/railtie.rb +8 -0
- data/lib/skeptick/sugar.rb +8 -0
- data/lib/skeptick/sugar/composition.rb +55 -0
- data/lib/skeptick/sugar/debugging.rb +12 -0
- data/lib/skeptick/sugar/drawing.rb +32 -0
- data/lib/skeptick/sugar/edges.rb +70 -0
- data/lib/skeptick/sugar/formatting.rb +12 -0
- data/lib/skeptick/sugar/geometry.rb +38 -0
- data/lib/skeptick/sugar/resizing.rb +16 -0
- data/lib/skeptick/sugar/sequence_manipulation.rb +43 -0
- data/lib/skeptick/version.rb +3 -0
- data/logo.png +0 -0
- data/logo.rb +45 -0
- data/refresh_preview.scpt +2 -0
- data/skeptick.gemspec +21 -0
- data/test/chain_test.rb +94 -0
- data/test/convert_test.rb +177 -0
- data/test/image_test.rb +145 -0
- data/test/sugar/composition_test.rb +273 -0
- data/test/sugar/debugging_test.rb +24 -0
- data/test/sugar/drawing_test.rb +86 -0
- data/test/sugar/edges_test.rb +99 -0
- data/test/sugar/formatting_test.rb +19 -0
- data/test/sugar/geometry_test.rb +92 -0
- data/test/sugar/resizing_test.rb +25 -0
- data/test/sugar/sequence_manipulation_test.rb +98 -0
- data/test/test_helper.rb +11 -0
- metadata +117 -0
@@ -0,0 +1,177 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
# DISCLAIMER
|
4
|
+
# These tests are not examples of proper usage of ImageMagick.
|
5
|
+
# In fact, most of them are entirely invalid. The point is to
|
6
|
+
# test the logic of building strings.
|
7
|
+
class ConvertTest < Skeptick::TestCase
|
8
|
+
include Skeptick
|
9
|
+
|
10
|
+
def test_dsl_method_available
|
11
|
+
assert_respond_to self, :convert
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_lvars_from_external_context_are_accessible
|
15
|
+
foo = '-test'
|
16
|
+
cmd = convert { set foo }
|
17
|
+
assert_equal 'convert -test miff:-', cmd.to_s
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_methods_from_external_context_are_accessible
|
21
|
+
context = Class.new do
|
22
|
+
include Skeptick
|
23
|
+
def foo; :foo end
|
24
|
+
def cmd; convert { set foo } end
|
25
|
+
end
|
26
|
+
|
27
|
+
assert_equal 'convert -foo miff:-', context.new.cmd.to_s
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_minimal_convert
|
31
|
+
cmd = convert
|
32
|
+
assert_equal 'convert miff:-', cmd.to_s
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_convert_with_input
|
36
|
+
cmd = convert('foo')
|
37
|
+
assert_equal 'convert foo miff:-', cmd.to_s
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_convert_with_2_inputs
|
41
|
+
cmd = convert('foo', 'bar')
|
42
|
+
assert_equal 'convert foo bar miff:-', cmd.to_s
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_convert_with_output
|
46
|
+
cmd = convert(to: 'foo')
|
47
|
+
assert_equal 'convert foo', cmd.to_s
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_convert_with_input_and_output
|
51
|
+
cmd = convert('foo', to: 'bar')
|
52
|
+
assert_equal 'convert foo bar', cmd.to_s
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_convert_with_2_inputs_and_output
|
56
|
+
cmd = convert('foo', 'bar', to: 'baz')
|
57
|
+
assert_equal 'convert foo bar baz', cmd.to_s
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_convert_with_input_in_block
|
61
|
+
cmd = convert { image 'foo' }
|
62
|
+
assert_equal 'convert foo miff:-', cmd.to_s
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_convert_with_input_in_block_and_output
|
66
|
+
cmd = convert(to: 'bar') { image 'foo' }
|
67
|
+
assert_equal 'convert foo bar', cmd.to_s
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_convert_with_2_input_styles
|
71
|
+
cmd = convert('foo') { image 'bar' }
|
72
|
+
assert_equal 'convert foo bar miff:-', cmd.to_s
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_convert_with_2_input_styles_and_output
|
76
|
+
cmd = convert('foo', to: 'baz') { image 'bar' }
|
77
|
+
assert_equal 'convert foo bar baz', cmd.to_s
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_convert_with_ops
|
81
|
+
cmd = convert { with '-foo' }
|
82
|
+
assert_equal 'convert -foo miff:-', cmd.to_s
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_convert_with_concatenated_ops
|
86
|
+
cmd = convert { with '-foo', 'bar' }
|
87
|
+
assert_equal 'convert -foo bar miff:-', cmd.to_s
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_convert_with_multiple_ops
|
91
|
+
cmd = convert { with '-foo'; with '+bar' }
|
92
|
+
assert_equal 'convert -foo +bar miff:-', cmd.to_s
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_convert_with_multiple_concatenated_ops
|
96
|
+
cmd = convert { with '-foo', 'bar'; with '+baz', 'qux' }
|
97
|
+
assert_equal 'convert -foo bar +baz qux miff:-', cmd.to_s
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_convert_with_ops_inputs_and_output
|
101
|
+
cmd = convert('foo', 'bar', to: 'baz') do
|
102
|
+
image 'qux'
|
103
|
+
with '+quux'
|
104
|
+
with '-corge', 'grault'
|
105
|
+
end
|
106
|
+
|
107
|
+
assert_equal 'convert foo bar qux +quux -corge grault baz', cmd.to_s
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_nested_convert
|
111
|
+
cmd = convert(to: 'baz') do
|
112
|
+
convert('foo') { with 'bar' }
|
113
|
+
end
|
114
|
+
|
115
|
+
assert_equal 'convert ( foo bar ) baz', cmd.to_s
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_nested_convert_ignores_output
|
119
|
+
cmd = convert(to: 'baz') do
|
120
|
+
convert('foo', to: 'nowhere') { with 'bar' }
|
121
|
+
end
|
122
|
+
|
123
|
+
assert_equal 'convert ( foo bar ) baz', cmd.to_s
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_multi_image_nested_convert
|
127
|
+
cmd = convert('foo', to: 'bar') do
|
128
|
+
convert('qux') do
|
129
|
+
with '+asdf'
|
130
|
+
with '+fdsa'
|
131
|
+
end
|
132
|
+
|
133
|
+
image 'bleh'
|
134
|
+
with '-resize'
|
135
|
+
end
|
136
|
+
|
137
|
+
assert_equal 'convert foo ( qux +asdf +fdsa ) bleh -resize bar', cmd.to_s
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_convert_composition
|
141
|
+
complex_image = convert('qux') do
|
142
|
+
with '+asdf'
|
143
|
+
with '+fdsa'
|
144
|
+
end
|
145
|
+
|
146
|
+
cmd = convert('foo', to: 'bar') do
|
147
|
+
image complex_image
|
148
|
+
image 'bleh'
|
149
|
+
with '-resize'
|
150
|
+
end
|
151
|
+
|
152
|
+
assert_equal 'convert foo ( qux +asdf +fdsa ) bleh -resize bar', cmd.to_s
|
153
|
+
end
|
154
|
+
|
155
|
+
def test_convert_double_nesting_with_composition
|
156
|
+
complex_image = convert('foo', to: 'nowhere') do
|
157
|
+
convert('bar', to: 'nowhere') do
|
158
|
+
convert('baz') do
|
159
|
+
image 'image1'
|
160
|
+
with '-option', 'qux'
|
161
|
+
end
|
162
|
+
|
163
|
+
image 'image2'
|
164
|
+
with '+option'
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
cmd = convert('image3') do
|
169
|
+
image complex_image
|
170
|
+
image 'image4'
|
171
|
+
with '-option', 'quux'
|
172
|
+
end
|
173
|
+
|
174
|
+
assert_equal 'convert image3 ( foo ( bar ( baz image1 -option qux ) ' +
|
175
|
+
'image2 +option ) ) image4 -option quux miff:-', cmd.to_s
|
176
|
+
end
|
177
|
+
end
|
data/test/image_test.rb
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
class ImageTest < Skeptick::TestCase
|
4
|
+
include Skeptick
|
5
|
+
|
6
|
+
def test_dsl_method_available
|
7
|
+
assert_respond_to self, :image
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_set_prepends_to_image_segment
|
11
|
+
cmd = convert do
|
12
|
+
image do
|
13
|
+
image 'bar'
|
14
|
+
set '-foo'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
assert_equal 'convert -foo bar miff:-', cmd.to_s
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_apply_appends_to_image_segment
|
22
|
+
cmd = convert do
|
23
|
+
image do
|
24
|
+
apply '-foo'
|
25
|
+
image 'bar'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
assert_equal 'convert bar -foo miff:-', cmd.to_s
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_lvars_from_external_context_are_accessible
|
33
|
+
foo = '-test'
|
34
|
+
|
35
|
+
cmd = convert do
|
36
|
+
image do
|
37
|
+
apply foo
|
38
|
+
image 'bar'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
assert_equal 'convert bar -test miff:-', cmd.to_s
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_methods_from_external_context_are_accessible
|
46
|
+
context = Class.new do
|
47
|
+
include Skeptick
|
48
|
+
def foo; :foo end
|
49
|
+
def cmd
|
50
|
+
convert do
|
51
|
+
image do
|
52
|
+
apply foo
|
53
|
+
image 'bar'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
assert_equal 'convert bar -foo miff:-', context.new.cmd.to_s
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_inject_image_into_convert
|
63
|
+
sample = image do
|
64
|
+
set :size, '400x400'
|
65
|
+
image 'tile:granite:'
|
66
|
+
apply '-brightness-contrast', '38x-33'
|
67
|
+
apply :blur, '0x0.5'
|
68
|
+
end
|
69
|
+
|
70
|
+
cmd = convert do
|
71
|
+
set '-foo'
|
72
|
+
image sample
|
73
|
+
set '-bar'
|
74
|
+
end
|
75
|
+
|
76
|
+
assert_equal 'convert -foo -size 400x400 tile:granite: ' +
|
77
|
+
'-brightness-contrast 38x-33 -blur 0x0.5 -bar miff:-', cmd.to_s
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_inject_image_into_convert_as_argument
|
81
|
+
sample = image do
|
82
|
+
set :size, '400x400'
|
83
|
+
image 'tile:granite:'
|
84
|
+
apply '-brightness-contrast', '38x-33'
|
85
|
+
apply :blur, '0x0.5'
|
86
|
+
end
|
87
|
+
|
88
|
+
cmd = convert(sample)
|
89
|
+
assert_equal 'convert -size 400x400 tile:granite: -brightness-contrast ' +
|
90
|
+
'38x-33 -blur 0x0.5 miff:-', cmd.to_s
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_declare_image_inside_convert
|
94
|
+
cmd = convert do
|
95
|
+
set '-foo'
|
96
|
+
image do
|
97
|
+
set :size, '400x400'
|
98
|
+
image 'tile:granite:'
|
99
|
+
apply '-brightness-contrast', '38x-33'
|
100
|
+
apply :blur, '0x0.5'
|
101
|
+
end
|
102
|
+
set '-bar'
|
103
|
+
end
|
104
|
+
|
105
|
+
assert_equal 'convert -foo -size 400x400 tile:granite: ' +
|
106
|
+
'-brightness-contrast 38x-33 -blur 0x0.5 -bar miff:-', cmd.to_s
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_nested_image
|
110
|
+
sample = image do
|
111
|
+
set :foo
|
112
|
+
image 'bar'
|
113
|
+
apply :baz
|
114
|
+
end
|
115
|
+
|
116
|
+
cmd = convert do
|
117
|
+
image do
|
118
|
+
set :size, '400x400'
|
119
|
+
image sample
|
120
|
+
apply '-brightness-contrast', '38x-33'
|
121
|
+
apply :blur, '0x0.5'
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
assert_equal 'convert -size 400x400 -foo bar -baz -brightness-contrast ' +
|
126
|
+
'38x-33 -blur 0x0.5 miff:-', cmd.to_s
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_convert_as_image_object
|
130
|
+
sample = convert('foo', to: 'bar') do
|
131
|
+
set :baz
|
132
|
+
end
|
133
|
+
|
134
|
+
cmd = convert do
|
135
|
+
image do
|
136
|
+
set '-setting'
|
137
|
+
image sample
|
138
|
+
apply '-operation'
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
assert_equal 'convert -setting ( foo -baz ) -operation miff:-',
|
143
|
+
cmd.to_s
|
144
|
+
end
|
145
|
+
end
|
@@ -0,0 +1,273 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
require 'skeptick/sugar/composition'
|
3
|
+
|
4
|
+
# DISCLAIMER
|
5
|
+
# These tests are not examples of proper usage of ImageMagick.
|
6
|
+
# In fact, most of them are entirely invalid. The point is to
|
7
|
+
# test the logic of building strings.
|
8
|
+
class CompositionTest < Skeptick::TestCase
|
9
|
+
include Skeptick
|
10
|
+
|
11
|
+
def test_compose_with_blending
|
12
|
+
cmd = compose(:over)
|
13
|
+
assert_equal 'convert -compose over -composite miff:-', cmd.to_s
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_compose_with_input
|
17
|
+
cmd = compose(:over, 'foo')
|
18
|
+
assert_equal 'convert foo -compose over -composite miff:-', cmd.to_s
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_compose_with_2_inputs
|
22
|
+
cmd = compose(:over, 'foo', 'bar')
|
23
|
+
assert_equal 'convert foo bar -compose over -composite miff:-', cmd.to_s
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_compose_with_output
|
27
|
+
cmd = compose(:over, to: 'foo')
|
28
|
+
assert_equal 'convert -compose over -composite foo', cmd.to_s
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_compose_with_input_and_output
|
32
|
+
cmd = compose(:over, 'foo', to: 'bar')
|
33
|
+
assert_equal 'convert foo -compose over -composite bar', cmd.to_s
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_compose_with_2_inputs_and_output
|
37
|
+
cmd = compose(:over, 'foo', 'bar', to: 'baz')
|
38
|
+
assert_equal 'convert foo bar -compose over -composite baz', cmd.to_s
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_compose_with_input_in_block
|
42
|
+
cmd = compose(:over) { image 'foo' }
|
43
|
+
assert_equal 'convert foo -compose over -composite miff:-', cmd.to_s
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_compose_with_input_in_block_and_output
|
47
|
+
cmd = compose(:over, to: 'bar') { image 'foo' }
|
48
|
+
assert_equal 'convert foo -compose over -composite bar', cmd.to_s
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_compose_with_2_input_styles
|
52
|
+
cmd = compose(:over, 'foo') { image 'bar' }
|
53
|
+
assert_equal 'convert foo bar -compose over -composite miff:-', cmd.to_s
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_compose_with_2_input_styles_and_output
|
57
|
+
cmd = compose(:over, 'foo', to: 'baz') { image 'bar' }
|
58
|
+
assert_equal 'convert foo bar -compose over -composite baz', cmd.to_s
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_compose_with_ops
|
62
|
+
cmd = compose(:over) { with '-foo' }
|
63
|
+
assert_equal 'convert -foo -compose over -composite miff:-', cmd.to_s
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_compose_with_concatenated_ops
|
67
|
+
cmd = compose(:over) { with '-foo', 'bar' }
|
68
|
+
assert_equal 'convert -foo bar -compose over -composite miff:-', cmd.to_s
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_compose_with_multiple_ops
|
72
|
+
cmd = compose(:over) { with '-foo'; with '+bar' }
|
73
|
+
assert_equal 'convert -foo +bar -compose over -composite miff:-', cmd.to_s
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_compose_with_multiple_concatenated_ops
|
77
|
+
cmd = compose(:over) { with '-foo', 'bar'; with '+baz', 'qux' }
|
78
|
+
assert_equal 'convert -foo bar +baz qux -compose over -composite miff:-',
|
79
|
+
cmd.to_s
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_compose_with_ops_inputs_and_output
|
83
|
+
cmd = compose(:over, 'foo', 'bar', to: 'baz') do
|
84
|
+
image 'qux'
|
85
|
+
with '+quux'
|
86
|
+
with '-corge', 'grault'
|
87
|
+
end
|
88
|
+
|
89
|
+
assert_equal 'convert foo bar qux +quux -corge grault -compose over ' +
|
90
|
+
'-composite baz', cmd.to_s
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_nested_compose
|
94
|
+
cmd = compose(:over, to: 'baz') do
|
95
|
+
compose(:multiply, 'foo') { with 'bar' }
|
96
|
+
end
|
97
|
+
|
98
|
+
assert_equal 'convert ( foo bar -compose multiply -composite ) -compose ' +
|
99
|
+
'over -composite baz', cmd.to_s
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_nested_compose_ignores_output
|
103
|
+
cmd = compose(:over, to: 'baz') do
|
104
|
+
compose(:multiply, 'foo', to: 'nowhere') { with 'bar' }
|
105
|
+
end
|
106
|
+
|
107
|
+
assert_equal 'convert ( foo bar -compose multiply -composite ) -compose ' +
|
108
|
+
'over -composite baz', cmd.to_s
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_multi_image_nested_compose
|
112
|
+
cmd = compose(:over, 'foo', to: 'bar') do
|
113
|
+
compose(:multiply, 'qux') do
|
114
|
+
with '+asdf'
|
115
|
+
with '+fdsa'
|
116
|
+
end
|
117
|
+
|
118
|
+
image 'bleh'
|
119
|
+
with '-resize'
|
120
|
+
end
|
121
|
+
|
122
|
+
assert_equal 'convert foo ( qux +asdf +fdsa -compose multiply ' +
|
123
|
+
'-composite ) bleh -resize -compose over -composite bar', cmd.to_s
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_compose_composition
|
127
|
+
complex_image = compose(:over, 'qux') do
|
128
|
+
with '+asdf'
|
129
|
+
with '+fdsa'
|
130
|
+
end
|
131
|
+
|
132
|
+
cmd = compose(:multiply, 'foo', to: 'bar') do
|
133
|
+
image complex_image
|
134
|
+
image 'bleh'
|
135
|
+
with '-resize'
|
136
|
+
end
|
137
|
+
|
138
|
+
assert_equal 'convert foo ( qux +asdf +fdsa -compose over -composite ) ' +
|
139
|
+
'bleh -resize -compose multiply -composite bar', cmd.to_s
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_compose_double_nesting_with_composition
|
143
|
+
complex_image = compose('foo', to: 'nowhere') do
|
144
|
+
compose('bar', to: 'nowhere') do
|
145
|
+
compose('baz') do
|
146
|
+
image 'image1'
|
147
|
+
with '-option', 'qux'
|
148
|
+
end
|
149
|
+
|
150
|
+
image 'image2'
|
151
|
+
with '+option'
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
cmd = compose('image3') do
|
156
|
+
image complex_image
|
157
|
+
image 'image4'
|
158
|
+
with '-option', 'quux'
|
159
|
+
end
|
160
|
+
|
161
|
+
assert_equal 'convert ( ( ( image1 -option qux -compose baz -composite ' +
|
162
|
+
') image2 +option -compose bar -composite ) -compose foo -composite ) ' +
|
163
|
+
'image4 -option quux -compose image3 -composite miff:-', cmd.to_s
|
164
|
+
end
|
165
|
+
|
166
|
+
def test_plus_operator_on_image
|
167
|
+
lhs = image('foo')
|
168
|
+
rhs = image('bar')
|
169
|
+
result = convert(lhs + rhs)
|
170
|
+
|
171
|
+
assert_equal 'convert ( foo bar -compose over -composite ) miff:-',
|
172
|
+
result.to_s
|
173
|
+
end
|
174
|
+
|
175
|
+
def test_minus_operator_on_image
|
176
|
+
lhs = image('foo')
|
177
|
+
rhs = image('bar')
|
178
|
+
result = convert(lhs - rhs)
|
179
|
+
|
180
|
+
assert_equal 'convert ( foo bar -compose dstout -composite ) miff:-',
|
181
|
+
result.to_s
|
182
|
+
end
|
183
|
+
|
184
|
+
def test_multiply_operator_on_image
|
185
|
+
lhs = image('foo')
|
186
|
+
rhs = image('bar')
|
187
|
+
result = convert(lhs * rhs)
|
188
|
+
|
189
|
+
assert_equal 'convert ( foo bar -compose multiply -composite ) miff:-',
|
190
|
+
result.to_s
|
191
|
+
end
|
192
|
+
|
193
|
+
def test_divide_operator_on_image
|
194
|
+
lhs = image('foo')
|
195
|
+
rhs = image('bar')
|
196
|
+
result = convert(lhs / rhs)
|
197
|
+
|
198
|
+
assert_equal 'convert ( foo bar -compose divide -composite ) miff:-',
|
199
|
+
result.to_s
|
200
|
+
end
|
201
|
+
|
202
|
+
def test_and_operator_on_image
|
203
|
+
lhs = image('foo')
|
204
|
+
rhs = image('bar')
|
205
|
+
result = convert(lhs & rhs)
|
206
|
+
|
207
|
+
assert_equal 'convert ( foo bar -alpha Set -compose dstin -composite ) ' +
|
208
|
+
'miff:-', result.to_s
|
209
|
+
end
|
210
|
+
|
211
|
+
def test_or_operator_on_image
|
212
|
+
lhs = image('foo')
|
213
|
+
rhs = image('bar')
|
214
|
+
result = convert(lhs | rhs)
|
215
|
+
|
216
|
+
assert_equal 'convert ( foo bar -compose dstover -composite ) miff:-',
|
217
|
+
result.to_s
|
218
|
+
end
|
219
|
+
|
220
|
+
def test_plus_operator_on_convert
|
221
|
+
lhs = convert('foo')
|
222
|
+
rhs = convert('bar')
|
223
|
+
result = lhs + rhs
|
224
|
+
|
225
|
+
assert_equal 'convert ( foo ) ( bar ) -compose over -composite miff:-',
|
226
|
+
result.to_s
|
227
|
+
end
|
228
|
+
|
229
|
+
def test_minus_operator_on_convert
|
230
|
+
lhs = convert('foo')
|
231
|
+
rhs = convert('bar')
|
232
|
+
result = lhs - rhs
|
233
|
+
|
234
|
+
assert_equal 'convert ( foo ) ( bar ) -compose dstout -composite miff:-',
|
235
|
+
result.to_s
|
236
|
+
end
|
237
|
+
|
238
|
+
def test_multiply_operator_on_convert
|
239
|
+
lhs = convert('foo')
|
240
|
+
rhs = convert('bar')
|
241
|
+
result = lhs * rhs
|
242
|
+
|
243
|
+
assert_equal 'convert ( foo ) ( bar ) -compose multiply -composite miff:-',
|
244
|
+
result.to_s
|
245
|
+
end
|
246
|
+
|
247
|
+
def test_divide_operator_on_convert
|
248
|
+
lhs = convert('foo')
|
249
|
+
rhs = convert('bar')
|
250
|
+
result = lhs / rhs
|
251
|
+
|
252
|
+
assert_equal 'convert ( foo ) ( bar ) -compose divide -composite miff:-',
|
253
|
+
result.to_s
|
254
|
+
end
|
255
|
+
|
256
|
+
def test_and_operator_on_convert
|
257
|
+
lhs = convert('foo')
|
258
|
+
rhs = convert('bar')
|
259
|
+
result = lhs & rhs
|
260
|
+
|
261
|
+
assert_equal 'convert ( foo ) ( bar ) -alpha Set -compose dstin ' +
|
262
|
+
'-composite miff:-', result.to_s
|
263
|
+
end
|
264
|
+
|
265
|
+
def test_or_operator_on_convert
|
266
|
+
lhs = convert('foo')
|
267
|
+
rhs = convert('bar')
|
268
|
+
result = lhs | rhs
|
269
|
+
|
270
|
+
assert_equal 'convert ( foo ) ( bar ) -compose dstover -composite miff:-',
|
271
|
+
result.to_s
|
272
|
+
end
|
273
|
+
end
|