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/attribute.rb
CHANGED
@@ -206,11 +206,11 @@ module MobyBehaviour
|
|
206
206
|
begin
|
207
207
|
returnValue = @sut.execute_command( command )
|
208
208
|
rescue
|
209
|
-
|
209
|
+
$logger.log "behaviour" , "FAIL;Failed when calling method set_attribute with values attribute:#{attribute.to_s} value:#{value.to_s}.;#{identity};set_attribute;"
|
210
210
|
Kernel::raise RuntimeError.new("Setting attribute '%s' to value '%s' failed with error: %s" % [attribute, value, returnValue])
|
211
211
|
end
|
212
212
|
|
213
|
-
|
213
|
+
$logger.log "behaviour" , "PASS;The method set_attribute was executed successfully with with values attribute:#{attribute.to_s} value:#{value.to_s}.;#{identity};set_attribute;"
|
214
214
|
|
215
215
|
nil
|
216
216
|
|
@@ -218,7 +218,7 @@ module MobyBehaviour
|
|
218
218
|
end
|
219
219
|
|
220
220
|
# enable hooking for performance measurement & debug logging
|
221
|
-
|
221
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
222
222
|
|
223
223
|
|
224
224
|
end
|
data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/behaviour.rb
CHANGED
@@ -66,7 +66,7 @@ module MobyBehaviour
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
command.set_event_type(
|
69
|
+
command.set_event_type($parameters[ @sut.id ][ :event_type, "0" ])
|
70
70
|
|
71
71
|
#for components with object visible on screen but not actual widgets or graphicsitems
|
72
72
|
if self.attribute( 'objectType' ) == 'Embedded'
|
@@ -86,7 +86,7 @@ module MobyBehaviour
|
|
86
86
|
# == nodoc
|
87
87
|
# should this method be private?
|
88
88
|
def plugin_command( require_response = false, command = MobyCommand::WidgetCommand.new )
|
89
|
-
command.set_event_type(
|
89
|
+
command.set_event_type($parameters[ @sut.id ][ :event_type, "0" ])
|
90
90
|
command.application_id( get_application_id )
|
91
91
|
command.object_id( self.id )
|
92
92
|
command.object_type( self.attribute('objectType' ).intern)
|
@@ -98,8 +98,8 @@ module MobyBehaviour
|
|
98
98
|
|
99
99
|
def do_sleep(time)
|
100
100
|
|
101
|
-
time = time.to_f
|
102
|
-
|
101
|
+
time = time.to_f * 1.3
|
102
|
+
|
103
103
|
#for flicks the duration of the gesture is short but animation (scroll etc..) may not
|
104
104
|
#so wait at least one second
|
105
105
|
time = 1 if time < 1
|
@@ -130,7 +130,7 @@ module MobyBehaviour
|
|
130
130
|
end
|
131
131
|
|
132
132
|
# enable hooking for performance measurement & debug logging
|
133
|
-
|
133
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
134
134
|
|
135
135
|
end
|
136
136
|
|
@@ -227,12 +227,12 @@ module MobyBehaviour
|
|
227
227
|
|
228
228
|
rescue Exception => e
|
229
229
|
|
230
|
-
|
230
|
+
$logger.log "behaviour" , "FAIL;Failed to enable event logging. With event_list \"#{event_list};log_events"
|
231
231
|
Kernel::raise e
|
232
232
|
|
233
233
|
end
|
234
234
|
|
235
|
-
|
235
|
+
$logger.log "behaviour" , "PASS;Event logging enabled. With event_list \"#{event_list};log_events"
|
236
236
|
|
237
237
|
end
|
238
238
|
|
@@ -252,12 +252,12 @@ module MobyBehaviour
|
|
252
252
|
|
253
253
|
rescue Exception => e
|
254
254
|
|
255
|
-
|
255
|
+
$logger.log "behaviour" , "FAIL;Failed to stop event logging.;stop_event_logging"
|
256
256
|
Kernel::raise e
|
257
257
|
|
258
258
|
end
|
259
259
|
|
260
|
-
|
260
|
+
$logger.log "behaviour" , "PASS;Event logging stopped.;stop_event_logging"
|
261
261
|
|
262
262
|
end
|
263
263
|
|
@@ -287,12 +287,12 @@ module MobyBehaviour
|
|
287
287
|
|
288
288
|
rescue Exception => e
|
289
289
|
|
290
|
-
|
290
|
+
$logger.log "behaviour" , "FAIL;Failed to configure logger. With params \"#{params_hash.to_s};configure_logger"
|
291
291
|
Kernel::raise e
|
292
292
|
|
293
293
|
end
|
294
294
|
|
295
|
-
|
295
|
+
$logger.log "behaviour" , "PASS;Succesfully configured logger. With params \"#{params_hash.to_s};configure_logger"
|
296
296
|
|
297
297
|
end
|
298
298
|
|
@@ -308,7 +308,7 @@ module MobyBehaviour
|
|
308
308
|
end
|
309
309
|
|
310
310
|
# enable hooking for performance measurement & debug logging
|
311
|
-
|
311
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
312
312
|
|
313
313
|
end # ConfigureBehaviour
|
314
314
|
|
@@ -82,12 +82,12 @@ module MobyBehaviour
|
|
82
82
|
|
83
83
|
rescue Exception => e
|
84
84
|
|
85
|
-
|
85
|
+
$logger.log "behaviour" , "FAIL;Failed enable_events with refresh \"#{filter_array.to_s}\".;#{ identity };enable_events;"
|
86
86
|
Kernel::raise e
|
87
87
|
|
88
88
|
end
|
89
89
|
|
90
|
-
|
90
|
+
$logger.log "behaviour" , "PASS;Operation enable_events executed successfully with refresh \"#{ filter_array.to_s }\".;#{ identity };enable_events;"
|
91
91
|
nil
|
92
92
|
end
|
93
93
|
|
@@ -111,11 +111,11 @@ module MobyBehaviour
|
|
111
111
|
command.service( 'collectEvents' )
|
112
112
|
@sut.execute_command( command)
|
113
113
|
rescue Exception => e
|
114
|
-
|
114
|
+
$logger.log "behaviour" , "FAIL;Failed disable_events.;#{ identity };disable_events;"
|
115
115
|
Kernel::raise e
|
116
116
|
end
|
117
117
|
|
118
|
-
|
118
|
+
$logger.log "behaviour" , "PASS;Operation disable_events executed successfully.;#{ identity };disable_events;"
|
119
119
|
nil
|
120
120
|
|
121
121
|
end
|
@@ -146,19 +146,19 @@ module MobyBehaviour
|
|
146
146
|
|
147
147
|
rescue Exception => e
|
148
148
|
|
149
|
-
|
149
|
+
$logger.log "behaviour" , "FAIL;Failed get_events.;#{ identity };get_events;"
|
150
150
|
Kernel::raise e
|
151
151
|
|
152
152
|
end
|
153
153
|
|
154
|
-
|
154
|
+
$logger.log "behaviour" , "PASS;Operation get_events executed successfully.;#{ identity };get_events;"
|
155
155
|
|
156
156
|
ret
|
157
157
|
|
158
158
|
end
|
159
159
|
|
160
160
|
# enable hooking for performance measurement & debug logging
|
161
|
-
|
161
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
162
162
|
|
163
163
|
end # EventsBehaviour
|
164
164
|
|
data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/file_transfer.rb
CHANGED
@@ -323,7 +323,7 @@ module MobyBehaviour
|
|
323
323
|
|
324
324
|
|
325
325
|
# enable hooking for performance measurement & debug logging
|
326
|
-
|
326
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
327
327
|
|
328
328
|
|
329
329
|
end
|
@@ -64,16 +64,16 @@ module MobyBehaviour
|
|
64
64
|
## flick_to (center)
|
65
65
|
search_result.flick_to(window_x.to_i, window_y.to_i)
|
66
66
|
rescue Exception => e
|
67
|
-
|
67
|
+
##$logger.log "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)
|
68
68
|
## Rescue from center and flick
|
69
69
|
Kernel::raise e
|
70
70
|
end
|
71
|
-
|
71
|
+
$logger.log "behaviour" , "PASS;Test object found and centered.;#{id.to_s};sut;{};application;" << find_hash.inspect
|
72
72
|
search_result
|
73
73
|
end
|
74
74
|
|
75
75
|
# enable hooking for performance measurement & debug logging
|
76
|
-
|
76
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
77
77
|
|
78
78
|
end # module Find
|
79
79
|
|
@@ -97,13 +97,13 @@ module MobyBehaviour
|
|
97
97
|
end
|
98
98
|
rescue Exception => e
|
99
99
|
|
100
|
-
|
100
|
+
$logger.log "behaviour",
|
101
101
|
"FAIL;Failed when calling fixture with name #{fixture_name} method #{fixture_method} parameters #{parameters_hash.inspect}.;#{id.to_s};sut;{};fixture;"
|
102
102
|
|
103
103
|
Kernel::raise MobyBase::BehaviourError.new("Fixture", "Failed to execute fixture name #{fixture_name} method #{fixture_method}")
|
104
104
|
end
|
105
105
|
|
106
|
-
|
106
|
+
$logger.log "behaviour",
|
107
107
|
"PASS;The fixture command was executed successfully with name #{fixture_name} method #{fixture_method} parameters #{parameters_hash.inspect}.;#{id.to_s};sut;{};fixture;"
|
108
108
|
|
109
109
|
ret
|
@@ -162,13 +162,13 @@ module MobyBehaviour
|
|
162
162
|
end
|
163
163
|
rescue Exception => e
|
164
164
|
|
165
|
-
|
165
|
+
$logger.log "behaviour" ,
|
166
166
|
"FAIL;Failed when calling async_fixture with name #{fixture_name} method #{fixture_method} parameters #{parameters_hash.inspect}.;#{id.to_s};sut;{};fixture;"
|
167
167
|
|
168
168
|
Kernel::raise MobyBase::BehaviourError.new("Fixture", "Failed to execute async_fixture name #{fixture_name} method #{fixture_method}")
|
169
169
|
end
|
170
170
|
|
171
|
-
|
171
|
+
$logger.log "behaviour",
|
172
172
|
"PASS;The fixture command was executed successfully with name #{fixture_name} method #{fixture_method} parameters #{parameters_hash.inspect}.;#{id.to_s};sut;{};fixture;"
|
173
173
|
|
174
174
|
ret
|
@@ -176,7 +176,7 @@ module MobyBehaviour
|
|
176
176
|
end
|
177
177
|
|
178
178
|
# enable hooking for performance measurement & debug logging
|
179
|
-
|
179
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
180
180
|
|
181
181
|
end
|
182
182
|
|
@@ -84,7 +84,7 @@ module MobyBehaviour
|
|
84
84
|
def flick( direction, button = :Left, optional_params = {} )
|
85
85
|
|
86
86
|
begin
|
87
|
-
use_tap_screen = optional_params[:use_tap_screen].nil? ?
|
87
|
+
use_tap_screen = optional_params[:use_tap_screen].nil? ? $parameters[ @sut.id][ :use_tap_screen, 'false'] :
|
88
88
|
optional_params[:use_tap_screen].to_s
|
89
89
|
optional_params[:useTapScreen] = use_tap_screen
|
90
90
|
|
@@ -98,13 +98,13 @@ module MobyBehaviour
|
|
98
98
|
|
99
99
|
rescue Exception => e
|
100
100
|
|
101
|
-
|
101
|
+
$logger.log "behaviour" , "FAIL;Failed flick with direction \"#{direction}\", button \"#{button.to_s}\".;#{identity};flick;"
|
102
102
|
Kernel::raise e
|
103
103
|
end
|
104
104
|
|
105
|
-
|
105
|
+
$logger.log "behaviour" , "PASS;Operation flick executed successfully with direction \"#{direction}\", button \"#{button.to_s}\".;#{identity};flick;"
|
106
106
|
|
107
|
-
|
107
|
+
self
|
108
108
|
end
|
109
109
|
|
110
110
|
# == description
|
@@ -147,7 +147,7 @@ module MobyBehaviour
|
|
147
147
|
def flick_to( x, y, button = :Left, optional_params = {})
|
148
148
|
|
149
149
|
begin
|
150
|
-
use_tap_screen = optional_params[:use_tap_screen].nil? ?
|
150
|
+
use_tap_screen = optional_params[:use_tap_screen].nil? ? $parameters[ @sut.id][ :use_tap_screen, 'false'] :
|
151
151
|
optional_params[:use_tap_screen].to_s
|
152
152
|
optional_params[:useTapScreen] = use_tap_screen
|
153
153
|
|
@@ -159,13 +159,13 @@ module MobyBehaviour
|
|
159
159
|
|
160
160
|
rescue Exception => e
|
161
161
|
|
162
|
-
|
162
|
+
$logger.log "behaviour" , "FAIL;Failed flick_to with x \"#{x}\", y \"#{y}\", button \"#{button.to_s}\".;#{identity};drag;"
|
163
163
|
Kernel::raise e
|
164
164
|
end
|
165
165
|
|
166
|
-
|
166
|
+
$logger.log "behaviour" , "PASS;Operation flick_to executed successfully with x \"#{x}\", y \"#{y}\", button \"#{button.to_s}\".;#{identity};drag;"
|
167
167
|
|
168
|
-
|
168
|
+
self
|
169
169
|
|
170
170
|
end
|
171
171
|
|
@@ -228,11 +228,11 @@ module MobyBehaviour
|
|
228
228
|
|
229
229
|
begin
|
230
230
|
# change the format for api consitency
|
231
|
-
use_tap_screen = optional_params[:use_tap_screen].nil? ?
|
231
|
+
use_tap_screen = optional_params[:use_tap_screen].nil? ? $parameters[ @sut.id][ :use_tap_screen, 'false'] :
|
232
232
|
optional_params[:use_tap_screen].to_s
|
233
233
|
optional_params[:useTapScreen] = use_tap_screen
|
234
|
-
optional_params['x_off'] =
|
235
|
-
optional_params['y_off'] =
|
234
|
+
optional_params['x_off'] = $parameters[ @sut.id ][:tap_x_offset , '0' ],
|
235
|
+
optional_params['y_off'] = $parameters[ @sut.id ][:tap_y_offset , '0' ]
|
236
236
|
|
237
237
|
|
238
238
|
|
@@ -249,15 +249,15 @@ module MobyBehaviour
|
|
249
249
|
|
250
250
|
rescue Exception => e
|
251
251
|
|
252
|
-
|
252
|
+
$logger.log "behaviour",
|
253
253
|
"FAIL;Failed gesture with direction \"#{direction}\", speed \"#{speed.to_s}\", distance \"#{distance.to_s}\".;#{identity};gesture;"
|
254
254
|
Kernel::raise e
|
255
255
|
end
|
256
256
|
|
257
|
-
|
257
|
+
$logger.log "behaviour",
|
258
258
|
"PASS;Operation gesture executed successfully with direction \"#{direction}\", speed \"#{speed.to_s}\", distance \"#{distance.to_s}\".;#{identity};gesture;"
|
259
259
|
|
260
|
-
|
260
|
+
self
|
261
261
|
end
|
262
262
|
|
263
263
|
# == description
|
@@ -297,14 +297,17 @@ module MobyBehaviour
|
|
297
297
|
|
298
298
|
begin
|
299
299
|
# change the format for api consitency
|
300
|
-
use_tap_screen = optional_params[:use_tap_screen].nil? ?
|
300
|
+
use_tap_screen = optional_params[:use_tap_screen].nil? ? $parameters[ @sut.id][ :use_tap_screen, 'false'] :
|
301
301
|
optional_params[:use_tap_screen].to_s
|
302
302
|
optional_params[:useTapScreen] = use_tap_screen
|
303
303
|
|
304
304
|
params = {:gesture_type => :MouseGestureToCoordinates, :speed => speed}
|
305
305
|
if attribute('objectType') == 'Web'
|
306
|
-
|
307
|
-
|
306
|
+
elemens_xml_data, unused_rule = TDriver::TestObjectAdapter.get_objects( @sut.xml_data, { :id => self.attribute('webFrame')}, true )
|
307
|
+
object_xml_data = elemens_xml_data[0]
|
308
|
+
object_attributes = TDriver::TestObjectAdapter.test_object_attributes(object_xml_data, ['x_absolute', 'y_absolute'])
|
309
|
+
frame_x_absolute = object_attributes['x_absolute'].to_i
|
310
|
+
frame_y_absolute = object_attributes['y_absolute'].to_i
|
308
311
|
new_params = {:x=>(frame_x_absolute + x.to_i + (attribute('width' ).to_i/2)),
|
309
312
|
:y=>(frame_y_absolute + y.to_i + (attribute('height').to_i/2))}
|
310
313
|
params.merge!(new_params)
|
@@ -320,12 +323,12 @@ module MobyBehaviour
|
|
320
323
|
|
321
324
|
rescue Exception => e
|
322
325
|
|
323
|
-
|
326
|
+
$logger.log "behaviour" , "FAIL;Failed gesture_to with x \"#{x}\", y \"#{y}\", speed \"#{speed.to_s}\", button \".;#{identity};gesture;"
|
324
327
|
Kernel::raise e
|
325
328
|
end
|
326
329
|
|
327
|
-
|
328
|
-
|
330
|
+
$logger.log "behaviour" , "PASS;Operation gesture_to executed successfully with x \"#{x}\", y \"#{y}\", speed \"#{speed.to_s}\".;#{identity};gesture;"
|
331
|
+
self
|
329
332
|
end
|
330
333
|
|
331
334
|
# == description
|
@@ -392,11 +395,11 @@ module MobyBehaviour
|
|
392
395
|
|
393
396
|
|
394
397
|
rescue Exception => e
|
395
|
-
|
398
|
+
$logger.log "behaviour" , "FAIL;Failed gesture_from with x \"#{x}\", y \"#{y}\", speed \"#{speed.to_s}\", distance \"#{distance.to_s}\", button \".;#{identity};gesture;"
|
396
399
|
Kernel::raise e
|
397
400
|
end
|
398
|
-
|
399
|
-
|
401
|
+
$logger.log "behaviour" , "PASS;Operation gesture_from executed successfully with x \"#{x}\", y \"#{y}\", speed \"#{speed.to_s}\", distance \"#{distance.to_s}\".;#{identity};gesture;"
|
402
|
+
self
|
400
403
|
end
|
401
404
|
|
402
405
|
# == description
|
@@ -429,8 +432,16 @@ module MobyBehaviour
|
|
429
432
|
# description: One of the arguments is not valid
|
430
433
|
def gesture_to_object(target_object, duration, optional_params = {:button => :Left, :isDrag => false})
|
431
434
|
if attribute('objectType') == 'Web'
|
432
|
-
|
433
|
-
|
435
|
+
elemens_xml_data, unused_rule = TDriver::TestObjectAdapter.get_objects( @sut.xml_data, { :id => self.attribute('webFrame')}, true )
|
436
|
+
object_xml_data = elemens_xml_data[0]
|
437
|
+
object_attributes = TDriver::TestObjectAdapter.test_object_attributes(object_xml_data, ['x', 'y'])
|
438
|
+
frame_x = object_attributes['x'].to_i
|
439
|
+
frame_y = object_attributes['y'].to_i
|
440
|
+
puts "x " + frame_x.to_s + " y " + frame_y.to_s
|
441
|
+
|
442
|
+
|
443
|
+
gesture_to(target_object.attribute('x').to_i + (target_object.attribute('width' ).to_i/2) - (attribute('width' ).to_i/2 ) - frame_x,
|
444
|
+
target_object.attribute('y').to_i + (target_object.attribute('height').to_i/2) - (attribute('height').to_i/2 ) - frame_y,
|
434
445
|
duration, optional_params)
|
435
446
|
nil
|
436
447
|
return
|
@@ -438,7 +449,7 @@ module MobyBehaviour
|
|
438
449
|
|
439
450
|
begin
|
440
451
|
# change the format for api consitency
|
441
|
-
use_tap_screen = optional_params[:use_tap_screen].nil? ?
|
452
|
+
use_tap_screen = optional_params[:use_tap_screen].nil? ? $parameters[ @sut.id][ :use_tap_screen, 'false'] :
|
442
453
|
optional_params[:use_tap_screen].to_s
|
443
454
|
optional_params[:useTapScreen] = use_tap_screen
|
444
455
|
|
@@ -453,14 +464,14 @@ module MobyBehaviour
|
|
453
464
|
|
454
465
|
rescue Exception => e
|
455
466
|
|
456
|
-
|
467
|
+
$logger.log "behaviour" , "FAIL;Failed gesture_to_object with button.;#{identity};drag;"
|
457
468
|
Kernel::raise e
|
458
469
|
|
459
470
|
end
|
460
471
|
|
461
|
-
|
472
|
+
$logger.log "behaviour" , "PASS;Operation gesture_to_object executed successfully with button.;#{identity};drag;"
|
462
473
|
|
463
|
-
|
474
|
+
self
|
464
475
|
|
465
476
|
end
|
466
477
|
|
@@ -502,7 +513,7 @@ module MobyBehaviour
|
|
502
513
|
|
503
514
|
begin
|
504
515
|
|
505
|
-
use_tap_screen = optional_params[:use_tap_screen].nil? ?
|
516
|
+
use_tap_screen = optional_params[:use_tap_screen].nil? ? $parameters[ @sut.id][ :use_tap_screen, 'false'] :
|
506
517
|
optional_params[:use_tap_screen].to_s
|
507
518
|
optional_params[:useTapScreen] = use_tap_screen
|
508
519
|
|
@@ -539,16 +550,16 @@ module MobyBehaviour
|
|
539
550
|
|
540
551
|
rescue Exception => e
|
541
552
|
|
542
|
-
|
553
|
+
$logger.log "behaviour",
|
543
554
|
"FAIL;Failed drag_to_object with points \"#{points.to_s}\", duration \"#{duration.to_s}\", mouse_details \"#{mouse_details.to_s}\".;#{identity};gesture_points;"
|
544
555
|
Kernel::raise e
|
545
556
|
|
546
557
|
end
|
547
558
|
|
548
|
-
|
559
|
+
$logger.log "behaviour",
|
549
560
|
"PASS;Operation drag_to_object executed successfully with points \"#{points.to_s}\", duration \"#{duration.to_s}\", mouse_details \"#{mouse_details.to_s}\".;#{identity};gesture_points;"
|
550
561
|
|
551
|
-
|
562
|
+
self
|
552
563
|
end
|
553
564
|
|
554
565
|
# == description
|
@@ -593,7 +604,7 @@ module MobyBehaviour
|
|
593
604
|
def drag(direction, distance, button = :Left, optional_params = {})
|
594
605
|
|
595
606
|
begin
|
596
|
-
use_tap_screen = optional_params[:use_tap_screen].nil? ?
|
607
|
+
use_tap_screen = optional_params[:use_tap_screen].nil? ? $parameters[ @sut.id][ :use_tap_screen, 'false'] :
|
597
608
|
optional_params[:use_tap_screen].to_s
|
598
609
|
optional_params[:useTapScreen] = use_tap_screen
|
599
610
|
|
@@ -605,14 +616,14 @@ module MobyBehaviour
|
|
605
616
|
|
606
617
|
rescue Exception => e
|
607
618
|
|
608
|
-
|
619
|
+
$logger.log "behaviour" , "FAIL;Failed drag with direction \"#{direction}\", distance \"#{distance}\", button \"#{button.to_s}\".;#{identity};drag;"
|
609
620
|
Kernel::raise e
|
610
621
|
|
611
622
|
end
|
612
623
|
|
613
|
-
|
624
|
+
$logger.log "behaviour" , "PASS;Operation drag executed successfully with direction \"#{direction}\", distance \"#{distance}\", button \"#{button.to_s}\".;#{identity};drag;"
|
614
625
|
|
615
|
-
|
626
|
+
self
|
616
627
|
end
|
617
628
|
|
618
629
|
# == description
|
@@ -659,13 +670,13 @@ module MobyBehaviour
|
|
659
670
|
gesture_to(x, y, speed, optional_params )
|
660
671
|
|
661
672
|
rescue Exception => e
|
662
|
-
|
673
|
+
$logger.log "behaviour" , "FAIL;Failed drag_to with x \"#{x}\", y \"#{y}\", button \"#{button.to_s}\".;#{identity};drag;"
|
663
674
|
Kernel::raise e
|
664
675
|
end
|
665
676
|
|
666
|
-
|
677
|
+
$logger.log "behaviour" , "PASS;Operation drag_to executed successfully with x \"#{x}\", y \"#{y}\", button \"#{button.to_s}\".;#{identity};drag;"
|
667
678
|
|
668
|
-
|
679
|
+
self
|
669
680
|
|
670
681
|
end
|
671
682
|
|
@@ -703,7 +714,7 @@ module MobyBehaviour
|
|
703
714
|
|
704
715
|
begin
|
705
716
|
|
706
|
-
use_tap_screen = optional_params[:use_tap_screen].nil? ?
|
717
|
+
use_tap_screen = optional_params[:use_tap_screen].nil? ? $parameters[ @sut.id][ :use_tap_screen, 'false'] :
|
707
718
|
optional_params[:use_tap_screen].to_s
|
708
719
|
optional_params[:useTapScreen] = use_tap_screen
|
709
720
|
|
@@ -721,14 +732,14 @@ module MobyBehaviour
|
|
721
732
|
|
722
733
|
rescue Exception => e
|
723
734
|
|
724
|
-
|
735
|
+
$logger.log "behaviour" , "FAIL;Failed drag_to_object with button \"#{button.to_s}\".;#{identity};drag;"
|
725
736
|
Kernel::raise e
|
726
737
|
|
727
738
|
end
|
728
739
|
|
729
|
-
|
740
|
+
$logger.log "behaviour" , "PASS;Operation drag_to_object executed successfully with button \"#{button.to_s}\".;#{identity};drag;"
|
730
741
|
|
731
|
-
|
742
|
+
self
|
732
743
|
|
733
744
|
end
|
734
745
|
|
@@ -774,7 +785,7 @@ module MobyBehaviour
|
|
774
785
|
|
775
786
|
begin
|
776
787
|
|
777
|
-
use_tap_screen = optional_params[:use_tap_screen].nil? ?
|
788
|
+
use_tap_screen = optional_params[:use_tap_screen].nil? ? $parameters[ @sut.id][ :use_tap_screen, 'false'] :
|
778
789
|
optional_params[:use_tap_screen].to_s
|
779
790
|
optional_params[:useTapScreen] = use_tap_screen
|
780
791
|
|
@@ -786,14 +797,15 @@ module MobyBehaviour
|
|
786
797
|
|
787
798
|
rescue Exception => e
|
788
799
|
|
789
|
-
|
800
|
+
$logger.log "behaviour" , "FAIL;Failed move with direction \"#{direction}\", distance \"#{distance}\",.;#{identity};move;"
|
790
801
|
Kernel::raise e
|
791
802
|
|
792
803
|
end
|
793
804
|
|
794
|
-
|
805
|
+
$logger.log "behaviour" , "PASS;Operation move executed successfully with direction \"#{direction}\", distance \"#{distance}\",.;#{identity};move;"
|
806
|
+
|
807
|
+
self
|
795
808
|
|
796
|
-
nil
|
797
809
|
end
|
798
810
|
|
799
811
|
|
@@ -809,10 +821,7 @@ module MobyBehaviour
|
|
809
821
|
center_y
|
810
822
|
end
|
811
823
|
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
private
|
824
|
+
private
|
816
825
|
|
817
826
|
# Performs the actual gesture operation.
|
818
827
|
# Verifies that the parameters are correct and send the command
|
@@ -873,19 +882,23 @@ module MobyBehaviour
|
|
873
882
|
|
874
883
|
end
|
875
884
|
|
876
|
-
|
877
885
|
def do_sleep(time)
|
878
886
|
|
879
|
-
if
|
880
|
-
|
881
|
-
time = time * 1.3
|
887
|
+
if $parameters[ @sut.id ][ :sleep_disabled, nil ] != true
|
888
|
+
|
889
|
+
time = time.to_f * 1.3
|
890
|
+
|
882
891
|
#for flicks the duration of the gesture is short but animation (scroll etc..) may not
|
883
892
|
#so wait at least one second
|
884
|
-
time = 1 if time < 1
|
893
|
+
time = 1 if time < 1
|
894
|
+
|
885
895
|
sleep time
|
896
|
+
|
886
897
|
else
|
887
|
-
|
888
|
-
|
898
|
+
|
899
|
+
# store the biggest value which will then be used in multitouch situations to sleep
|
900
|
+
$parameters[ @sut.id ][ :skipped_sleep_time ] = time if time > $parameters[ @sut.id ][ :skipped_sleep_time, 0 ]
|
901
|
+
|
889
902
|
end
|
890
903
|
|
891
904
|
end
|
@@ -913,7 +926,7 @@ module MobyBehaviour
|
|
913
926
|
end
|
914
927
|
|
915
928
|
# enable hooking for performance measurement & debug logging
|
916
|
-
|
929
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
917
930
|
|
918
931
|
end
|
919
932
|
|