pnm 0.4.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # test_pnm.rb: Unit tests for the PNM library.
2
4
  #
3
- # Copyright (C) 2013-2015 Marcus Stollsteimer
5
+ # Copyright (C) 2013-2020 Marcus Stollsteimer
6
+
7
+ require "minitest/autorun"
8
+ require "pnm"
4
9
 
5
- require 'minitest/autorun'
6
- require 'pnm'
10
+ require_relative "backports"
7
11
 
8
12
 
9
13
  describe PNM do
@@ -12,93 +16,93 @@ describe PNM do
12
16
  @srcpath = File.dirname(__FILE__)
13
17
  end
14
18
 
15
- it 'can read an ASCII encoded PBM file' do
19
+ it "can read an ASCII encoded PBM file" do
16
20
  file = File.expand_path("#{@srcpath}/bilevel_ascii.pbm")
17
21
  image = PNM.read(file)
18
22
 
19
- image.info.must_match %r{^PBM 5x6 Bilevel}
20
- image.maxgray.must_equal 1
21
- image.comment.must_equal 'Bilevel'
22
- image.pixels.must_equal [[0,0,0,0,0],
23
- [0,1,1,1,0],
24
- [0,0,1,0,0],
25
- [0,0,1,0,0],
26
- [0,0,1,0,0],
27
- [0,0,0,0,0,]]
23
+ _(image.info).must_equal "PBM 5x6 Bilevel"
24
+ _(image.maxgray).must_equal 1
25
+ _(image.comment).must_equal "Bilevel"
26
+ _(image.pixels).must_equal [[0, 0, 0, 0, 0],
27
+ [0, 1, 1, 1, 0],
28
+ [0, 0, 1, 0, 0],
29
+ [0, 0, 1, 0, 0],
30
+ [0, 0, 1, 0, 0],
31
+ [0, 0, 0, 0, 0]]
28
32
  end
29
33
 
30
- it 'can read an ASCII encoded PGM file' do
34
+ it "can read an ASCII encoded PGM file" do
31
35
  file = File.expand_path("#{@srcpath}/grayscale_ascii.pgm")
32
36
  image = PNM.read(file)
33
37
 
34
- image.info.must_match %r{^PGM 4x3 Grayscale}
35
- image.maxgray.must_equal 250
36
- image.comment.must_equal "Grayscale\n(with multiline comment)"
37
- image.pixels.must_equal [[ 0, 50,100,150],
38
- [ 50,100,150,200],
39
- [100,150,200,250]]
38
+ _(image.info).must_equal "PGM 4x3 Grayscale"
39
+ _(image.maxgray).must_equal 250
40
+ _(image.comment).must_equal "Grayscale\n(with multiline comment)"
41
+ _(image.pixels).must_equal [[ 0, 50, 100, 150],
42
+ [ 50, 100, 150, 200],
43
+ [100, 150, 200, 250]]
40
44
  end
41
45
 
42
- it 'can read an ASCII encoded PPM file' do
46
+ it "can read an ASCII encoded PPM file" do
43
47
  file = File.expand_path("#{@srcpath}/color_ascii.ppm")
44
48
  image = PNM.read(file)
45
49
 
46
- image.info.must_match %r{^PPM 5x3 Color}
47
- image.maxgray.must_equal 6
48
- image.pixels.must_equal [[[0,6,0], [1,5,1], [2,4,2], [3,3,4], [4,2,6]],
49
- [[1,5,2], [2,4,2], [3,3,2], [4,2,2], [5,1,2]],
50
- [[2,4,6], [3,3,4], [4,2,2], [5,1,1], [6,0,0]]]
50
+ _(image.info).must_equal "PPM 5x3 Color"
51
+ _(image.maxgray).must_equal 6
52
+ _(image.pixels).must_equal [[[0, 6, 0], [1, 5, 1], [2, 4, 2], [3, 3, 4], [4, 2, 6]],
53
+ [[1, 5, 2], [2, 4, 2], [3, 3, 2], [4, 2, 2], [5, 1, 2]],
54
+ [[2, 4, 6], [3, 3, 4], [4, 2, 2], [5, 1, 1], [6, 0, 0]]]
51
55
  end
52
56
 
53
- it 'can read a binary encoded PBM file' do
57
+ it "can read a binary encoded PBM file" do
54
58
  file = File.expand_path("#{@srcpath}/bilevel_binary.pbm")
55
59
  image = PNM.read(file)
56
60
 
57
- image.info.must_match %r{^PBM 5x6 Bilevel}
58
- image.maxgray.must_equal 1
59
- image.comment.must_equal 'Bilevel'
60
- image.pixels.must_equal [[0,0,0,0,0],
61
- [0,1,1,1,0],
62
- [0,0,1,0,0],
63
- [0,0,1,0,0],
64
- [0,0,1,0,0],
65
- [0,0,0,0,0,]]
61
+ _(image.info).must_equal "PBM 5x6 Bilevel"
62
+ _(image.maxgray).must_equal 1
63
+ _(image.comment).must_equal "Bilevel"
64
+ _(image.pixels).must_equal [[0, 0, 0, 0, 0],
65
+ [0, 1, 1, 1, 0],
66
+ [0, 0, 1, 0, 0],
67
+ [0, 0, 1, 0, 0],
68
+ [0, 0, 1, 0, 0],
69
+ [0, 0, 0, 0, 0]]
66
70
  end
67
71
 
68
- it 'can read a binary encoded PGM file' do
72
+ it "can read a binary encoded PGM file" do
69
73
  file = File.expand_path("#{@srcpath}/grayscale_binary.pgm")
70
74
  image = PNM.read(file)
71
75
 
