Class: MobyCommand::QT_Command

Inherits:
CommandData
  • Object
show all
Defined in:
lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command_type = nil, btn_id = nil) ⇒ QT_Command

Constructs a new Touch CommandData object

params

btn_id

(optional) String, id for the button perform this command on

command_type

(optional) Symbol, defines the command to perform on the button

returns

Touch

New CommandData object

raises

ArgumentError

When the supplied command_type is invalid.



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 44

def initialize(command_type = nil, btn_id = nil)

	@@_valid_commands = [nil, :Press, :Hold, :Release,:Gesture, :Scroll, :Apicommand, :Tap, :Move, :ListStartedApps]
	@@_valid_directions = [nil, :Up, :Down, :Left,:Right]
	@@_valid_orientations = [nil,:Vertical, :Horizontal]

	command(command_type)    
	id(btn_id)
	
    self

end

Instance Attribute Details

#argumentsObject

Application command types Touch object = :Press Hold object = :Hold Release object = :Relase



34
35
36
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 34

def arguments
  @arguments
end

#methodObject

Application command types Touch object = :Press Hold object = :Hold Release object = :Relase



34
35
36
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 34

def method
  @method
end

Instance Method Details

#command(command_type) ⇒ Object

Defines the type of command this Touch CommandData object represents

params

command_type

Symbol, defines the command to perform on the application

returns

Touch

This CommandData object

raises

ArgumentError

When the supplied command_type is invalid.

Raises:

  • (ArgumentError)


65
66
67
68
69
70
71
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 65

def command(command_type)

	raise ArgumentError.new("Given command type '#{command_type.to_s}' is not valid.") unless @@_valid_commands.include?( command_type )
	@_command = command_type
	self

end

#delta(delta) ⇒ Object



93
94
95
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 93

def delta(delta)
	@_delta = delta
end

#direction(direction) ⇒ Object

Raises:

  • (ArgumentError)


122
123
124
125
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 122

def direction(direction)
	raise ArgumentError.new("Given direction type '#{direction.to_s}' is not valid.") unless @@_valid_directions.include?(direction)
	@_direction = direction
end

#distance(distance) ⇒ Object



106
107
108
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 106

def distance(distance)
	@_distance = distance
end

#get_commandObject



131
132
133
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 131

def get_command
	@_command
end

#get_deltaObject



89
90
91
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 89

def get_delta
	@_delta
end

#get_directionObject



127
128
129
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 127

def get_direction
	@_direction
end

#get_distanceObject



110
111
112
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 110

def get_distance
	@_distance
end

#get_idObject



144
145
146
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 144

def get_id
	@_id
end

#get_object_typeObject



139
140
141
142
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 139

def get_object_type
	return "" unless @_object_type 
	@_object_type 
end

#get_orientationObject



97
98
99
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 97

def get_orientation
	@_orientation
end

#get_speedObject



118
119
120
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 118

def get_speed
	@_speed
end

#get_tab_countObject



165
166
167
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 165

def get_tab_count
	@_tab_count
end

#get_xObject



153
154
155
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 153

def get_x
	@_x
end

#get_yObject



157
158
159
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 157

def get_y
	@_y
end

#id(btn_id) ⇒ Object

Defines the id this Touch CommandData object is associated with

params

btn_id

String, id of button to perform this command on

returns

Touch

This CommandData object

raises

ArgumentError

When btn_id is not nil, integer or numeric string

Raises:

  • (ArgumentError)


80
81
82
83
84
85
86
87
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 80

def id(btn_id)

	raise ArgumentError.new("The given object id must be nil, integer or a String.") unless btn_id == nil || btn_id.kind_of?(Integer) || (btn_id.kind_of?(String))

	@_id = btn_id.to_s
	self

end

#object_type(type) ⇒ Object



135
136
137
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 135

def object_type(type)
	@_object_type = type
end

#orientation(orientation) ⇒ Object

Raises:

  • (ArgumentError)


101
102
103
104
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 101

def orientation(orientation)
	raise ArgumentError.new("Given orientation type '#{orientation.to_s}' is not valid.") unless @@_valid_orientations.include?(orientation)
	@_orientation = orientation
end

#set_coordinates(x, y) ⇒ Object



148
149
150
151
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 148

def set_coordinates(x, y)
	@_x = x
	@_y = y
end

#speed(speed) ⇒ Object



114
115
116
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 114

def speed(speed)
	@_speed = speed
end

#tab_count(tab_count) ⇒ Object



161
162
163
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb', line 161

def tab_count(tab_count)
	@_tab_count = tab_count
end