Class: Applitools::FixedCutProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/applitools/core/fixed_cut_provider.rb

Overview

Provides ‘cut’ method which is used to cut screen shots

Instance Method Summary collapse

Constructor Details

#initialize(crop_region, header, left, right, footer) ⇒ FixedCutProvider

Creates a FixedCutProvider instance

Examples:

Creates cut provider by a Region

Applitools::FixedCutProvider.new Applitools::Region.new(20,20, 300, 300)

Creates cut provider by a set of fields

Applitools::FixedCutProvider.new 20, 20, 300, 300

Parameters:

  • crop_region (Applitools::Region)

    Outside space of the region will be cropped

  • header (Integer)

    A top field to crop

  • footer (Integer)

    A bottom field to crop

  • left (Integer)

    A left field to crop

  • right (Integer)

    A right field to crop



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/applitools/core/fixed_cut_provider.rb', line 18

def initialize(*args)
  self.region = nil
  self.left = 0
  self.header = 0
  self.right = 0
  self.footer = 0
  case args.length
  when 1
    initialize_by_rectangle(args[0])
  when 4
    initialize_by_fields(*args)
  end
end

Instance Method Details

#cut(image) ⇒ Object



32
33
34
# File 'lib/applitools/core/fixed_cut_provider.rb', line 32

def cut(image)
  Applitools::Utils::ImageUtils.cut! image, crop_region(image)
end