72
- image.info.must_match %r{^PGM 4x3 Grayscale}
73
- image.maxgray.must_equal 250
74
- image.comment.must_equal "Grayscale\n(with multiline comment)"
75
- image.pixels.must_equal [[ 0, 50,100,150],
76
- [ 50,100,150,200],
77
- [100,150,200,250]]
76
+ _(image.info).must_equal "PGM 4x3 Grayscale"
77
+ _(image.maxgray).must_equal 250
78
+ _(image.comment).must_equal "Grayscale\n(with multiline comment)"
79
+ _(image.pixels).must_equal [[ 0, 50, 100, 150],
80
+ [ 50, 100, 150, 200],
81
+ [100, 150, 200, 250]]
78
82
  end
79
83
 
80
- it 'can read a binary encoded PPM file' do
84
+ it "can read a binary encoded PPM file" do
81
85
  file = File.expand_path("#{@srcpath}/color_binary.ppm")
82
86
  image = PNM.read(file)
83
87
 
84
- image.info.must_match %r{^PPM 5x3 Color}
85
- image.maxgray.must_equal 6
86
- image.pixels.must_equal [[[0,6,0], [1,5,1], [2,4,2], [3,3,4], [4,2,6]],
87
- [[1,5,2], [2,4,2], [3,3,2], [4,2,2], [5,1,2]],
88
- [[2,4,6], [3,3,4], [4,2,2], [5,1,1], [6,0,0]]]
88
+ _(image.info).must_equal "PPM 5x3 Color"
89
+ _(image.maxgray).must_equal 6
90
+ _(image.pixels).must_equal [[[0, 6, 0], [1, 5, 1], [2, 4, 2], [3, 3, 4], [4, 2, 6]],
91
+ [[1, 5, 2], [2, 4, 2], [3, 3, 2], [4, 2, 2], [5, 1, 2]],
92
+ [[2, 4, 6], [3, 3, 4], [4, 2, 2], [5, 1, 1], [6, 0, 0]]]
89
93
  end
90
94
 
91
- it 'can read binary data containing CRLF' do
95
+ it "can read binary data containing CRLF" do
92
96
  file = File.expand_path("#{@srcpath}/grayscale_binary_crlf.pgm")
93
97
 
94
98
  image = PNM.read(file)
95
- image.pixels.must_equal [[65,66], [13,10], [65,66]]
99
+ _(image.pixels).must_equal [[65, 66], [13, 10], [65, 66]]
96
100
  end
97
101
 
98
- it 'can read binary data containing CRLF from an I/O stream' do
102
+ it "can read binary data containing CRLF from an I/O stream" do
99
103
  file = File.expand_path("#{@srcpath}/grayscale_binary_crlf.pgm")
100
104
 
101
- image = File.open(file, 'r') {|f| PNM.read(f) }
102
- image.pixels.must_equal [[65,66], [13,10], [65,66]]
105
+ image = File.open(file, "r") {|f| PNM.read(f) }
106
+ _(image.pixels).must_equal [[65, 66], [13, 10], [65, 66]]
103
107
  end
104
108
  end
metadata CHANGED
@@ -1,50 +1,51 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pnm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcus Stollsteimer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-20 00:00:00.000000000 Z
11
+ date: 2020-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake
14
+ name: minitest
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '10.0'
19
+ version: '5.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '10.0'
26
+ version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: minitest
28
+ name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '5.0'
33
+ version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '5.0'
40
+ version: '10.0'
41
41
  description: 'PNM is a pure Ruby library for creating, reading, and writing of PNM
42
42
  image files (Portable Anymap): PBM (Portable Bitmap), PGM (Portable Graymap), and
43
43
  PPM (Portable Pixmap).'
44
44
  email: sto.mar@web.de
45
45
  executables: []
46
46
  extensions: []
47
- extra_rdoc_files: []
47
+ extra_rdoc_files:
48
+ - README.md
48
49
  files:
49
50
  - ".yardopts"
50
51
  - README.md
@@ -60,6 +61,7 @@ files:
60
61
  - lib/pnm/parser.rb
61
62
  - lib/pnm/version.rb
62
63
  - pnm.gemspec
64
+ - test/backports.rb
63
65
  - test/bilevel_2_binary.pbm
64
66
  - test/bilevel_ascii.pbm
65
67
  - test/bilevel_binary.pbm
@@ -75,33 +77,32 @@ files:
75
77
  - test/test_pnm.rb
76
78
  homepage: https://github.com/stomar/pnm
77
79
  licenses:
78
- - GPL-3
80
+ - GPL-3.0
79
81
  metadata: {}
80
82
  post_install_message:
81
83
  rdoc_options:
82
84
  - "--charset=UTF-8"
85
+ - "--main=README.md"
83
86
  require_paths:
84
87
  - lib
85
88
  required_ruby_version: !ruby/object:Gem::Requirement
86
89
  requirements:
87
90
  - - ">="
88
91
  - !ruby/object:Gem::Version
89
- version: 1.9.3
92
+ version: 2.0.0
90
93
  required_rubygems_version: !ruby/object:Gem::Requirement
91
94
  requirements:
92
95
  - - ">="
93
96
  - !ruby/object:Gem::Version
94
97
  version: '0'
95
98
  requirements: []
96
- rubyforge_project:
97
- rubygems_version: 2.4.5
99
+ rubygems_version: 3.1.2
98
100
  signing_key:
99
101
  specification_version: 4
100
102
  summary: PNM - create/read/write PNM image files (PBM, PGM, PPM)
101
103
  test_files:
102
- - test/test_image.rb
103
104
  - test/test_exceptions.rb
104
- - test/test_parser.rb
105
105
  - test/test_converter.rb
106
106
  - test/test_pnm.rb
107
- has_rdoc:
107
+ - test/test_image.rb
108
+ - test/test_parser.rb