shattered_machine 0.0.6 → 0.0.7
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.
- checksums.yaml +4 -4
- data/CHANGELOG +13 -0
- data/lib/shattered_machine.rb +1 -1
- data/lib/shattered_machine/glitcher.rb +8 -0
- data/lib/shattered_machine/io.rb +4 -4
- data/lib/shattered_machine/transpose.rb +2 -2
- data/shattered_machine.gemspec +8 -2
- metadata +2 -21
- data/spec/brush_spec.rb +0 -25
- data/spec/change_byte_spec.rb +0 -25
- data/spec/converter_spec.rb +0 -23
- data/spec/defect_spec.rb +0 -25
- data/spec/exchange_spec.rb +0 -25
- data/spec/glitcher_spec.rb +0 -25
- data/spec/images/bar.PNG +0 -0
- data/spec/images/bar.jpeg +0 -0
- data/spec/images/foo.jpg +0 -0
- data/spec/images/foo.png +0 -0
- data/spec/images/fuzz.JPG +0 -0
- data/spec/images/pouet.JPEG +0 -0
- data/spec/io_spec.rb +0 -73
- data/spec/pixel_sorter_spec.rb +0 -25
- data/spec/sampler_spec.rb +0 -45
- data/spec/slim_spec.rb +0 -25
- data/spec/spec_helper.rb +0 -27
- data/spec/transpose_spec.rb +0 -25
- data/spec/wrong_filter_spec.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1af0eb48cdbdeed165f788af1db525ed3f788c0f2d71376d38f3f37180886b2
|
4
|
+
data.tar.gz: 1cdc7f160e8e187eb8f793df4467272d6062fa9189824f4560c6bc27944c1cfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e13ad0eaf2df4857bc23f71c2b133a72db20be76623709f57508a1b5fc0259286e3ce2faaa3fb69563a1201616e1112ba66de4e6f73d90b6dcc86754cfd2b836
|
7
|
+
data.tar.gz: 52d29279379feddf29b7964b51c3a70c838b472e1df1507646df36045e6a8723df4031fe2aa512a0727303dfa64800227c00522b765209e6efb454ef5b8127a2
|
data/CHANGELOG
CHANGED
@@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [Unreleased]
|
8
|
+
|
9
|
+
## [0.0.7] - 2021-06-06
|
10
|
+
### Changed
|
11
|
+
- Privatise PNG_EXTENSIONS, JPG_EXTENSIONS and Paths in Io
|
12
|
+
|
13
|
+
### Fixed
|
14
|
+
- Transpose algorithm
|
15
|
+
- Include missing required files in glitcher
|
16
|
+
|
17
|
+
### Removed
|
18
|
+
- Spec files from the gem
|
19
|
+
|
7
20
|
## [0.0.6] - 2021-05-28
|
8
21
|
### Added
|
9
22
|
- Add Sampler in the main lib
|
data/lib/shattered_machine.rb
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'brush'
|
4
|
+
require_relative 'change_byte'
|
5
|
+
require_relative 'defect'
|
6
|
+
require_relative 'exchange'
|
7
|
+
require_relative 'pixel_sorter'
|
8
|
+
require_relative 'slim'
|
9
|
+
require_relative 'transpose'
|
10
|
+
require_relative 'wrong_filter'
|
3
11
|
module ShatteredMachine
|
4
12
|
# Main class to call from glitching image.
|
5
13
|
class Glitcher
|
data/lib/shattered_machine/io.rb
CHANGED
@@ -6,10 +6,6 @@ module ShatteredMachine
|
|
6
6
|
class Io
|
7
7
|
attr_accessor :output_filename
|
8
8
|
|
9
|
-
PNG_EXTENSIONS = ['.png', '.PNG'].freeze
|
10
|
-
JPG_EXTENSIONS = ['.jpg', '.jpeg', '.JPG', '.JPEG'].freeze
|
11
|
-
Paths = Struct.new(:input, :output)
|
12
|
-
|
13
9
|
# @param input_path [string] input file or directory
|
14
10
|
# @param output_folder [string] output directory
|
15
11
|
# @param output_filename [string] output file name
|
@@ -39,6 +35,10 @@ module ShatteredMachine
|
|
39
35
|
|
40
36
|
private
|
41
37
|
|
38
|
+
PNG_EXTENSIONS = ['.png', '.PNG'].freeze
|
39
|
+
JPG_EXTENSIONS = ['.jpg', '.jpeg', '.JPG', '.JPEG'].freeze
|
40
|
+
Paths = Struct.new(:input, :output)
|
41
|
+
|
42
42
|
def single_image_io
|
43
43
|
[Paths.new(@input_path, generate_output_filename)]
|
44
44
|
end
|
@@ -47,11 +47,11 @@ module ShatteredMachine
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def half_transpose(data, qis)
|
50
|
-
data[0, qis] + data[qis * 2, qis] + data[qis * 1, qis] + data[qis * 3
|
50
|
+
data[0, qis] + data[qis * 2, qis] + data[qis * 1, qis] + data[qis * 3..-1]
|
51
51
|
end
|
52
52
|
|
53
53
|
def full_transpose(data, qis)
|
54
|
-
data[qis * 2, qis] + data[0, qis] + data[qis * 3
|
54
|
+
data[qis * 2, qis] + data[0, qis] + data[qis * 3..-1] + data[qis * 1, qis]
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
data/shattered_machine.gemspec
CHANGED
@@ -1,13 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'English'
|
4
|
+
|
1
5
|
Gem::Specification.new do |s|
|
2
6
|
s.name = 'shattered_machine'
|
3
|
-
s.version = '0.0.
|
7
|
+
s.version = '0.0.7'
|
4
8
|
s.required_ruby_version = '>= 2.0.0'
|
5
9
|
s.required_rubygems_version = '>= 1.8.11'
|
6
10
|
s.summary = 'Shattered Machine core engine'
|
7
11
|
s.description = 'Shattered Machine is an easy way to glitch PNG images using different algorithms'
|
8
12
|
s.authors = ['Flo Girardo']
|
9
13
|
s.email = 'florian@barbrousse.net'
|
10
|
-
s.files
|
14
|
+
s.files = `git ls-files`.split($RS).reject do |file|
|
15
|
+
file =~ %r{^spec/}
|
16
|
+
end
|
11
17
|
s.test_files = ['spec']
|
12
18
|
s.require_paths = ['lib']
|
13
19
|
s.homepage =
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shattered_machine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flo Girardo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rusty_engine_ffi
|
@@ -106,25 +106,6 @@ files:
|
|
106
106
|
- lib/shattered_machine/transpose.rb
|
107
107
|
- lib/shattered_machine/wrong_filter.rb
|
108
108
|
- shattered_machine.gemspec
|
109
|
-
- spec/brush_spec.rb
|
110
|
-
- spec/change_byte_spec.rb
|
111
|
-
- spec/converter_spec.rb
|
112
|
-
- spec/defect_spec.rb
|
113
|
-
- spec/exchange_spec.rb
|
114
|
-
- spec/glitcher_spec.rb
|
115
|
-
- spec/images/bar.PNG
|
116
|
-
- spec/images/bar.jpeg
|
117
|
-
- spec/images/foo.jpg
|
118
|
-
- spec/images/foo.png
|
119
|
-
- spec/images/fuzz.JPG
|
120
|
-
- spec/images/pouet.JPEG
|
121
|
-
- spec/io_spec.rb
|
122
|
-
- spec/pixel_sorter_spec.rb
|
123
|
-
- spec/sampler_spec.rb
|
124
|
-
- spec/slim_spec.rb
|
125
|
-
- spec/spec_helper.rb
|
126
|
-
- spec/transpose_spec.rb
|
127
|
-
- spec/wrong_filter_spec.rb
|
128
109
|
homepage: https://framagit.org/Radoteur/shattered-machine
|
129
110
|
licenses:
|
130
111
|
- MIT
|
data/spec/brush_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
RSpec.describe ShatteredMachine::Brush do
|
6
|
-
describe '#call' do
|
7
|
-
let(:output_file) { 'spec/images/brush.png' }
|
8
|
-
let(:input_file) { 'spec/images/foo.png' }
|
9
|
-
let(:io) do
|
10
|
-
ShatteredMachine::Io.new(input_file, 'spec/images', 'brush')
|
11
|
-
end
|
12
|
-
let(:in_img) { io.png_images.first.input }
|
13
|
-
let(:out_img) { io.png_images.first.output }
|
14
|
-
subject { ShatteredMachine::Brush.new.call(in_img, out_img) }
|
15
|
-
|
16
|
-
after do
|
17
|
-
File.delete(output_file) if File.exist?(output_file)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'brush image' do
|
21
|
-
subject
|
22
|
-
expect(File.exist?(output_file)).to be true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/spec/change_byte_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
RSpec.describe ShatteredMachine::ChangeByte do
|
6
|
-
describe '#call' do
|
7
|
-
let(:output_file) { 'spec/images/change_byte.png' }
|
8
|
-
let(:input_file) { 'spec/images/foo.png' }
|
9
|
-
let(:io) do
|
10
|
-
ShatteredMachine::Io.new(input_file, 'spec/images', 'change_byte')
|
11
|
-
end
|
12
|
-
let(:in_img) { io.png_images.first.input }
|
13
|
-
let(:out_img) { io.png_images.first.output }
|
14
|
-
subject { ShatteredMachine::ChangeByte.new.call(in_img, out_img) }
|
15
|
-
|
16
|
-
after do
|
17
|
-
File.delete(output_file) if File.exist?(output_file)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'change byte on image' do
|
21
|
-
subject
|
22
|
-
expect(File.exist?(output_file)).to be true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/spec/converter_spec.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
RSpec.describe ShatteredMachine::Converter do
|
6
|
-
describe '#call' do
|
7
|
-
let(:converted_file) { 'spec/images/converted.png' }
|
8
|
-
let(:input_file) { 'spec/images/foo.jpg' }
|
9
|
-
let(:io) do
|
10
|
-
ShatteredMachine::Io.new(input_file, 'spec/images', 'converted')
|
11
|
-
end
|
12
|
-
subject { ShatteredMachine::Converter.new(io).call }
|
13
|
-
|
14
|
-
after do
|
15
|
-
File.delete(converted_file) if File.exist?(converted_file)
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'convert image' do
|
19
|
-
subject
|
20
|
-
expect(File.exist?(converted_file)).to be true
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
data/spec/defect_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
RSpec.describe ShatteredMachine::Defect do
|
6
|
-
describe '#call' do
|
7
|
-
let(:output_file) { 'spec/images/defect.png' }
|
8
|
-
let(:input_file) { 'spec/images/foo.png' }
|
9
|
-
let(:io) do
|
10
|
-
ShatteredMachine::Io.new(input_file, 'spec/images', 'defect')
|
11
|
-
end
|
12
|
-
let(:in_img) { io.png_images.first.input }
|
13
|
-
let(:out_img) { io.png_images.first.output }
|
14
|
-
subject { ShatteredMachine::Defect.new.call(in_img, out_img) }
|
15
|
-
|
16
|
-
after do
|
17
|
-
File.delete(output_file) if File.exist?(output_file)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'defect image' do
|
21
|
-
subject
|
22
|
-
expect(File.exist?(output_file)).to be true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/spec/exchange_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
RSpec.describe ShatteredMachine::Exchange do
|
6
|
-
describe '#call' do
|
7
|
-
let(:output_file) { 'spec/images/exchange.png' }
|
8
|
-
let(:input_file) { 'spec/images/foo.png' }
|
9
|
-
let(:io) do
|
10
|
-
ShatteredMachine::Io.new(input_file, 'spec/images', 'exchange')
|
11
|
-
end
|
12
|
-
let(:in_img) { io.png_images.first.input }
|
13
|
-
let(:out_img) { io.png_images.first.output }
|
14
|
-
subject { ShatteredMachine::Exchange.new.call(in_img, out_img) }
|
15
|
-
|
16
|
-
after do
|
17
|
-
File.delete(output_file) if File.exist?(output_file)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'exchange image' do
|
21
|
-
subject
|
22
|
-
expect(File.exist?(output_file)).to be true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/spec/glitcher_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
RSpec.describe ShatteredMachine::Glitcher do
|
6
|
-
describe '#call' do
|
7
|
-
let(:output_file) { 'spec/images/glitch.png' }
|
8
|
-
let(:input_file) { 'spec/images/foo.png' }
|
9
|
-
let(:io) do
|
10
|
-
ShatteredMachine::Io.new(input_file, 'spec/images', 'glitch')
|
11
|
-
end
|
12
|
-
subject do
|
13
|
-
ShatteredMachine::Glitcher.new('Slim', io).call
|
14
|
-
end
|
15
|
-
|
16
|
-
after do
|
17
|
-
File.delete(output_file) if File.exist?(output_file)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'slim image' do
|
21
|
-
subject
|
22
|
-
expect(File.exist?(output_file)).to be true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/spec/images/bar.PNG
DELETED
Binary file
|
data/spec/images/bar.jpeg
DELETED
Binary file
|
data/spec/images/foo.jpg
DELETED
Binary file
|
data/spec/images/foo.png
DELETED
Binary file
|
data/spec/images/fuzz.JPG
DELETED
Binary file
|
data/spec/images/pouet.JPEG
DELETED
Binary file
|
data/spec/io_spec.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
RSpec.describe ShatteredMachine::Io do
|
6
|
-
describe '#png_images' do
|
7
|
-
subject do
|
8
|
-
ShatteredMachine::Io.new(input_path, 'spec/images', output_filename).png_images
|
9
|
-
end
|
10
|
-
|
11
|
-
context 'input path is a directory' do
|
12
|
-
let(:input_path) { 'spec/images' }
|
13
|
-
let(:output_filename) { 'pif' }
|
14
|
-
|
15
|
-
it 'find two png images' do
|
16
|
-
expect(subject.count).to eq(2)
|
17
|
-
expect(subject.first.input).to eq('spec/images/foo.png')
|
18
|
-
expect(subject.first.output).to eq('spec/images/piffoo.png')
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
context 'input path is an image' do
|
23
|
-
context 'output path is available' do
|
24
|
-
let(:input_path) { 'spec/images/foo.png' }
|
25
|
-
let(:output_filename) { 'paf' }
|
26
|
-
|
27
|
-
it 'find the correct png image' do
|
28
|
-
expect(subject.count).to eq(1)
|
29
|
-
expect(subject.first.input).to eq('spec/images/foo.png')
|
30
|
-
expect(subject.first.output).to eq('spec/images/paf.png')
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'output path is not available' do
|
35
|
-
let(:input_path) { 'spec/images/foo.png' }
|
36
|
-
let(:output_filename) { 'foo' }
|
37
|
-
|
38
|
-
it 'find the correct png image' do
|
39
|
-
expect(subject.count).to eq(1)
|
40
|
-
expect(subject.first.output).to match %r(spec/images/foo_(\d{8})_(\d{6}).png)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe '#jpg_images' do
|
47
|
-
subject do
|
48
|
-
ShatteredMachine::Io.new(input_path, 'spec/images', output_filename).jpg_images
|
49
|
-
end
|
50
|
-
|
51
|
-
context 'input path is a directory' do
|
52
|
-
let(:input_path) { 'spec/images' }
|
53
|
-
let(:output_filename) { 'pouf' }
|
54
|
-
|
55
|
-
it 'find four jpg images' do
|
56
|
-
expect(subject.count).to eq(4)
|
57
|
-
expect(subject.first.input).to eq('spec/images/fuzz.JPG')
|
58
|
-
expect(subject.first.output).to eq('spec/images/pouffuzz.png')
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
context 'input path is an image' do
|
63
|
-
let(:input_path) { 'spec/images/foo.jpg' }
|
64
|
-
let(:output_filename) { 'pouet' }
|
65
|
-
|
66
|
-
it 'find the correct jpg image' do
|
67
|
-
expect(subject.count).to eq(1)
|
68
|
-
expect(subject.first.input).to eq('spec/images/foo.jpg')
|
69
|
-
expect(subject.first.output).to eq('spec/images/pouet.png')
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
data/spec/pixel_sorter_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
RSpec.describe ShatteredMachine::PixelSorter do
|
6
|
-
describe '#call' do
|
7
|
-
let(:output_file) { 'spec/images/sorter.png' }
|
8
|
-
let(:input_file) { 'spec/images/foo.png' }
|
9
|
-
let(:io) do
|
10
|
-
ShatteredMachine::Io.new(input_file, 'spec/images', 'sorter')
|
11
|
-
end
|
12
|
-
let(:in_img) { io.png_images.first.input }
|
13
|
-
let(:out_img) { io.png_images.first.output }
|
14
|
-
subject { ShatteredMachine::PixelSorter.new.call(in_img, out_img) }
|
15
|
-
|
16
|
-
after do
|
17
|
-
File.delete(output_file) if File.exist?(output_file)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'sort image' do
|
21
|
-
subject
|
22
|
-
expect(File.exist?(output_file)).to be true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/spec/sampler_spec.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
RSpec.describe ShatteredMachine::Sampler do
|
6
|
-
describe 'ALL_ALGORITHMS' do
|
7
|
-
subject { ShatteredMachine::Sampler::ALL_ALGORITHMS }
|
8
|
-
it 'returns all algorithm available in sampler' do
|
9
|
-
expect(subject).to eq ['brush', 'change_byte', 'defect', 'exchange', 'slim', 'transpose', 'wrong_filter']
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
describe '#call' do
|
14
|
-
let(:created_files) do
|
15
|
-
%w[sample_exchange_average.png sample_exchange_up.png sample_slim_up_to_down.png sample_transpose_sub.png
|
16
|
-
sample_wrong_filter_paeth.png sample_exchange_none.png sample_slim_down_to_up.png sample_transpose_average.png
|
17
|
-
sample_transpose_up.png sample_wrong_filter_sub.png sample_change_byte.png sample_exchange_paeth.png
|
18
|
-
sample_slim_left_to_right.png sample_transpose_none.png sample_wrong_filter_average.png
|
19
|
-
sample_wrong_filter_up.png sample_defect.png sample_exchange_sub.png sample_slim_right_to_left.png
|
20
|
-
sample_transpose_paeth.png sample_wrong_filter_none.png sample_brush_horizontal_inverted.png
|
21
|
-
sample_brush_horizontal.png sample_brush_vertical_inverted.png sample_brush_vertical.png]
|
22
|
-
end
|
23
|
-
let(:output_file) { 'spec/images/sample.png' }
|
24
|
-
let(:input_file) { 'spec/images/foo.png' }
|
25
|
-
let(:io) { ShatteredMachine::Io.new(input_file, 'spec/images', 'sample') }
|
26
|
-
subject { ShatteredMachine::Sampler.new(io).call }
|
27
|
-
|
28
|
-
def output_image_full_path(file)
|
29
|
-
"spec/images/#{file}"
|
30
|
-
end
|
31
|
-
|
32
|
-
after do
|
33
|
-
created_files.each do |file|
|
34
|
-
File.delete(output_image_full_path(file)) if File.exist?(output_image_full_path(file))
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'call sampler' do
|
39
|
-
subject
|
40
|
-
created_files.each do |file|
|
41
|
-
expect(File.exist?(output_image_full_path(file))).to be true
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/spec/slim_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
RSpec.describe ShatteredMachine::Slim do
|
6
|
-
describe '#call' do
|
7
|
-
let(:output_file) { 'spec/images/slim.png' }
|
8
|
-
let(:input_file) { 'spec/images/foo.png' }
|
9
|
-
let(:io) do
|
10
|
-
ShatteredMachine::Io.new(input_file, 'spec/images', 'slim')
|
11
|
-
end
|
12
|
-
let(:in_img) { io.png_images.first.input }
|
13
|
-
let(:out_img) { io.png_images.first.output }
|
14
|
-
subject { ShatteredMachine::Slim.new.call(in_img, out_img) }
|
15
|
-
|
16
|
-
after do
|
17
|
-
File.delete(output_file) if File.exist?(output_file)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'slim image' do
|
21
|
-
subject
|
22
|
-
expect(File.exist?(output_file)).to be true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.configure do |config|
|
4
|
-
config.expect_with :rspec do |expectations|
|
5
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
6
|
-
end
|
7
|
-
|
8
|
-
config.mock_with :rspec do |mocks|
|
9
|
-
mocks.verify_partial_doubles = true
|
10
|
-
end
|
11
|
-
|
12
|
-
config.shared_context_metadata_behavior = :apply_to_host_groups
|
13
|
-
|
14
|
-
$LOAD_PATH.unshift File.expand_path('..', __dir__)
|
15
|
-
require 'lib/shattered_machine/converter'
|
16
|
-
require 'lib/shattered_machine/brush'
|
17
|
-
require 'lib/shattered_machine/change_byte'
|
18
|
-
require 'lib/shattered_machine/defect'
|
19
|
-
require 'lib/shattered_machine/exchange'
|
20
|
-
require 'lib/shattered_machine/io'
|
21
|
-
require 'lib/shattered_machine/glitcher'
|
22
|
-
require 'lib/shattered_machine/pixel_sorter'
|
23
|
-
require 'lib/shattered_machine/sampler'
|
24
|
-
require 'lib/shattered_machine/slim'
|
25
|
-
require 'lib/shattered_machine/transpose'
|
26
|
-
require 'lib/shattered_machine/wrong_filter'
|
27
|
-
end
|
data/spec/transpose_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
RSpec.describe ShatteredMachine::Transpose do
|
6
|
-
describe '#call' do
|
7
|
-
let(:output_file) { 'spec/images/transpose.png' }
|
8
|
-
let(:input_file) { 'spec/images/foo.png' }
|
9
|
-
let(:io) do
|
10
|
-
ShatteredMachine::Io.new(input_file, 'spec/images', 'transpose')
|
11
|
-
end
|
12
|
-
let(:in_img) { io.png_images.first.input }
|
13
|
-
let(:out_img) { io.png_images.first.output }
|
14
|
-
subject { ShatteredMachine::Transpose.new.call(in_img, out_img) }
|
15
|
-
|
16
|
-
after do
|
17
|
-
File.delete(output_file) if File.exist?(output_file)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'transpose image' do
|
21
|
-
subject
|
22
|
-
expect(File.exist?(output_file)).to be true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/spec/wrong_filter_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
RSpec.describe ShatteredMachine::WrongFilter do
|
6
|
-
describe '#call' do
|
7
|
-
let(:output_file) { 'spec/images/wrong_filter.png' }
|
8
|
-
let(:input_file) { 'spec/images/foo.png' }
|
9
|
-
let(:io) do
|
10
|
-
ShatteredMachine::Io.new(input_file, 'spec/images', 'wrong_filter')
|
11
|
-
end
|
12
|
-
let(:in_img) { io.png_images.first.input }
|
13
|
-
let(:out_img) { io.png_images.first.output }
|
14
|
-
subject { ShatteredMachine::WrongFilter.new.call(in_img, out_img) }
|
15
|
-
|
16
|
-
after do
|
17
|
-
File.delete(output_file) if File.exist?(output_file)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'wrong filter image' do
|
21
|
-
subject
|
22
|
-
expect(File.exist?(output_file)).to be true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|