dotdiff 3.0.0-java → 3.0.1-java

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
  SHA256:
3
- metadata.gz: 3c84511842aad634a5b0a37f06b70a5cd00ff007443e0517493530172907ccae
4
- data.tar.gz: a0b6676992de893aec44592fff36b9f74d40d0844b6a8c7c2c02636b793f23c8
3
+ metadata.gz: 71b526f51b6093e3f063d2f815732d847ecf1d7291a91a2d1583ed14dc3ef4a8
4
+ data.tar.gz: e3c1b43efb9fa443ccbd9046dc1e6f955cdaf64ae3632924a16eda32e9f54306
5
5
  SHA512:
6
- metadata.gz: 07357ed91bcddd8863dd9e7543b27ebdbec1ad5d44a243ad00e1f4243473006b18ad1ac50c78860a6846494de4a4b8bc3d8c238930f36453764fb66603337369
7
- data.tar.gz: a5bff90cf808780185d4f7759ca283731074c4e40d5efc4ceb2bcbcd1bf18197e2df8b043671ee1423a0a1cefc5b32315832e40781048afa2717cc06a549a09b
6
+ metadata.gz: 4ccb5dc9b760784bdb78e4beac587dcc8a6f90773a7e5a5fcf5b5bc4edec21e16e6457f9c7ba1185c09b988175e8c08db873aa98810f9ede037653f989001d9d
7
+ data.tar.gz: f8e2d98a43bbe5d5ed63a14195d5b592aaca31405c2a6823fb191e670ca5ebdaaa14fcf895ed37f637cfb02fb1b3287cf5b4834f900eedac26d922c3fcded070
@@ -11,12 +11,30 @@ module DotDiff
11
11
  end
12
12
 
13
13
  def result
14
+ comparer = build_comparer
15
+
16
+ if comparer.nil?
17
+ raise ArgumentError, "Unknown element class received: #{element.class.name}"
18
+ end
19
+
20
+ passed, msg = comparer.run
21
+ write_failure_imgs(comparer.new_image_path) if !passed && DotDiff.failure_image_path
22
+
23
+ [passed, msg]
24
+ end
25
+
26
+ private
27
+
28
+ def write_failure_imgs(new_image_path)
29
+ FileUtils.mkdir_p(snapshot.failure_path)
30
+ FileUtils.mv(new_image_path, snapshot.new_file, force: true)
31
+ end
32
+
33
+ def build_comparer
14
34
  if element.is_a?(Capybara::Session)
15
- DotDiff::Comparible::PageComparer.run(snapshot, nil)
35
+ DotDiff::Comparible::PageComparer.new(snapshot, nil)
16
36
  elsif element.is_a?(Capybara::Node::Base)
17
- DotDiff::Comparible::ElementComparer.run(snapshot, ElementMeta.new(page, element))
18
- else
19
- raise ArgumentError, "Unknown element class received: #{element.class.name}"
37
+ DotDiff::Comparible::ElementComparer.new(snapshot, ElementMeta.new(page, element))
20
38
  end
21
39
  end
22
40
  end
@@ -14,14 +14,13 @@ module DotDiff
14
14
 
15
15
  private
16
16
 
17
- attr_reader :snapshot, :element_meta, :new_image
17
+ attr_reader :snapshot, :element_meta
18
18
 
19
19
  def compare(compare_to_image)
20
- @new_image = compare_to_image
21
20
  return [false, img_container.dimensions_mismatch_msg] unless img_container.both_images_same_dimensions?
22
21
 
23
22
  cmd = CommandWrapper.new
24
- cmd.run(snapshot.basefile, new_image, snapshot.diff_file)
23
+ cmd.run(snapshot.basefile, new_image_path, snapshot.diff_file)
25
24
  return [cmd.passed?, cmd.message] if cmd.failed?
26
25
 
27
26
  calculate_result(cmd.pixels)
@@ -34,23 +33,15 @@ module DotDiff
34
33
  diff_pixels
35
34
  )
36
35
 
37
- passed = calc.under_threshold?
38
- write_failure_imgs if !passed && DotDiff.failure_image_path
39
-
40
- [passed, calc.message]
36
+ [calc.under_threshold?, calc.message]
41
37
  end
42
38
 
43
39
  def img_container
44
40
  @img_container ||= DotDiff::Image::Container.new(
45
41
  snapshot.basefile,
46
- new_image
42
+ new_image_path
47
43
  )
48
44
  end
49
-
50
- def write_failure_imgs
51
- FileUtils.mkdir_p(snapshot.failure_path)
52
- FileUtils.mv(new_image, snapshot.new_file, force: true)
53
- end
54
45
  end
55
46
  end
56
47
  end
@@ -14,6 +14,10 @@ module DotDiff
14
14
  end
15
15
  end
16
16
 
17
+ def new_image_path
18
+ snapshot.cropped_file
19
+ end
20
+
17
21
  private
18
22
 
19
23
  def take_snapshot_and_crop
@@ -13,6 +13,10 @@ module DotDiff
13
13
  compare(snapshot.fullscreen_file)
14
14
  end
15
15
  end
16
+
17
+ def new_image_path
18
+ snapshot.fullscreen_file
19
+ end
16
20
  end
17
21
  end
18
22
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DotDiff
4
- VERSION = '3.0.0'
4
+ VERSION = '3.0.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dotdiff
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: java
6
6
  authors:
7
7
  - Jon Normington
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-21 00:00:00.000000000 Z
11
+ date: 2021-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement