mojo_magick 0.5.2 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,29 @@
1
- require File::join(File::dirname(__FILE__), 'test_helper')
2
-
3
- class MojoMagickOptBuilderTest < Test::Unit::TestCase
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
4
2
 
3
+ class MojoMagickOptBuilderTest < MiniTest::Test
5
4
  # These tests make the assumption that if we call #raw_command with the
6
5
  # correct strings, ImageMagick itself will operate correctly. We're only
7
6
  # verifying that the option builder produces the correct strings
7
+
8
+ def setup
9
+ @builder = MojoMagick::OptBuilder.new
10
+ end
11
+
12
+ def test_annotate
13
+ @builder.annotate 'blah'
14
+ assert_equal '-annotate 0 blah', @builder.to_s
15
+ end
16
+
17
+ def test_annotate_with_escapeable_string
18
+ @builder.annotate 'it\'s'
19
+ assert_equal '-annotate 0 "it\'s"', @builder.to_s
20
+ end
21
+
22
+ def test_annotate_with_full_args
23
+ @builder.annotate '5 it\'s'
24
+ assert_equal '-annotate 5 "it\'s"', @builder.to_s
25
+ end
26
+
8
27
  def test_option_builder_with_blocks
9
28
  # Passing in basic commands produces a string
10
29
  b = MojoMagick::OptBuilder.new
@@ -17,7 +36,7 @@ class MojoMagickOptBuilderTest < Test::Unit::TestCase
17
36
  assert_equal '\( -background red \) \( -background blue \)', b.to_s
18
37
  end
19
38
 
20
- def test_option_builder_with_hex_colors
39
+ def test_option_builder_with_hex_colors
21
40
  b = MojoMagick::OptBuilder.new
22
41
  b.background '#000000'
23
42
  assert_equal '-background "#000000"', b.to_s
@@ -49,7 +68,7 @@ class MojoMagickOptBuilderTest < Test::Unit::TestCase
49
68
 
50
69
  # Treats an array of raw data as different arguments
51
70
  b = MojoMagick::OptBuilder.new
52
- b << ['leave this data','alone']
71
+ b << ['leave this data', 'alone']
53
72
  assert_equal 'leave this data alone', b.to_s
54
73
 
55
74
  # String includes command arguments
@@ -93,20 +112,18 @@ class MojoMagickOptBuilderTest < Test::Unit::TestCase
93
112
  b.blob 'binary data'
94
113
  filename = b.to_s
95
114
  File.open(filename, 'rb') do |f|
96
- assert_equal f.read, 'binary data'
115
+ assert_equal 'binary data', f.read
97
116
  end
98
117
 
99
- #label for text should use 'label:"the string"' if specified
100
- [[ 'mylabel', 'mylabel' ],
101
- [ 'my " label', '"my \" label"' ],
102
- [ 'Rock it, cuz i said so!', '"Rock it, cuz i said so!"'],
103
- [ "it's like this", '"it\'s like this"'],
104
- [ '#$%^&*', '"#$%^&*"']].each do |labels|
105
-
118
+ # label for text should use 'label:"the string"' if specified
119
+ [%w[mylabel mylabel],
120
+ ['my " label', '"my \" label"'],
121
+ ['Rock it, cuz i said so!', '"Rock it, cuz i said so!"'],
122
+ ["it's like this", '"it\'s like this"'],
123
+ ['#$%^&*', '"#$%^&*"']].each do |labels|
106
124
  b = MojoMagick::OptBuilder.new
107
125
  b.label labels[0]
108
126
  assert_equal "label:#{labels[1]}", b.to_s
109
127
  end
110
-
111
128
  end
112
129
  end
@@ -1,26 +1,25 @@
1
- require File::join(File::dirname(__FILE__), 'test_helper')
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
2
 
3
- IDENTIFY_FONT_RESPONSE =<<EOF
3
+ IDENTIFY_FONT_RESPONSE = <<~EOF.freeze
4
4
 
