Class: MobyCommand::WidgetCommand
- Inherits:
-
CommandData
- Object
- CommandData
- MobyCommand::WidgetCommand
- Defined in:
- lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb
Direct Known Subclasses
Constant Summary collapse
- VALID_OBJECT_TYPES =
class variable
[ nil, :Standard, :Graphics, :Application, :Action, :Web ]
Instance Method Summary collapse
-
#application_id(id) ⇒ Object
- Application id of the currently tested application == params id
- Id of the application == returns == raises ArgumentError
-
When the supplied id is not of type String.
-
#command_name(name) ⇒ Object
- Name of the command == params name
- Name of the command to be executed on the device (e.g. MouseClick) == returns == raises ArgumentError
-
When the supplied command_name is not of type String.
-
#command_params(params) ⇒ Object
- Command parameters == params params
- A Hash containing the parameters sent to the device as name/value pairs (e.g. button => 1) == returns == raises ArgumentError
-
When the supplied params is of type Hash.
-
#command_value(value) ⇒ Object
Command value which is passed on to the device as the value of the command.
-
#initialize(application_id = nil, object_id = nil, object_type = nil, command_name = nil, params = nil, value = nil, service = nil) ⇒ WidgetCommand
constructor
Constructs a new CommandParams object.
-
#object_type(type) ⇒ Object
- Object type of the target object == params type
- type of the Object == returns == raises ArgumentError
-
When the supplied type is not :Graphics or :Standard.
-
#require_response? ⇒ Boolean
Returns true if response required after command.
- #service(service) ⇒ Object
- #set_event_type(event_type) ⇒ Object
-
#set_object_id(id) ⇒ Object
- Object id of the target object == params id
- Id of the Object == returns == raises ArgumentError
-
When the supplied id is not of type String.
-
#set_require_response(response_required) ⇒ Object
Set true if response is expected from device side after command Has been completed.
-
#transitions_off ⇒ Object
Set transition flag off Will cause the events to be done on immediately.
-
#transitions_on ⇒ Object
Set transition flag on Will cause the events to be done on a delayed mode.
Constructor Details
#initialize(application_id = nil, object_id = nil, object_type = nil, command_name = nil, params = nil, value = nil, service = nil) ⇒ WidgetCommand
Constructs a new CommandParams object. CommandParams stores the details for the commands send to suts that operate using the tasCommand xml format. The controller creates an xml formatted operation request that will be forwarded to the sut being tested. Example: Given params: command_name = MouseClick, params = [button => ‘1’] xml command: <Command name=“MouseClick” button=“1”>
params
- command_name
-
Name of the command to be executed on the device (e.g. MouseClick)
- params
-
A Hash containing the parameters sent to the device as name/value pairs (e.g. button => 1)
returns
- CommandParams
-
New CommandParams object
raises
- ArgumentError
-
When the supplied params are invalid type (initially can be nil)
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb', line 41 def initialize( application_id = nil, object_id = nil, object_type = nil, command_name = nil, params = nil, value=nil, service = nil ) application_id(application_id ) set_object_id( object_id ) object_type( object_type ) command_name( command_name ) command_params( params ) command_value( value ) service( service ) transitions_on self end |
Instance Method Details
#application_id(id) ⇒ Object
Application id of the currently tested application
params
- id
-
Id of the application
returns
raises
- ArgumentError
-
When the supplied id is not of type String
110 111 112 113 114 115 116 |
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb', line 110 def application_id( id ) id.check_type [ NilClass, String ], 'wrong argument type $1 for application id (expected $2)' @_application_id = id end |
#command_name(name) ⇒ Object
Name of the command
params
- name
-
Name of the command to be executed on the device (e.g. MouseClick)
returns
raises
- ArgumentError
-
When the supplied command_name is not of type String
152 153 154 155 156 157 158 |
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb', line 152 def command_name( name ) name.check_type [ NilClass, String ], 'wrong argument type $1 for command name (expected $2)' @_command_name = name end |
#command_params(params) ⇒ Object
Command parameters
params
- params
-
A Hash containing the parameters sent to the device as name/value pairs (e.g. button => 1)
returns
raises
- ArgumentError
-
When the supplied params is of type Hash
166 167 168 169 170 171 172 |
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb', line 166 def command_params( params ) params.check_type [ NilClass, Hash ], 'wrong argument type $1 for command parameters (expected $2)' @_command_params = params end |
#command_value(value) ⇒ Object
Command value which is passed on to the device as the value of the command. Example: <Command name=TypeText>Text to be written</Command> where the “Text to be written” would be the value String passed as parameter to this method.
params
- value
-
A String that will be passed to the device in the value field in the command xml, or an Array containing data for multiple step commands
returns
raises
- ArgumentError
-
When the supplied params not of type String or Array or nil
182 183 184 185 186 187 188 |
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb', line 182 def command_value( value ) value.check_type [ NilClass, String, Array ], 'wrong argument type $1 for command value (expected $2)' @_command_value = value end |
#object_type(type) ⇒ Object
Object type of the target object
params
- type
-
type of the Object
returns
raises
- ArgumentError
-
When the supplied type is not :Graphics or :Standard
138 139 140 141 142 143 144 |
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb', line 138 def object_type( type ) raise TypeError.new("Given object type #{ type.inspect } is not valid.") unless VALID_OBJECT_TYPES.include?( type ) @_object_type = type end |
#require_response? ⇒ Boolean
Returns true if response required after command.
98 99 100 101 102 |
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb', line 98 def require_response? @_response_required end |
#service(service) ⇒ Object
63 64 65 66 67 |
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb', line 63 def service( service ) @_service = service end |
#set_event_type(event_type) ⇒ Object
190 191 192 193 194 195 196 |
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb', line 190 def set_event_type( event_type ) #event_type.check_type [ NilClass, String ], 'wrong argument type $1 for event type (expected $2)' @_event_type = event_type end |
#set_object_id(id) ⇒ Object
Object id of the target object
params
- id
-
Id of the Object
returns
raises
- ArgumentError
-
When the supplied id is not of type String
124 125 126 127 128 129 130 |
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb', line 124 def set_object_id( id ) id.check_type [ NilClass, String ], 'wrong argument type $1 for object id (expected $2)' @_object_id = id end |
#set_require_response(response_required) ⇒ Object
Set true if response is expected from device side after command Has been completed.
params
bool: True if response needed
91 92 93 94 95 |
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb', line 91 def set_require_response( response_required ) @_response_required = response_required end |
#transitions_off ⇒ Object
Set transition flag off Will cause the events to be done on immediately
81 82 83 84 85 |
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb', line 81 def transitions_off @_transitions = false end |
#transitions_on ⇒ Object
Set transition flag on Will cause the events to be done on a delayed mode.
72 73 74 75 76 |
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb', line 72 def transitions_on @_transitions = true end |