Module: MobyBehaviour::QT::Events
- Includes:
- Behaviour
- Defined in:
- lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb
Overview
description
Events specific behaviours
behaviour
QtEvents
requires
testability-driver-qt-sut-plugin
input_type
*
sut_type
qt
sut_version
*
objects
*;application
Instance Method Summary collapse
-
#disable_events ⇒ Object
description Disables event listening on the target.
-
#enable_events(filter_array = nil, params = {}) ⇒ Object
description Enable event listening.
-
#get_events ⇒ Object
description Gets event list occured since the enabling of events.
Methods included from Behaviour
Instance Method Details
#disable_events ⇒ Object
description
Disables event listening on the target
returns
NilClass
description: -
example: -
exceptions
Exception
description: In case of an error
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb', line 116 def disable_events begin command = plugin_command #in qt_behaviour command.command_name( 'DisableEvents' ) command.service( 'collectEvents' ) @sut.execute_command( command) @@_events_enabled = false rescue $logger.behaviour "FAIL;Failed disable_events.;#{ identity };disable_events;" raise $! end $logger.behaviour "PASS;Operation disable_events executed successfully.;#{ identity };disable_events;" nil end |
#enable_events(filter_array = nil, params = {}) ⇒ Object
description
Enable event listening. You can specify which events you want to listen for by including the names of those events separated by comma or integers if using user events. Use ALL if you want to listen for all events but be aware that there will be a lot of events. n The events listened need to be sent the object to which the enabling is done for e.g. sut.button.enable_events(‘ALL’) would listen to all events sent to the button. When disabling or getting the events the operation must be done to the same object.
arguments
filter_array
Array
description: Array of the event named to listen
example: ["Timer","MouseButtonPress","45677","67889"]
params
Hash
description: -
example: -
returns
NilClass
description: -
example: -
exceptions
Exception
description: In case of an error
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb', line 77 def enable_events(filter_array = nil, params = {}) begin command = plugin_command #in qt_behaviour command.command_name( 'EnableEvents' ) params_str = '' filter_array.each {|value| params_str << value << ','} if filter_array params['EventsToListen'] = params_str command.command_params( params ) command.service( 'collectEvents' ) @sut.execute_command( command) @@_events_enabled = true rescue $logger.behaviour "FAIL;Failed enable_events with refresh \"#{filter_array.to_s}\".;#{ identity };enable_events;" raise $! end $logger.behaviour "PASS;Operation enable_events executed successfully with refresh \"#{ filter_array.to_s }\".;#{ identity };enable_events;" nil end |
#get_events ⇒ Object
description
Gets event list occured since the enabling of events. The format of the XML string is the same as with the UI state. n
- b]NOTE:[/b
-
It is highly recommended to create a StateObject with result XML and access the data through appropriate API. n
See state_object method for more details.
returns
String
description: XML containing the details of the events logger since enable_events example: -
exceptions
Exception
description: In case of an error
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb', line 159 def get_events ret = nil begin command = plugin_command(true) #in qt_behaviour command.command_name( 'GetEvents' ) command.service( 'collectEvents' ) ret = @sut.execute_command( command) # TODO: how to parse the output? rescue $logger.behaviour "FAIL;Failed get_events.;#{ identity };get_events;" raise $! end $logger.behaviour "PASS;Operation get_events executed successfully.;#{ identity };get_events;" ret end |