Sha256: cf68345d406ef71ea0c6a37b84df84926a61bb5d6ab53093bc370e12192dd3c2

Contents?: true

Size: 1.36 KB

Versions: 32

Compression:

Stored size: 1.36 KB

Contents

# feature tests for screen capture

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
require 'unittests/setup'
require 'watir/screen_capture'

class TC_Capture< Test::Unit::TestCase
  tags :must_be_visible
  include Watir
  include Watir::ScreenCapture
  
  def setup
    delete_captured_files( [ 'jpeg1.jpg' , 'jpeg2.jpg' , 'bmp1.bmp', 'bmp2.bmp' ] )
    browser.goto($htmlRoot + 'buttons1.html' )
    @file_list = []       
  end
  
  def teardown
    delete_captured_files
  end
  
  def delete_captured_files(files=nil )
    files = @file_list unless files
    files.each do |f|
      File.delete( f) if FileTest.exists?( f)
    end
  end
  
  def test_jpeg
    file_name= 'jpeg1.jpg'
    @file_list << file_name
    screen_capture( file_name  )
    assert(FileTest.exist?( file_name) )
    
    file_name= 'jpeg2.jpg'
    @file_list << file_name
    screen_capture( file_name , true  )   # just the active window
    assert(FileTest.exist?( file_name) )
  end
  
  def test_bmp
    file_name= 'bmp1.bmp'
    @file_list << file_name
    screen_capture( file_name , false, true )
    assert(FileTest.exist?( file_name ) )
    
    file_name= 'bmp2.bmp'
    @file_list << file_name
    screen_capture( file_name , true , true )   # just the active window
    assert(FileTest.exist?( file_name) ) 
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
watir-3.0.0.rc3 unittests/other/screen_capture_test.rb
watir-3.0.0.rc2 unittests/other/screen_capture_test.rb
watir-3.0.0.rc1 unittests/other/screen_capture_test.rb
watir-2.0.4 unittests/other/screen_capture_test.rb
watir-2.0.3 unittests/other/screen_capture_test.rb
watir-2.0.2 unittests/other/screen_capture_test.rb
watir-2.0.2.rc1 unittests/other/screen_capture_test.rb
watir-2.0.1 unittests/other/screen_capture_test.rb
watir-2.0.0 unittests/other/screen_capture_test.rb
watir-2.0.0.rc3 unittests/other/screen_capture_test.rb
watir-2.0.0.rc2 unittests/other/screen_capture_test.rb
watir-1.9.2 unittests/other/screen_capture_test.rb
watir-1.9.2.rc1 unittests/other/screen_capture_test.rb
watir-1.9.1 unittests/other/screen_capture_test.rb
watir-1.9.1.rc1 unittests/other/screen_capture_test.rb
watir-1.9.0 unittests/other/screen_capture_test.rb
watir-1.9.0.rc7 unittests/other/screen_capture_test.rb
watir-1.9.0.rc6 unittests/other/screen_capture_test.rb
watir-1.9.0.rc5 unittests/other/screen_capture_test.rb
watir-1.9.0.rc4 unittests/other/screen_capture_test.rb