Module: MobyBehaviour::QT::Find
- Includes:
- Behaviour
- Defined in:
- lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb
Overview
description
Defines methods to find test objects and scroll them to the display
behaviour
QtFind
requires
testability-driver-qt-sut-plugin
input_type
*
sut_type
qt
sut_version
*
objects
*
Instance Method Summary collapse
-
#find_and_center(find_hash = {}) ⇒ Object
nodoc TODO: fix this.
Methods included from Behaviour
Instance Method Details
#find_and_center(find_hash = {}) ⇒ Object
nodoc
TODO: fix this
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb', line 53 def find_and_center (find_hash = {}) begin search_result = find(find_hash) ## Calculate Center myWindow = search_result.sut.application.find(:parent => 0, :isWindow => "true") # throws multiple found exeptions window_width = myWindow.attribute('width').to_i/2 window_height = myWindow.attribute('height').to_i/2 window_x = myWindow.attribute('x_absolute').to_i + window_width.to_i window_y = myWindow.attribute('y_absolute').to_i + window_height.to_i ## flick_to (center) search_result.flick_to(window_x.to_i, window_y.to_i) rescue Exception => e ##$logger.behaviour "FAIL;Failed to find test object.;#{id.to_s};sut;{};find;" << (find_hash.kind_of?(Hash) ? find_hash.inspect : find_hash.class.to_s) ## Rescue from center and flick raise e end $logger.behaviour "PASS;Test object found and centered.;#{id.to_s};sut;{};application;" << find_hash.inspect search_result end |