testability-driver-qt-sut-plugin 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/installer/extconf.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/action.rb +5 -5
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb +174 -236
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/attribute.rb +3 -3
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/behaviour.rb +5 -5
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb +7 -7
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb +7 -7
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/file_transfer.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb +3 -3
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fixture.rb +5 -5
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/gesture.rb +73 -60
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb +3 -3
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/key_press.rb +6 -6
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/locale_db.rb +8 -8
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/method.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/multitouch.rb +348 -329
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/os.rb +5 -5
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/qt_api_method.rb +3 -3
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/record.rb +7 -7
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/screen_capture.rb +9 -9
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/sut.rb +79 -27
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb +3 -3
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/treewidgetitemcolumn.rb +5 -5
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/type_text.rb +3 -3
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/view_item.rb +5 -5
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/webkit.rb +13 -11
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/widget.rb +70 -67
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/configure_command.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/find_object.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/fixture.rb +2 -3
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/group.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/infologger_command.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/key_sequence.rb +3 -3
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/screen_capture.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/tap.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/widget.rb +30 -14
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/plugin.rb +8 -3
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/adapter.rb +160 -29
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb +6 -8
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/controller.rb +13 -2
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/find_object_generator.rb +50 -35
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/message_composer.rb +129 -95
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/widget.rb +4 -4
- data/xml/behaviour/qt.xml +8 -12
- metadata +53 -72
data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb
CHANGED
@@ -568,10 +568,10 @@ module MobyBehaviour
|
|
568
568
|
end
|
569
569
|
|
570
570
|
rescue Exception => e
|
571
|
-
|
571
|
+
$logger.log "behaviour","FAIL;Failed infologger \"#{params.to_s}\".;#{service};"
|
572
572
|
Kernel::raise e
|
573
573
|
end
|
574
|
-
|
574
|
+
$logger.log "behaviour","PASS;Operation infologger succeeded with params \"#{params.to_s}\".;#{service};"
|
575
575
|
ret
|
576
576
|
end
|
577
577
|
|
@@ -587,7 +587,7 @@ module MobyBehaviour
|
|
587
587
|
end
|
588
588
|
|
589
589
|
# enable hooking for performance measurement & debug logging
|
590
|
-
|
590
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
591
591
|
|
592
592
|
|
593
593
|
end
|
data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/key_press.rb
CHANGED
@@ -89,12 +89,12 @@ module MobyBehaviour
|
|
89
89
|
|
90
90
|
"Symbol #{ key.inspect } cannot be used due to no keymap defined for #{ @sut.id } in TDriver configuration file."
|
91
91
|
|
92
|
-
) if key.kind_of?( Symbol ) &&
|
92
|
+
) if key.kind_of?( Symbol ) && !$parameters[ @sut.id ].has_key?( :keymap )
|
93
93
|
|
94
94
|
@key_sequence = nil
|
95
95
|
if key.kind_of?( Symbol )
|
96
96
|
|
97
|
-
scancode =
|
97
|
+
scancode = $parameters[ @sut.id ][ :keymap ][ key, nil ]
|
98
98
|
scancode = scancode.hex if scancode.kind_of?( String )
|
99
99
|
# raise exception if value is other than fixnum
|
100
100
|
Kernel::raise ArgumentError.new( "Scan code for :%s not defined in keymap" % key ) unless scancode.kind_of?( Fixnum )
|
@@ -107,7 +107,7 @@ module MobyBehaviour
|
|
107
107
|
@key_sequence = []
|
108
108
|
key.get_sequence.each do | key_event |
|
109
109
|
|
110
|
-
tempcode =
|
110
|
+
tempcode = $parameters[ @sut.id ][ :keymap ][ key_event[ :value ], nil ]
|
111
111
|
tempcode = tempcode.hex if tempcode.kind_of?( String )
|
112
112
|
|
113
113
|
press_type = { :KeyDown => 'KeyPress', :KeyUp => 'KeyRelease' }.fetch( key_event[ :type ] ){ "KeyClick" }
|
@@ -132,19 +132,19 @@ module MobyBehaviour
|
|
132
132
|
|
133
133
|
rescue Exception => exception
|
134
134
|
|
135
|
-
|
135
|
+
$logger.log "behaviour" , "FAIL;Failed press_key with key \"#{ key }\".;#{ identity };press_key;"
|
136
136
|
Kernel::raise exception
|
137
137
|
|
138
138
|
end
|
139
139
|
|
140
|
-
|
140
|
+
$logger.log "behaviour" , "PASS;Operation press_key executed successfully with key \"#{ key }\".;#{ identity };press_key;"
|
141
141
|
|
142
142
|
nil
|
143
143
|
|
144
144
|
end
|
145
145
|
|
146
146
|
# enable hooking for performance measurement & debug logging
|
147
|
-
|
147
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
148
148
|
|
149
149
|
end
|
150
150
|
|
data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/locale_db.rb
CHANGED
@@ -86,17 +86,17 @@ module MobyBehaviour
|
|
86
86
|
#
|
87
87
|
def create_locale_db(path = "/", file = "*.qm", database_file = nil, column_names_map = {} )
|
88
88
|
|
89
|
-
db_type =
|
90
|
-
host =
|
91
|
-
database_file =
|
92
|
-
username =
|
93
|
-
password =
|
89
|
+
db_type = $parameters[ :localisation_db_type ]
|
90
|
+
host = $parameters[ :localisation_server_ip ]
|
91
|
+
database_file = $parameters[ :localisation_server_database_name ] if database_file.nil?
|
92
|
+
username = $parameters[ :localisation_server_username ]
|
93
|
+
password = $parameters[ :localisation_server_password ]
|
94
94
|
|
95
95
|
db_connection = MobyUtil::DBConnection.new( db_type, host, database_file, username, password )
|
96
|
-
table_name =
|
96
|
+
table_name = $parameters[ :sut_qt ][ :localisation_server_database_tablename, "" ]
|
97
97
|
|
98
98
|
begin
|
99
|
-
tmp_path =
|
99
|
+
tmp_path = $parameters[:tmp_folder] + "/locale_db_tmp"
|
100
100
|
rescue MobyUtil::ParameterNotFoundError
|
101
101
|
tmp_path = Dir.tmpdir + "/locale_db_tmp"
|
102
102
|
end
|
@@ -147,7 +147,7 @@ module MobyBehaviour
|
|
147
147
|
end
|
148
148
|
|
149
149
|
# enable hooking for performance measurement & debug logging
|
150
|
-
|
150
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
151
151
|
|
152
152
|
end # LocalisationDB
|
153
153
|
|
@@ -78,7 +78,7 @@ module MobyBehaviour
|
|
78
78
|
end
|
79
79
|
|
80
80
|
# enable hooking for performance measurement & debug logging
|
81
|
-
|
81
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
82
82
|
|
83
83
|
end
|
84
84
|
end
|
data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/multitouch.rb
CHANGED
@@ -46,347 +46,363 @@ module MobyBehaviour
|
|
46
46
|
|
47
47
|
include MobyBehaviour::QT::Behaviour
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
pinch_zoom({:type => :in, :speed => speed, :distance_1 => distance, :distance_2 => distance, :direction => direction, :differential => differential})
|
92
|
-
end
|
49
|
+
# == description
|
50
|
+
# Performs a pinch zoom in operation. The distance of the operation is
|
51
|
+
# is for both fingers. So a distance of 100 will be performed by both
|
52
|
+
# end points (fingers).
|
53
|
+
#
|
54
|
+
# == arguments
|
55
|
+
# speed
|
56
|
+
# Integer
|
57
|
+
# description: Speed of the operation in seconds
|
58
|
+
# example: 3
|
59
|
+
#
|
60
|
+
# distance
|
61
|
+
# Integer
|
62
|
+
# description: Distance of the pinch zoom
|
63
|
+
# example: 100
|
64
|
+
#
|
65
|
+
# direction
|
66
|
+
# Integer
|
67
|
+
# description: Direction of the pinch zoom in degrees 0-180
|
68
|
+
# example: 90
|
69
|
+
# Symbol
|
70
|
+
# description: Direction of the pinch zoom either :Horizontal or :Vertical
|
71
|
+
# example: :Horizontal
|
72
|
+
#
|
73
|
+
# differential
|
74
|
+
# Integer
|
75
|
+
# description: The difference from where the zoom starts or ends (how far apart are the fingers when starting the zoom)
|
76
|
+
# example: 10
|
77
|
+
#
|
78
|
+
# == returns
|
79
|
+
# NilClass
|
80
|
+
# description: -
|
81
|
+
# example: -
|
82
|
+
#
|
83
|
+
# == exceptions
|
84
|
+
# ArgumentError
|
85
|
+
# description: In case the given parameters are not valid.
|
86
|
+
#
|
87
|
+
# == info
|
88
|
+
# See method pinch_zoom
|
89
|
+
#
|
90
|
+
def pinch_zoom_in(speed, distance, direction, differential = 10)
|
93
91
|
|
94
|
-
|
95
|
-
# Performs a pinch zoom out operation. The distance of the operation is
|
96
|
-
# is for both fingers. So a distance of 100 will be performed by both
|
97
|
-
# fingers.
|
98
|
-
#
|
99
|
-
# == arguments
|
100
|
-
# speed
|
101
|
-
# Integer
|
102
|
-
# description: Speed of the operation in seconds
|
103
|
-
# example: 3
|
104
|
-
#
|
105
|
-
# distance
|
106
|
-
# Integer
|
107
|
-
# description: Distance of the pinch zoom
|
108
|
-
# example: 100
|
109
|
-
#
|
110
|
-
# direction
|
111
|
-
# Integer
|
112
|
-
# description: Direction of the pinch zoom in degrees 0-180
|
113
|
-
# example: 90
|
114
|
-
# Symbol
|
115
|
-
# description: Direction of the pinch zoom either :Horizontal or :Vertical
|
116
|
-
# example: :Horizontal
|
117
|
-
#
|
118
|
-
# differential
|
119
|
-
# Integer
|
120
|
-
# description: The difference from where the zoom starts or ends (how far apart are the fingers when starting the zoom)
|
121
|
-
# example: 10
|
122
|
-
#
|
123
|
-
# == returns
|
124
|
-
# NilClass
|
125
|
-
# description: -
|
126
|
-
# example: -
|
127
|
-
#
|
128
|
-
# == exceptions
|
129
|
-
# ArgumentError
|
130
|
-
# description: In case the given parameters are not valid.
|
131
|
-
#
|
132
|
-
# == info
|
133
|
-
# See method pinch_zoom
|
134
|
-
#
|
135
|
-
def pinch_zoom_out(speed, distance, direction, differential = 10)
|
136
|
-
pinch_zoom({:type => :out, :speed => speed, :distance_1 => distance, :distance_2 => distance, :direction => direction, :differential => differential})
|
137
|
-
end
|
92
|
+
pinch_zoom({:type => :in, :speed => speed, :distance_1 => distance, :distance_2 => distance, :direction => direction, :differential => differential})
|
138
93
|
|
139
|
-
|
140
|
-
# Causes a pinch zoom gesture on the object. The type of the pinch is based on the given parameters.
|
141
|
-
# The parameters make it possible to define various kinds of pinch zoom operations.
|
142
|
-
#
|
143
|
-
# The image shows how the different parameters will be used to make the pinch gesture.
|
144
|
-
# The image show a zoom in type gesture (:type => :in). Direction is the angle of the
|
145
|
-
# first part of the pinch gesture against the y axel (0 degrees is up). Distance variables
|
146
|
-
# do not have to be the same. This means that you can set the gesture so that one finger
|
147
|
-
# moves a longer distance than the other (or even set one distance to 0).
|
148
|
-
# The :differential parameter determines the how close the nearest points
|
149
|
-
# in the pinch gesture are (:in start points and :out end points).
|
150
|
-
# The center points can be set using the :x and :y setting.
|
151
|
-
# The values are relative to the object and if not set then the center point of the object is used.
|
152
|
-
# \n
|
153
|
-
# [img="images/pinch.png"]Pinch zoom parameters[/img]
|
154
|
-
#
|
155
|
-
# == arguments
|
156
|
-
# params
|
157
|
-
# Hash
|
158
|
-
# description:
|
159
|
-
# A Hash table contains all of the parameters required to make the pinch zoom.
|
160
|
-
# See [link="#pinch_options_table"]Pinch options table[/link] for valid keys.
|
161
|
-
# example: pinch_zoom({:type => :in, :speed => 2, :distance_1 => 100, :distance_2 => 100, :direction => :Vertical, :differential => 10})
|
162
|
-
#
|
163
|
-
# == tables
|
164
|
-
# pinch_options_table
|
165
|
-
# title: Pinch options table
|
166
|
-
# |Key|Type|Description|Accepted values|Example|Required|
|
167
|
-
# |:type|Symbol|Zoom in or out|:in,:out|:type => :in|Yes|
|
168
|
-
# |:speed|Integer|Speed of the gesture in seconds|Positive Integer|:speed => 2|Yes|
|
169
|
-
# |:distance_1|Integer|Distance of the first finger zoom gesture|Positive integer|:distance_1 => 100|Yes|
|
170
|
-
# |:distance_2|Integer|Distance of the second finger zoom gesture|Positive integer|:distance_2 => 100|Yes|
|
171
|
-
# |:differential|Integer|The difference from where the zoom starts or ends|Positive integer|:differential => 10|Yes|
|
172
|
-
# |:x|Integer|X coordinate of the center point for the pinch (relative to the object). Optional defaults to center point but if set y must also be set.|Positive Integer| :x => 120|No|
|
173
|
-
# |:y|Integer|Y coordinate of the center point for the pinch (relative to the object). Optional defaults to center point but if set x must also be set.|Positive Integer|:y => 200|No|
|
174
|
-
#
|
175
|
-
# == returns
|
176
|
-
# NilClass
|
177
|
-
# description: -
|
178
|
-
# example: -
|
179
|
-
#
|
180
|
-
# == exceptions
|
181
|
-
# ArgumentError
|
182
|
-
# description: In case the given parameters are not valid.
|
183
|
-
#
|
184
|
-
def pinch_zoom(params)
|
94
|
+
self
|
185
95
|
|
186
|
-
|
187
|
-
verify_pinch_params!(params)
|
96
|
+
end
|
188
97
|
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
98
|
+
# == description
|
99
|
+
# Performs a pinch zoom out operation. The distance of the operation is
|
100
|
+
# is for both fingers. So a distance of 100 will be performed by both
|
101
|
+
# fingers.
|
102
|
+
#
|
103
|
+
# == arguments
|
104
|
+
# speed
|
105
|
+
# Integer
|
106
|
+
# description: Speed of the operation in seconds
|
107
|
+
# example: 3
|
108
|
+
#
|
109
|
+
# distance
|
110
|
+
# Integer
|
111
|
+
# description: Distance of the pinch zoom
|
112
|
+
# example: 100
|
113
|
+
#
|
114
|
+
# direction
|
115
|
+
# Integer
|
116
|
+
# description: Direction of the pinch zoom in degrees 0-180
|
117
|
+
# example: 90
|
118
|
+
# Symbol
|
119
|
+
# description: Direction of the pinch zoom either :Horizontal or :Vertical
|
120
|
+
# example: :Horizontal
|
121
|
+
#
|
122
|
+
# differential
|
123
|
+
# Integer
|
124
|
+
# description: The difference from where the zoom starts or ends (how far apart are the fingers when starting the zoom)
|
125
|
+
# example: 10
|
126
|
+
#
|
127
|
+
# == returns
|
128
|
+
# NilClass
|
129
|
+
# description: -
|
130
|
+
# example: -
|
131
|
+
#
|
132
|
+
# == exceptions
|
133
|
+
# ArgumentError
|
134
|
+
# description: In case the given parameters are not valid.
|
135
|
+
#
|
136
|
+
# == info
|
137
|
+
# See method pinch_zoom
|
138
|
+
#
|
139
|
+
def pinch_zoom_out(speed, distance, direction, differential = 10)
|
201
140
|
|
202
|
-
|
141
|
+
pinch_zoom({:type => :out, :speed => speed, :distance_1 => distance, :distance_2 => distance, :direction => direction, :differential => differential})
|
203
142
|
|
204
|
-
|
205
|
-
do_sleep(time)
|
143
|
+
self
|
206
144
|
|
207
|
-
|
208
|
-
MobyUtil::Logger.instance.log "behaviour","FAIL;Failed pinch_zoom with params \"#{params.to_s}\".;#{identity};pinch_zoom;"
|
209
|
-
Kernel::raise e
|
210
|
-
end
|
211
|
-
MobyUtil::Logger.instance.log "behaviour","PASS;Operation pinch_zoom succeeded with params \"#{params.to_s}\".;#{identity};pinch_zoom;"
|
212
|
-
nil
|
213
|
-
end
|
145
|
+
end
|
214
146
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
147
|
+
# == description
|
148
|
+
# Causes a pinch zoom gesture on the object. The type of the pinch is based on the given parameters.
|
149
|
+
# The parameters make it possible to define various kinds of pinch zoom operations.
|
150
|
+
#
|
151
|
+
# The image shows how the different parameters will be used to make the pinch gesture.
|
152
|
+
# The image show a zoom in type gesture (:type => :in). Direction is the angle of the
|
153
|
+
# first part of the pinch gesture against the y axel (0 degrees is up). Distance variables
|
154
|
+
# do not have to be the same. This means that you can set the gesture so that one finger
|
155
|
+
# moves a longer distance than the other (or even set one distance to 0).
|
156
|
+
# The :differential parameter determines the how close the nearest points
|
157
|
+
# in the pinch gesture are (:in start points and :out end points).
|
158
|
+
# The center points can be set using the :x and :y setting.
|
159
|
+
# The values are relative to the object and if not set then the center point of the object is used.
|
160
|
+
# \n
|
161
|
+
# [img="images/pinch.png"]Pinch zoom parameters[/img]
|
162
|
+
#
|
163
|
+
# == arguments
|
164
|
+
# params
|
165
|
+
# Hash
|
166
|
+
# description:
|
167
|
+
# A Hash table contains all of the parameters required to make the pinch zoom.
|
168
|
+
# See [link="#pinch_options_table"]Pinch options table[/link] for valid keys.
|
169
|
+
# example: pinch_zoom({:type => :in, :speed => 2, :distance_1 => 100, :distance_2 => 100, :direction => :Vertical, :differential => 10})
|
170
|
+
#
|
171
|
+
# == tables
|
172
|
+
# pinch_options_table
|
173
|
+
# title: Pinch options table
|
174
|
+
# |Key|Type|Description|Accepted values|Example|Required|
|
175
|
+
# |:type|Symbol|Zoom in or out|:in,:out|:type => :in|Yes|
|
176
|
+
# |:speed|Integer|Speed of the gesture in seconds|Positive Integer|:speed => 2|Yes|
|
177
|
+
# |:distance_1|Integer|Distance of the first finger zoom gesture|Positive integer|:distance_1 => 100|Yes|
|
178
|
+
# |:distance_2|Integer|Distance of the second finger zoom gesture|Positive integer|:distance_2 => 100|Yes|
|
179
|
+
# |:differential|Integer|The difference from where the zoom starts or ends|Positive integer|:differential => 10|Yes|
|
180
|
+
# |:x|Integer|X coordinate of the center point for the pinch (relative to the object). Optional defaults to center point but if set y must also be set.|Positive Integer| :x => 120|No|
|
181
|
+
# |:y|Integer|Y coordinate of the center point for the pinch (relative to the object). Optional defaults to center point but if set x must also be set.|Positive Integer|:y => 200|No|
|
182
|
+
#
|
183
|
+
# == returns
|
184
|
+
# NilClass
|
185
|
+
# description: -
|
186
|
+
# example: -
|
187
|
+
#
|
188
|
+
# == exceptions
|
189
|
+
# ArgumentError
|
190
|
+
# description: In case the given parameters are not valid.
|
191
|
+
#
|
192
|
+
def pinch_zoom( params )
|
193
|
+
|
194
|
+
begin
|
195
|
+
verify_pinch_params!(params)
|
196
|
+
|
197
|
+
#convert speed to millis
|
198
|
+
time = params[:speed].to_f
|
199
|
+
speed = time*1000
|
200
|
+
params[:speed] = speed.to_i
|
201
|
+
if params[:x].kind_of?(Integer) and params[:y].kind_of?(Integer)
|
202
|
+
params[:useCoordinates] = 'true'
|
203
|
+
params[:x] = attribute('x_absolute').to_i + params[:x]
|
204
|
+
params[:y] = attribute('y_absolute').to_i + params[:y]
|
205
|
+
end
|
206
|
+
command = command_params #in qt_behaviour
|
207
|
+
command.command_name('PinchZoom')
|
208
|
+
command.command_params(params)
|
209
|
+
|
210
|
+
@sut.execute_command( command )
|
211
|
+
|
212
|
+
#wait untill the pinch is finished
|
213
|
+
do_sleep(time)
|
214
|
+
|
215
|
+
rescue Exception => e
|
216
|
+
$logger.log "behaviour","FAIL;Failed pinch_zoom with params \"#{params.to_s}\".;#{identity};pinch_zoom;"
|
217
|
+
Kernel::raise e
|
218
|
+
end
|
219
|
+
|
220
|
+
$logger.log "behaviour","PASS;Operation pinch_zoom succeeded with params \"#{params.to_s}\".;#{identity};pinch_zoom;"
|
221
|
+
|
222
|
+
self
|
223
|
+
|
224
|
+
end
|
225
|
+
|
226
|
+
# == description
|
227
|
+
# Causes rotation motion on the object. The rotation will be so that one point is stationary
|
228
|
+
# while other moves to create a rotation motion (like a hinge).
|
229
|
+
#
|
230
|
+
# == arguments
|
231
|
+
# radius
|
232
|
+
# Integer
|
233
|
+
# description: Radius of the of the rotation in degrees (distance between the points)
|
234
|
+
# example: 100
|
235
|
+
#
|
236
|
+
# start_angle
|
237
|
+
# Integer
|
238
|
+
# description: Starting angle of the rotation. Integer from 0-360
|
239
|
+
# example: 90
|
240
|
+
# Symbol
|
241
|
+
# description: Starting angle of the rotation. Symbol :Horizontal or :Vertical
|
242
|
+
# example: :Horizontal
|
243
|
+
#
|
244
|
+
# rotate_direction
|
245
|
+
# Symbol
|
246
|
+
# description: Rotation direction :Clockwise or :CounterClockwise.
|
247
|
+
# example: :CounterClockwise
|
248
|
+
#
|
249
|
+
# distance
|
250
|
+
# Integer
|
251
|
+
# description: Distance of the rotation in degrees
|
252
|
+
# example: 360
|
253
|
+
#
|
254
|
+
# speed
|
255
|
+
# Integer
|
256
|
+
# description: Speed in seconds
|
257
|
+
# example: 3
|
258
|
+
#
|
259
|
+
# center_point
|
260
|
+
# Hash
|
261
|
+
# description: Optional X and Y coordinates (relative to the object e.g. top left of the object is 0.0).
|
262
|
+
# In one point rotation the other end point will remain stationary (the rotation is done around that point)
|
263
|
+
# and that will be the given point. If not given the point will be the center of the object.
|
264
|
+
# example: {:x => 50, :y => 100}
|
265
|
+
#
|
266
|
+
# == returns
|
267
|
+
# NilClass
|
268
|
+
# description: -
|
269
|
+
# example: -
|
270
|
+
#
|
271
|
+
#
|
272
|
+
# == exceptions
|
273
|
+
# ArgumentError
|
274
|
+
# description: In case the given parameters are not valid.
|
275
|
+
#
|
276
|
+
# == info
|
277
|
+
# See method rotate
|
278
|
+
#
|
279
|
+
def one_point_rotate(radius, start_angle, rotate_direction, distance, speed, center_point = nil)
|
280
|
+
params = {:type => :one_point, :radius => radius, :rotate_direction => rotate_direction, :distance => distance, :speed => speed, :direction => start_angle}
|
281
|
+
params.merge!(center_point) if center_point
|
282
|
+
rotate(params)
|
283
|
+
self
|
284
|
+
end
|
273
285
|
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
286
|
+
# == description
|
287
|
+
# Causes ratation motion on the object. The rotation will be so that both ends move to create a rotation motion around a point.
|
288
|
+
#
|
289
|
+
# == arguments
|
290
|
+
# radius
|
291
|
+
# Integer
|
292
|
+
# description: Radius of the of the rotation in degrees (distance between the points)
|
293
|
+
# example: 100
|
294
|
+
#
|
295
|
+
# start_angle
|
296
|
+
# Integer
|
297
|
+
# description: Starting angle of the rotation. Integer from 0-360
|
298
|
+
# example: 90
|
299
|
+
# Symbol
|
300
|
+
# description: Starting angle of the rotation. Symbol :Horizontal or :Vertical
|
301
|
+
# example: :Horizontal
|
302
|
+
#
|
303
|
+
# rotate_direction
|
304
|
+
# Symbol
|
305
|
+
# description: Rotation direction :Clockwise or :CounterClockwise.
|
306
|
+
# example: :CounterClockwise
|
307
|
+
#
|
308
|
+
# distance
|
309
|
+
# Integer
|
310
|
+
# description: Distance of the rotation in degrees
|
311
|
+
# example: 360
|
312
|
+
#
|
313
|
+
# speed
|
314
|
+
# Integer
|
315
|
+
# description: Speed in seconds
|
316
|
+
# example: 3
|
317
|
+
#
|
318
|
+
# center_point
|
319
|
+
# Hash
|
320
|
+
# description: Optional X and Y coordinates (relative to the object e.g. top left of the object is 0.0).
|
321
|
+
# In two point rotation both end points will rotate around a center point which will be
|
322
|
+
# the given point. If not given the point will be the center of the object.
|
323
|
+
# example: {:x => 50, :y => 100}
|
324
|
+
#
|
325
|
+
# == returns
|
326
|
+
# NilClass
|
327
|
+
# description: -
|
328
|
+
# example: -
|
329
|
+
#
|
330
|
+
# == exceptions
|
331
|
+
#
|
332
|
+
# ArgumentError
|
333
|
+
# description: In case the given parameters are not valid.
|
334
|
+
#
|
335
|
+
# == info
|
336
|
+
# See method rotate
|
337
|
+
#
|
338
|
+
def two_point_rotate(radius, start_angle, rotate_direction, distance, speed, center_point = nil)
|
339
|
+
params = {:type => :two_point, :radius => radius, :rotate_direction => rotate_direction, :distance => distance, :speed => speed, :direction => start_angle}
|
340
|
+
params.merge!(center_point) if center_point
|
341
|
+
rotate(params)
|
342
|
+
self
|
343
|
+
end
|
331
344
|
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
345
|
+
# == description
|
346
|
+
# Causes a rotate motion on the screen using two fingers (e.g. like turning a knob). Similar gesture to pinch zooming except the angle changes.
|
347
|
+
# \n
|
348
|
+
# \n
|
349
|
+
# [img="images/rotate.png"]Rotation parameters[/img]
|
350
|
+
# \n
|
351
|
+
# The image shows how the different parameters will be used to make the rotation gestures in both
|
352
|
+
# one point and two point rotations. In one point rotation the other end remains stationary while
|
353
|
+
# the other moves around it based on the given radius. In two point rotation the movement is done
|
354
|
+
# by both ends. Note the direction paramters as the :direction parameter defines the starting angle
|
355
|
+
# for the gesture and :rotation_direction defines the actual rotation direction (clockwise or counter clockwise).
|
356
|
+
# When performing two point rotation note that the radius is in fact a radius not the diameter.
|
357
|
+
# Distance is given in degrees from 0-360. Center point can be set using :x and :y and if
|
358
|
+
# not set the center point of the object will be used.
|
359
|
+
#
|
360
|
+
# == arguments
|
361
|
+
# params
|
362
|
+
# Hash
|
363
|
+
# description: A hash of the parameters that define the rotation. See [link="#rotate_options_table"]Rotate options table[/link] for valid keys
|
364
|
+
#
|
365
|
+
# example: {:type => :one_point, :radius => 100, :rotate_direction => :Clockwise, :distance => 45, :speed => 2, :direction => 35, :x => 2, y => 35}
|
366
|
+
#
|
367
|
+
# == tables
|
368
|
+
# rotate_options_table
|
369
|
+
# title: Rotate options table
|
370
|
+
# |Key|Type|Description|Accepted values|Example|Required|
|
371
|
+
# |:type|Symbol|Rotation type|:one_point,:two_point|:type => :one_point|Yes|
|
372
|
+
# |:radius|Integer|Radius of the rotatation in pixels|Any positive Integer|:radius => 100|Yes|
|
373
|
+
# |:rotation_direction|Symbol|Rotation direction|:Clockwise, :CounterClockwise|:rotate_direction => :Clockwise|Yes|
|
374
|
+
# |:distance|Integer|Rotation distance in degrees|0-360|:distance => 90|Yes|
|
375
|
+
# |:speed|Integer|Speed of the gesture in seconds|Positive Integer|:speed => 2|Yes|
|
376
|
+
# |:direction|Integer/Symbol|The start angle of the rotation.|0-360 or :Horizontal, :Vertical|:direction => 35|Yes|
|
377
|
+
# |:x|Integer|X coordinate of the center point for the pinch (relative to the object). Optional defaults to center point but if set y must also be set.|Positive Integer|:x => 50|No|
|
378
|
+
# |:y|Integer|Y coordinate of the center point for the pinch (relative to the object). Optional defaults to center point but if set x must also be set.|Positive Integer|:y => 120|No|
|
379
|
+
#
|
380
|
+
#
|
381
|
+
# == returns
|
382
|
+
# NilClass
|
383
|
+
# description: -
|
384
|
+
# example: -
|
385
|
+
#
|
386
|
+
# == exceptions
|
387
|
+
#
|
388
|
+
# ArgumentError
|
389
|
+
# description: In case the given parameters are not valid.
|
390
|
+
#
|
378
391
|
def rotate(params)
|
392
|
+
|
379
393
|
begin
|
394
|
+
|
380
395
|
verify_rotate_params!(params)
|
381
396
|
|
382
397
|
time = params[:speed].to_f
|
383
|
-
|
384
|
-
params[:speed] =
|
398
|
+
|
399
|
+
params[:speed] = (time * 1000).to_i
|
400
|
+
|
385
401
|
|
386
402
|
if params[:x].kind_of?(Integer) and params[:y].kind_of?(Integer)
|
387
|
-
|
388
|
-
|
389
|
-
|
403
|
+
params[:useCoordinates] = 'true'
|
404
|
+
params[:x] = attribute('x_absolute').to_i + params[:x]
|
405
|
+
params[:y] = attribute('y_absolute').to_i + params[:y]
|
390
406
|
end
|
391
407
|
|
392
408
|
command = command_params #in qt_behaviour
|
@@ -396,13 +412,16 @@ module MobyBehaviour
|
|
396
412
|
@sut.execute_command( command )
|
397
413
|
|
398
414
|
#wait untill the operation to finish
|
399
|
-
do_sleep(time)
|
415
|
+
do_sleep( time )
|
400
416
|
rescue Exception => e
|
401
|
-
|
417
|
+
$logger.log "behaviour","FAIL;Failed rotate with params \"#{params.to_s}\".;#{identity};rotate;"
|
402
418
|
Kernel::raise e
|
403
419
|
end
|
404
|
-
|
405
|
-
|
420
|
+
|
421
|
+
$logger.log "behaviour","PASS;Operation rotate succeeded with params \"#{params.to_s}\".;#{identity};rotate;"
|
422
|
+
|
423
|
+
self
|
424
|
+
|
406
425
|
end
|
407
426
|
|
408
427
|
private
|
@@ -446,7 +465,7 @@ module MobyBehaviour
|
|
446
465
|
end
|
447
466
|
|
448
467
|
# enable hooking for performance measurement & debug logging
|
449
|
-
|
468
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
450
469
|
|
451
470
|
end # Multitouch
|
452
471
|
|