5
- Font: Zapf-Dingbats
6
- family: Zapf Dingbats
7
- style: Normal
8
- stretch: Normal
9
- weight: 400
10
- glyphs: /System/Library/Fonts/ZapfDingbats.ttf
5
+ Font: Zapf-Dingbats
6
+ family: Zapf Dingbats
7
+ style: Normal
8
+ stretch: Normal
9
+ weight: 400
10
+ glyphs: /System/Library/Fonts/ZapfDingbats.ttf
11
11
 
12
- Font: Zapfino
13
- family: Zapfino
14
- style: Italic
15
- stretch: Normal
16
- weight: 400
17
- glyphs: /Library/Fonts/Zapfino.ttf
12
+ Font: Zapfino
13
+ family: Zapfino
14
+ style: Italic
15
+ stretch: Normal
16
+ weight: 400
17
+ glyphs: /Library/Fonts/Zapfino.ttf
18
18
 
19
19
 
20
20
  EOF
21
21
 
22
- class ParserTest < Test::Unit::TestCase
23
-
22
+ class ParserTest < MiniTest::Test
24
23
  def test_parse_fonts
25
24
  parser = MojoMagick::Util::Parser.new
26
25
  parsed_fonts = parser.parse_fonts(IDENTIFY_FONT_RESPONSE)
@@ -1,37 +1,49 @@
1
- require File::join(File::dirname(__FILE__), 'test_helper')
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
2
 
3
- class ResourceLimitsTest < Test::Unit::TestCase
3
+ class ResourceLimitsTest < MiniTest::Test
4
+ def setup
5
+ @orig_limits = MojoMagick.get_default_limits
6
+ end
7
+
8
+ def test_set_limits
9
+ # set area to 32mb limit
10
+ MojoMagick.set_limits(area: '32mb')
11
+ new_limits = MojoMagick.get_current_limits
12
+ assert_equal '32mb', new_limits[:area].downcase
13
+ end
14
+
15
+ def test_get_limits
16
+ assert(@orig_limits.size >= 7)
17
+ end
4
18
 
5
19
  def test_resource_limits
6
- orig_limits = MojoMagick::get_default_limits
7
- assert_equal 7, orig_limits.size
8
- orig_limits_test = orig_limits.dup
9
- orig_limits_test.delete_if do |resource, value|
10
- assert [:area, :map, :disk, :memory, :file, :thread, :time].include?(resource), "Found unexpected resource #{resource}"
20
+ orig_limits_test = @orig_limits.dup
21
+ orig_limits_test.delete_if do |resource, _value|
22
+ assert %i[throttle area map disk memory file thread time].include?(resource), "Found unexpected resource #{resource}"
11
23
  true
12
24
  end
13
25
  assert_equal 0, orig_limits_test.size
26
+ end
14
27
 
15
- # set area to 32mb limit
16
- MojoMagick::set_limits(:area => '32mb')
17
- new_limits = MojoMagick::get_current_limits
18
- assert_equal '32mb', new_limits[:area].downcase
19
-
28
+ def test_get_current_limits
20
29
  # remove limits on area
21
- MojoMagick::remove_limits(:area)
22
- new_limits = MojoMagick::get_current_limits
23
- assert_equal orig_limits[:area], new_limits[:area]
30
+ MojoMagick.remove_limits(:area)
31
+ new_limits = MojoMagick.get_current_limits
32
+ assert_equal @orig_limits[:area], new_limits[:area]
33
+ end
24
34
 
35
+ def test_set_limits_again
25
36
  # set memory to 64 mb, disk to 0 and
26
- MojoMagick::set_limits(:memory => '64mb', :disk => '0b')
27
- new_limits = MojoMagick::get_current_limits(:show_actual_values => true)
37
+ MojoMagick.set_limits(memory: '64mb', disk: '0b')
38
+ new_limits = MojoMagick.get_current_limits(show_actual_values: true)
28
39
  assert_equal 61, new_limits[:memory]
29
40
  assert_equal 0, new_limits[:disk]
41
+ end
30
42
 
43
+ def test_unset_limits
31
44
  # return to original/default limit values
32
- MojoMagick::unset_limits
33
- new_limits = MojoMagick::get_current_limits
34
- assert_equal orig_limits, new_limits
45
+ MojoMagick.unset_limits
46
+ new_limits = MojoMagick.get_current_limits
47
+ assert_equal @orig_limits, new_limits
35
48
  end
