Method: Roi#find_frame_displayed

Defined in:
lib/roi/roi.rb

#find_frame_displayed(frames, start_time, args = {}) ⇒ Object

Public: Finds the frame in which the given Roi verifies.

Corresponds to: api_find_<ROI TYPE>_frame

frames - Array of frames to search, each being a Hash with the following keys:

:filename   - String full path to the frame on the server.
:capturedAt - Time at which the frame was captured.
:keep       - Boolean indicating whether to keep the frame if cleanup is true. Initializes false.

start_time - Time at which frame capture began. starting_frame - Integer index of frame at which to start evaluation (default: 0). timeout - Integer total milliseconds to allow before timing out (default: nil).

If default, all frames will be searched.

scale - Boolean if the larger image should be scaled to the size of the smaller image (default: false).

Applies to image ROIs only.

verifies_for - Integer total milliseconds for which the ROI must continuously verify in order to be counted

successful (default: 0).
If default, the ROI must only verify once.

priority - Symbol evaluation priority used to throttle CPU usage (default: :normal):

:critical   - Sleep 10 ms between intensive tasks (USE SPARINGLY)
:high       - Sleep 100 ms between intensive tasks
:normal     - Sleep 1 second between intensive tasks
:low        - Sleep 10 seconds between intensive tasks
:background - Sleep 1 minute between intensive tasks (USE SPARINGLY)

log_every - Integer total milliseconds between logs (default: 1000). report - Boolean indicating whether to report measurements to ITMS (default: false).

Returns the Integer index of the matching frame.



578
579
580
581
582
583
584
585
586
587
588
589
590
591
# File 'lib/roi/roi.rb', line 578

def find_frame_displayed(frames, start_time, args={})
  logger.info("Finding frame where #{self.class.name} is displayed")
  args[:with_last_frame] = true
  args[:report] = false
  if frames.count < 2
    default_timeout = 30.sec
  else
    default_timeout = test_case.get_time_delta(frames.first[:capturedAt], frames.last[:capturedAt])
  end
  args[:timeout] ||= default_timeout
  frame(frames, start_time, args) do |frame, last_frame|
    displayed?(:frame => frame, :last_frame => last_frame, :set_roi_options => args)
  end
end