Sha256: bcdfec5f67d95a1db21a696d23d0fe03b5f842c4493e5d3fe738811f564831ee

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

# feature tests for screen capture

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
require 'unittests/setup'
require 'watir-classic/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

1 entries across 1 versions & 1 rubygems

Version Path
watir-classic-3.0.0 unittests/other/screen_capture_test.rb