diffux-core 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a2c80d765011e86eb26552f27fc0adf5d0a3734
4
- data.tar.gz: 4c1d56255194b62fb86ea3987a05039d05745aaa
3
+ metadata.gz: 8f87e09961b1bd5d9f36a2786b657017f74828ba
4
+ data.tar.gz: bf099cf00f3310ca0589921fb050df0b3abc58d2
5
5
  SHA512:
6
- metadata.gz: 65ab14a6bbc40297d02db803dbed2eff6ef1a01e12f19b8fd22eedf98850d8b69390428ac81b1d18332215bd2870af399a0af8f301367b420ea7de9cd0bdfd3e
7
- data.tar.gz: 536cdd69c8b7b2fc654c04228ebd3cdc825e10dca950e32c2d6d0b2d3620c80ed74d450d465922cdde124f08adce7b294a3c9f1ec4a5e13c16441a6dc91a910f
6
+ metadata.gz: 02117d0af3500c1f63a60f26ebd7df4417e6c6665ab1de0a0f901f26c2819550b21a2ef065c292f62bd1a123605788b17800b78cf4dbf6fa1407879b9bd35084
7
+ data.tar.gz: b5bde1f2aa1844c1a3c8a30148d4884fcd359b3d00024242b4ad9486d988adeda78ca4f1490f762ccb166130a8ebf661a8ef46711d28d209e18ea76becf897e9
data/bin/diffux-compare CHANGED
@@ -48,7 +48,7 @@ comparison = Diffux::SnapshotComparer.new(
48
48
  ).compare!
49
49
 
50
50
  if img = comparison[:diff_image]
51
- img.save(options[:outfile])
51
+ img.save(options[:outfile], :fast_rgb)
52
52
  puts "DIFF: #{comparison[:diff_in_percent]}%"
53
53
  exit 10
54
54
  end
@@ -14,8 +14,24 @@ module Diffux
14
14
 
15
15
  # @return [Hash]
16
16
  def compare!
17
- sdiff = Diff::LCS.sdiff(to_array_of_arrays(@png_before),
18
- to_array_of_arrays(@png_after))
17
+ no_diff = {
18
+ diff_in_percent: 0,
19
+ diff_image: nil,
20
+ diff_clusters: []
21
+ }
22
+
23
+ # If these images are totally identical, we don't need to do any more
24
+ # work.
25
+ return no_diff if @png_before == @png_after
26
+
27
+ array_before = to_array_of_arrays(@png_before)
28
+ array_after = to_array_of_arrays(@png_after)
29
+
30
+ # If the arrays of arrays of colors are identical, we don't need to do any
31
+ # more work. This might happen if some of the headers are different.
32
+ return no_diff if array_before == array_after
33
+
34
+ sdiff = Diff::LCS.sdiff(array_before, array_after)
19
35
  cluster_finder = DiffClusterFinder.new(sdiff.size)
20
36
  sprite, all_comparisons = initialize_comparison_images(
21
37
  [@png_after.width, @png_before.width].max, sdiff.size)
@@ -1,4 +1,4 @@
1
1
  # Defines the gem version.
2
2
  module DiffuxCore
3
- VERSION = '0.0.4'
3
+ VERSION = '0.0.5'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diffux-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Lencioni
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-17 00:00:00.000000000 Z
12
+ date: 2015-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chunky_png