wraith 1.3.6 → 1.3.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/lib/wraith/thumbnails.rb +5 -0
- data/lib/wraith/version.rb +1 -1
- data/spec/wraith_spec.rb +13 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4ef3702111da955cdc52b3cafc7393003ada3d73
|
|
4
|
+
data.tar.gz: 4c0a4caa2ab48825a3551fa574e3a7cb3aa9492d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e01746b3ad8b4327425c35c3cf49880a538b4380ac573a9aa280273613b26261d574f6fc11f70bbe8a5f8a14e89719205fd206f870d4c48d7cecf87d460cf612
|
|
7
|
+
data.tar.gz: b6d2f51c5c97eee922adbe00d34922d0cc96a8673f20643e81880e937557e23fe7977b3125fc368ad6710469c99093cd8afeae36d09ec83d87812361968b8d23
|
data/lib/wraith/thumbnails.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'wraith'
|
|
2
2
|
require 'parallel'
|
|
3
|
+
require 'fileutils'
|
|
3
4
|
|
|
4
5
|
class Wraith::Thumbnails
|
|
5
6
|
attr_reader :wraith
|
|
@@ -20,6 +21,10 @@ class Wraith::Thumbnails
|
|
|
20
21
|
end
|
|
21
22
|
|
|
22
23
|
def thumbnail_image(png_path, output_path)
|
|
24
|
+
unless File.directory?(File.dirname(output_path))
|
|
25
|
+
FileUtils.mkdir_p(File.dirname(output_path));
|
|
26
|
+
end
|
|
27
|
+
|
|
23
28
|
`convert #{png_path} -thumbnail 200 -crop 200x200+0+0 #{output_path}`
|
|
24
29
|
end
|
|
25
30
|
end
|
data/lib/wraith/version.rb
CHANGED
data/spec/wraith_spec.rb
CHANGED
|
@@ -51,4 +51,17 @@ describe Wraith do
|
|
|
51
51
|
end
|
|
52
52
|
Then { diff_image_size[0] == 320 }
|
|
53
53
|
end
|
|
54
|
+
|
|
55
|
+
context 'When generating tumbnails' do
|
|
56
|
+
When do
|
|
57
|
+
wraith.engine.each do |_type, engine|
|
|
58
|
+
saving.capture_page_image(engine, test_url1, 320, test_image1)
|
|
59
|
+
saving.capture_page_image(engine, test_url2, 320, test_image2)
|
|
60
|
+
end
|
|
61
|
+
Wraith::CropImages.new(config_name).crop_images
|
|
62
|
+
Wraith::CompareImages.new(config_name).compare_task(test_image1, test_image2, diff_image, data_txt)
|
|
63
|
+
Wraith::Thumbnails.new(config_name).generate_thumbnails()
|
|
64
|
+
end
|
|
65
|
+
Then { File.exists?('shots/thumbnails/test/test1.png') && File.exists?('shots/thumbnails/test/test2.png') && File.exists?('shots/thumbnails/test/test_diff.png') }
|
|
66
|
+
end
|
|
54
67
|
end
|