36
-
37
49
  end
@@ -1,6 +1,6 @@
1
- require 'test/unit'
2
- require File::expand_path(File::join(File::dirname(__FILE__), '..', 'init'))
1
+ require 'minitest/autorun'
2
+ require 'minitest/pride'
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'init'))
3
4
  require 'fileutils'
4
5
  require 'tempfile'
5
6
  require 'rspec/expectations'
6
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mojo_magick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Midgley
@@ -10,60 +10,74 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-11-26 00:00:00.000000000 Z
13
+ date: 2020-09-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: rake
16
+ name: minitest
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - '>='
19
+ - - ">="
20
20
  - !ruby/object:Gem::Version
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - '>='
26
+ - - ">="
27
27
  - !ruby/object:Gem::Version
28
28
  version: '0'
29
29
  - !ruby/object:Gem::Dependency
30
- name: simplecov
30
+ name: rake
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - '>='
33
+ - - ">="
34
34
  - !ruby/object:Gem::Version
35
35
  version: '0'
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - '>='
40
+ - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rspec-expectations
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ type: :development
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ - !ruby/object:Gem::Dependency
58
+ name: simplecov
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
48
62
  - !ruby/object:Gem::Version
49
63
  version: '0'
50
64
  type: :development
51
65
  prerelease: false
52
66
  version_requirements: !ruby/object:Gem::Requirement
53
67
  requirements:
54
- - - '>='
68
+ - - ">="
55
69
  - !ruby/object:Gem::Version
56
70
  version: '0'
57
71
  description: Simple Ruby stateless module interface to imagemagick.
58
72
  email:
59
- - public@misuse.org
73
+ - science@misuse.org
60
74
  - jon@rcode5.com
61
75
  executables: []
62
76
  extensions: []
63
77
  extra_rdoc_files: []
64
78
  files:
65
- - .gitignore
66
- - .ruby-version
79
+ - ".gitignore"
80
+ - ".ruby-version"
67
81
  - Gemfile
68
82
  - Gemfile.lock
69
83
  - LICENSE.txt
@@ -74,9 +88,10 @@ files:
74
88
  - init.rb
75
89
  - lib/image_magick/fonts.rb
76
90
  - lib/image_magick/resource_limits.rb
77
- - lib/image_resources.rb
78
91
  - lib/initializers/hash.rb
79
92
  - lib/mojo_magick.rb
93
+ - lib/mojo_magick/command_status.rb
94
+ - lib/mojo_magick/errors.rb
80
95
  - lib/mojo_magick/font.rb
81
96
  - lib/mojo_magick/opt_builder.rb
82
97
  - lib/mojo_magick/util/parser.rb
@@ -93,7 +108,8 @@ files:
93
108
  - test/resource_limits_test.rb
94
109
  - test/test_helper.rb
95
110
  homepage: http://github.com/rcode5/mojo_magick
96
- licenses: []
111
+ licenses:
112
+ - MIT
97
113
  metadata: {}
98
114
  post_install_message: |2+
99
115
 
@@ -109,20 +125,19 @@ require_paths:
109
125
  - lib
110
126
  required_ruby_version: !ruby/object:Gem::Requirement
111
127
  requirements:
112
- - - '>='
128
+ - - ">="
113
129
  - !ruby/object:Gem::Version
114
130
  version: '0'
115
131
  required_rubygems_version: !ruby/object:Gem::Requirement
116
132
  requirements:
117
- - - '>='
133
+ - - ">="
118
134
  - !ruby/object:Gem::Version
119
135
  version: '0'
120
136
  requirements: []
121
- rubyforge_project: mojo_magick
122
- rubygems_version: 2.0.14
137
+ rubygems_version: 3.0.3
123
138
  signing_key:
124
139
  specification_version: 4
125
- summary: mojo_magick-0.5.2
140
+ summary: mojo_magick-0.5.7
126
141
  test_files:
127
142
  - test/fixtures/5742.jpg
128
143
  - test/fixtures/not_an_image.jpg
@@ -134,3 +149,4 @@ test_files:
134
149
  - test/parser_test.rb
135
150
  - test/resource_limits_test.rb
136
151
  - test/test_helper.rb
152
+ ...
File without changes