capybara-screenshot-diff 0.5.2 → 0.5.3
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
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 4918e7dba3e123055b2c5aae345fce7dd8a1219d
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 662f6f68099b888e068a62ec18454ddbcdf2adf6
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 6929b38a90048524ec74c867f93a2b14160c34cae83d325963bfefd0bbd28a134e9f3471360b3649226b33e43414d60da35ccab499d4101fddac08688eed91ab
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 3638b34d359a68c75eaaa49593396efc227383126259b95ad5af12b6e75103164bd9b7f22485cf97831f83415defcb8f5072923de6cdbfedb8b450836ff692e9
         
     | 
| 
         @@ -97,9 +97,10 @@ module ActionDispatch 
     | 
|
| 
       97 
97 
     | 
    
         | 
| 
       98 
98 
     | 
    
         
             
                teardown do
         
     | 
| 
       99 
99 
     | 
    
         
             
                  if Capybara::Screenshot::Diff.enabled && @test_screenshots
         
     | 
| 
       100 
     | 
    
         
            -
                     
     | 
| 
      
 100 
     | 
    
         
            +
                    test_screenshot_errors =
         
     | 
| 
      
 101 
     | 
    
         
            +
                      @test_screenshots.map { |args| assert_image_not_changed(*args) }.compact
         
     | 
| 
      
 102 
     | 
    
         
            +
                    fail(test_screenshot_errors.join("\n\n")) if test_screenshot_errors.any?
         
     | 
| 
       101 
103 
     | 
    
         
             
                  end
         
     | 
| 
       102 
     | 
    
         
            -
                  fail(@test_screenshot_errors.join("\n\n")) if @test_screenshot_errors
         
     | 
| 
       103 
104 
     | 
    
         
             
                end
         
     | 
| 
       104 
105 
     | 
    
         | 
| 
       105 
106 
     | 
    
         
             
                def screenshot_section(name)
         
     | 
| 
         @@ -227,8 +228,7 @@ EOF 
     | 
|
| 
       227 
228 
     | 
    
         
             
                def assert_image_not_changed(caller, name, file_name, committed_file_name, new_name, org_name)
         
     | 
| 
       228 
229 
     | 
    
         
             
                  if Capybara::Screenshot::Diff::ImageCompare.compare(committed_file_name, file_name,
         
     | 
| 
       229 
230 
     | 
    
         
             
                      Capybara::Screenshot.window_size)
         
     | 
| 
       230 
     | 
    
         
            -
                     
     | 
| 
       231 
     | 
    
         
            -
                      "Screenshot does not match for '#{name}'\n#{file_name}\n#{org_name}\n#{new_name}\nat #{caller}"
         
     | 
| 
      
 231 
     | 
    
         
            +
                    "Screenshot does not match for '#{name}'\n#{file_name}\n#{org_name}\n#{new_name}\nat #{caller}"
         
     | 
| 
       232 
232 
     | 
    
         
             
                  end
         
     | 
| 
       233 
233 
     | 
    
         
             
                end
         
     | 
| 
       234 
234 
     | 
    
         
             
              end
         
     | 
| 
         @@ -99,8 +99,8 @@ module Capybara 
     | 
|
| 
       99 
99 
     | 
    
         | 
| 
       100 
100 
     | 
    
         
             
                    def find_diff_rectangle(org_img, new_img)
         
     | 
| 
       101 
101 
     | 
    
         
             
                      top = bottom = nil
         
     | 
| 
       102 
     | 
    
         
            -
                      left = org_img.width
         
     | 
| 
       103 
     | 
    
         
            -
                      right =  
     | 
| 
      
 102 
     | 
    
         
            +
                      left = org_img.width - 1
         
     | 
| 
      
 103 
     | 
    
         
            +
                      right = 0
         
     | 
| 
       104 
104 
     | 
    
         
             
                      org_img.height.times do |y|
         
     | 
| 
       105 
105 
     | 
    
         
             
                        (0...left).find do |x|
         
     | 
| 
       106 
106 
     | 
    
         
             
                          next if org_img[x, y] == new_img[x, y]
         
     | 
| 
         @@ -118,7 +118,7 @@ module Capybara 
     | 
|
| 
       118 
118 
     | 
    
         
             
                        end
         
     | 
| 
       119 
119 
     | 
    
         
             
                      end
         
     | 
| 
       120 
120 
     | 
    
         
             
                      (org_img.height - 1).step(bottom + 1, -1).find do |y|
         
     | 
| 
       121 
     | 
    
         
            -
                        ( 
     | 
| 
      
 121 
     | 
    
         
            +
                        (left..right).find do |x|
         
     | 
| 
       122 
122 
     | 
    
         
             
                          bottom = y if org_img[x, y] != new_img[x, y]
         
     | 
| 
       123 
123 
     | 
    
         
             
                        end
         
     | 
| 
       124 
124 
     | 
    
         
             
                      end
         
     |