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.
Files changed (46) hide show
  1. data/installer/extconf.rb +1 -1
  2. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/action.rb +5 -5
  3. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb +174 -236
  4. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/attribute.rb +3 -3
  5. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/behaviour.rb +5 -5
  6. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb +7 -7
  7. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb +7 -7
  8. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/file_transfer.rb +1 -1
  9. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb +3 -3
  10. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fixture.rb +5 -5
  11. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/gesture.rb +73 -60
  12. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb +3 -3
  13. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/key_press.rb +6 -6
  14. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/locale_db.rb +8 -8
  15. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/method.rb +1 -1
  16. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/multitouch.rb +348 -329
  17. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/os.rb +5 -5
  18. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/qt_api_method.rb +3 -3
  19. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/record.rb +7 -7
  20. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/screen_capture.rb +9 -9
  21. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/sut.rb +79 -27
  22. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb +3 -3
  23. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/treewidgetitemcolumn.rb +5 -5
  24. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/type_text.rb +3 -3
  25. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/view_item.rb +5 -5
  26. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/webkit.rb +13 -11
  27. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/widget.rb +70 -67
  28. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb +1 -1
  29. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/configure_command.rb +1 -1
  30. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/find_object.rb +1 -1
  31. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/fixture.rb +2 -3
  32. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/group.rb +1 -1
  33. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/infologger_command.rb +1 -1
  34. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/key_sequence.rb +3 -3
  35. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/screen_capture.rb +1 -1
  36. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/tap.rb +1 -1
  37. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/widget.rb +30 -14
  38. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/plugin.rb +8 -3
  39. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/adapter.rb +160 -29
  40. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb +6 -8
  41. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/controller.rb +13 -2
  42. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/find_object_generator.rb +50 -35
  43. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/message_composer.rb +129 -95
  44. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/widget.rb +4 -4
  45. data/xml/behaviour/qt.xml +8 -12
  46. metadata +53 -72
data/installer/extconf.rb CHANGED
@@ -23,7 +23,7 @@ require 'rubygems'
23
23
 
24
24
  begin
25
25
 
26
- require 'tdriver/util/common'
26
+ require 'tdriver/util/loader'
27
27
 
28
28
  rescue LoadError => exception
29
29
 
@@ -88,12 +88,12 @@ module MobyBehaviour
88
88
 
89
89
  rescue Exception => e
90
90
 
91
- MobyUtil::Logger.instance.log "behaviour" , "FAIL;Failed hover with refresh \"#{ refresh.to_s }\".;#{ identity };hover;"
91
+ $logger.log "behaviour" , "FAIL;Failed hover with refresh \"#{ refresh.to_s }\".;#{ identity };hover;"
92
92
  Kernel::raise e
93
93
 
94
94
  end
95
95
 
96
- MobyUtil::Logger.instance.log "behaviour" , "PASS;Hover operation executed successfully with refresh \"#{ refresh.to_s }\".;#{ identity };hover;"
96
+ $logger.log "behaviour" , "PASS;Hover operation executed successfully with refresh \"#{ refresh.to_s }\".;#{ identity };hover;"
97
97
  nil
98
98
  end
99
99
 
@@ -136,17 +136,17 @@ module MobyBehaviour
136
136
 
137
137
  rescue Exception => e
138
138
 
139
- MobyUtil::Logger.instance.log "behaviour" , "FAIL;Failed trigger with refresh \"#{ refresh.to_s }\".;#{ identity };trigger;"
139
+ $logger.log "behaviour" , "FAIL;Failed trigger with refresh \"#{ refresh.to_s }\".;#{ identity };trigger;"
140
140
  Kernel::raise e
141
141
 
142
142
  end
143
143
 
144
- MobyUtil::Logger.instance.log "behaviour" , "PASS;Trigger operation executed successfully with refresh \"#{ refresh.to_s }\".;#{ identity };trigger;"
144
+ $logger.log "behaviour" , "PASS;Trigger operation executed successfully with refresh \"#{ refresh.to_s }\".;#{ identity };trigger;"
145
145
  nil
146
146
  end
147
147
 
148
148
  # enable hooking for performance measurement & debug logging
149
- MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
149
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
150
150
 
151
151
 
152
152
  end # Action
@@ -17,7 +17,8 @@
17
17
  ##
18
18
  ############################################################################
19
19
 
20
- include TDriverVerify
20
+ # why include TDriverVerify here?
21
+ #include TDriverVerify
21
22
 
22
23
  module MobyBehaviour
23
24
 
@@ -44,277 +45,214 @@ module MobyBehaviour
44
45
  # == objects
45
46
  # Application
46
47
  #
47
- module Application
48
- # == nodoc
49
- # == description
50
- # Drag from the start coordinates to the end coordinates.
51
- #
48
+ module Application
49
+
50
+ # == description
51
+ # Start to track a popup that may appear on the screen. Tracking is done based on the class name of the
52
+ # widget implementing popup functionality. Base class name can also be used in case framework level
53
+ # popup base class is available. The idea of the detection is to track info notes that appear
54
+ # on the screen for a moment and are therefore difficult to verify manually.
55
+ #
52
56
  # == arguments
53
- # start_x
54
- # Integer
55
- # description: Starting x coordinate
56
- # example: 10
57
- #
57
+ # class_name
58
+ # String
59
+ # description: Name of the popup implementation class. Base class name can also be used.
60
+ # example: PopupClass
61
+ #
62
+ # wait_time
63
+ # Integer
64
+ # description: How long to wait for the popup to appear
65
+ # example: 5
66
+ #
67
+ # == returns
68
+ # NilClass
69
+ # description: -
70
+ # example: -
71
+ #
72
+ def track_popup(class_name, wait_time=1)
73
+ wait_time = wait_time*1000
74
+ fixture('popup', 'waitPopup',{:className => class_name, :interval => wait_time.to_s})
75
+ end
76
+
77
+ # == description
78
+ # Verify was the popup on the screen or not. The method uses TDriver verify internally for the verification.
79
+ # If the popup was shown then the entire application ui state is returned as a test object.
80
+ # More detailed verification can be done for the object (e.g. the content of the popup, labels etc...).
81
+ # \n
82
+ # [b]NOTE:[/b] If the popup does not close the verification will fail. Detection is based on grabbing the ui state just before the popup closes.
83
+ #
58
84
  # == arguments
59
- # start_y
60
- # Integer
61
- # description: Starting y coordinate
62
- # example: 10
63
- #
85
+ # class_name
86
+ # String
87
+ # description: Name of the popup implementation class. Base class name can also be used.
88
+ # example: PopupClass
89
+ #
90
+ # time_out
91
+ # Integer
92
+ # description: Time in seconds for how long to wait for the popup data.
93
+ # example: 5
94
+ #
95
+ # == returns
96
+ # TestObject
97
+ # description: An ui state test object from the time the popup was detected. Can be used the same way as other test objects.
98
+ # example: -
99
+ #
100
+ #
101
+ def verify_popup(class_name, time_out = 5)
102
+
103
+ xml_source = nil
104
+
105
+ verify(time_out){
106
+ xml_source = @sut.application.fixture('popup', 'printPopup',{:className => class_name})
107
+ }
108
+
109
+ MobyBase::StateObject.new( xml_source )
110
+
111
+ end
112
+
113
+ # == description
114
+ # Taps the given objects at the same time (multitouch).
115
+ #
64
116
  # == arguments
65
- # end_x
66
- # Integer
67
- # description: End x coordinate
68
- # example: 30
69
- #
70
- # == arguments
71
- # end_y
72
- # Integer
73
- # description: End y coordinate
74
- # example: 100
75
- #
76
- # duration
77
- # Integer
78
- # description: How long will the drag take in millis
79
- # example: 1000
80
- #
81
- # == returns
82
- # NilClass
83
- # description: -
84
- # example: -
85
- #
86
- def drag( start_x, start_y, end_x, end_y, duration = 1000 )
87
-
88
- @sut.execute_command( MobyCommand::Drag.new( start_x, start_y, end_x, end_y, duration ) )
89
-
90
- end
91
-
92
- # == description
93
- # Kills the application process
94
- #
95
- # == returns
96
- # NilClass
97
- # description: -
98
- # example: -
99
- #
100
- def kill
101
-
102
- @sut.execute_command( MobyCommand::Application.new( :Kill, self.executable_name, self.uid, self.sut, nil ) )
103
-
104
- end
105
-
106
- # == description
107
- # Start to track a popup that may appear on the screen. Tracking is done based on the class name of the
108
- # widget implementing popup functionality. Base class name can also be used in case framework level
109
- # popup base class is available. The idea of the detection is to track info notes that appear
110
- # on the screen for a moment and are therefore difficult to verify manually.
111
- #
112
- # == arguments
113
- # class_name
114
- # String
115
- # description: Name of the popup implementation class. Base class name can also be used.
116
- # example: PopupClass
117
- #
118
- # wait_time
119
- # Integer
120
- # description: How long to wait for the popup to appear
121
- # example: 5
122
- #
123
- # == returns
124
- # NilClass
125
- # description: -
126
- # example: -
127
- #
128
- def track_popup(class_name, wait_time=1)
129
- wait_time = wait_time*1000
130
- fixture('popup', 'waitPopup',{:className => class_name, :interval => wait_time.to_s})
131
- end
132
-
133
- # == description
134
- # Verify was the popup on the screen or not. The method uses TDriver verify internally for the verification.
135
- # If the popup was shown then the entire application ui state is returned as a test object.
136
- # More detailed verification can be done for the object (e.g. the content of the popup, labels etc...).
137
- # \n
138
- # [b]NOTE:[/b] If the popup does not close the verification will fail. Detection is based on grabbing the ui state just before the popup closes.
139
- #
140
- # == arguments
141
- # class_name
142
- # String
143
- # description: Name of the popup implementation class. Base class name can also be used.
144
- # example: PopupClass
145
- #
146
- # time_out
147
- # Integer
148
- # description: Time in seconds for how long to wait for the popup data.
149
- # example: 5
150
- #
151
- # == returns
152
- # TestObject
153
- # description: An ui state test object from the time the popup was detected. Can be used the same way as other test objects.
154
- # example: -
155
- #
156
- #
157
- def verify_popup(class_name, time_out = 5)
158
- xml_source = nil
159
- verify(time_out) {xml_source = @sut.application.fixture('popup', 'printPopup',{:className => class_name})}
160
- MobyBase::StateObject.new( xml_source )
161
- end
162
-
163
- # == description
164
- # Bring the application to foreground.\n
165
- # \n
166
- # [b]NOTE:[/b] Currently this works only for Symbian OS target!
167
- #
168
- # == returns
169
- # NilClass
170
- # description: -
171
- # example: -
172
- #
173
- #
174
- def bring_to_foreground
175
- @sut.execute_command(MobyCommand::Application.new(:BringToForeground, nil, self.uid, self.sut))
176
- end
177
-
178
- # == description
179
- # Taps the given objects at the same time (multitouch).
180
- #
181
- # == arguments
182
- # objects
183
- # Array
184
- # description: Array of objects to tap.
185
- # example: [@app.Square( :name => 'topLeft' ), @app.Square( :name => 'topRight' )]
186
- #
187
- # == returns
188
- # NilClass
189
- # description: -
190
- # example: -
191
- #
192
- # == exceptions
117
+ # objects
118
+ # Array
119
+ # description: Array of objects to tap.
120
+ # example: [@app.Square( :name => 'topLeft' ), @app.Square( :name => 'topRight' )]
121
+ #
122
+ # == returns
123
+ # NilClass
124
+ # description: -
125
+ # example: -
126
+ #
127
+ # == exceptions
193
128
  # ArgumentError
194
129
  # description: objects is not an array
195
130
  #
196
- def tap_objects(objects)
131
+ def tap_objects(objects)
197
132
 
198
- raise ArgumentError.new("Nothing to tap") unless objects.kind_of?(Array)
133
+ raise ArgumentError.new("Nothing to tap") unless objects.kind_of?(Array)
199
134
 
200
- multitouch_operation{
201
- objects.each { |o| o.tap }
202
- }
135
+ multitouch_operation{
136
+ objects.each { |o| o.tap }
137
+ }
203
138
 
204
- end
139
+ end
205
140
 
206
- # == description
207
- # Taps down the given objects at the same time (multitouch).
208
- #
141
+ # == description
142
+ # Taps down the given objects at the same time (multitouch).
143
+ #
209
144
  # == arguments
210
- # objects
211
- # Array
212
- # description: Array of objects to tap down.
213
- # example: [@app.Square( :name => 'topLeft' ), @app.Square( :name => 'topRight' )]
214
- #
215
- # == returns
216
- # NilClass
217
- # description: -
218
- # example: -
219
- #
220
- # == exceptions
145
+ # objects
146
+ # Array
147
+ # description: Array of objects to tap down.
148
+ # example: [@app.Square( :name => 'topLeft' ), @app.Square( :name => 'topRight' )]
149
+ #
150
+ # == returns
151
+ # NilClass
152
+ # description: -
153
+ # example: -
154
+ #
155
+ # == exceptions
221
156
  # ArgumentError
222
157
  # description: objects is not an array
223
158
  #
224
- def tap_down_objects(objects)
159
+ def tap_down_objects(objects)
225
160
 
226
- raise ArgumentError.new("Nothing to tap") unless objects.kind_of?(Array)
161
+ raise ArgumentError, 'Nothing to tap' unless objects.kind_of?( Array )
227
162
 
228
- multitouch_operation{
229
- objects.each { |o| o.tap_down }
230
- }
163
+ multitouch_operation{
164
+ objects.each { |o| o.tap_down }
165
+ }
231
166
 
232
- end
167
+ end
233
168
 
234
169
 
235
- # == description
236
- # Taps up the given objects at the same time (multitouch).
237
- #
170
+ # == description
171
+ # Taps up the given objects at the same time (multitouch).
172
+ #
238
173
  # == arguments
239
- # objects
240
- # Array
241
- # description: Array of objects to tap up.
242
- # example: [@app.Square( :name => 'topLeft' ), @app.Square( :name => 'topRight' )]
243
- #
244
- # == returns
245
- # NilClass
246
- # description: -
247
- # example: -
248
- #
249
- # == exceptions
174
+ # objects
175
+ # Array
176
+ # description: Array of objects to tap up.
177
+ # example: [@app.Square( :name => 'topLeft' ), @app.Square( :name => 'topRight' )]
178
+ #
179
+ # == returns
180
+ # NilClass
181
+ # description: -
182
+ # example: -
183
+ #
184
+ # == exceptions
250
185
  # ArgumentError
251
186
  # description: objects is not an array
252
187
  #
253
- def tap_up_objects(objects)
188
+ def tap_up_objects(objects)
254
189
 
255
- raise ArgumentError.new("Nothing to tap") unless objects.kind_of?(Array)
190
+ raise ArgumentError, 'Nothing to tap' unless objects.kind_of?( Array )
256
191
 
257
- multitouch_operation{
258
- objects.each { |o| o.tap_up }
259
- }
192
+ multitouch_operation{
193
+ objects.each { |o| o.tap_up }
194
+ }
260
195
 
261
- end
196
+ end
262
197
 
263
- # == description
264
- # Performs the given operations at the same time (when possible).\n
265
- # \n
266
- # [b]NOTE:[/b] Only UI behaviours can be used here (e.g. taps, gestures).
267
- #
198
+ # == description
199
+ # Performs the given operations at the same time (when possible).\n
200
+ # \n
201
+ # [b]NOTE:[/b] Only UI behaviours can be used here (e.g. taps, gestures).
202
+ #
268
203
  # == arguments
269
- # &block
270
- # Proc
271
- # description: code block containing the operations to perform.
272
- # example: {@app.ScribbleArea.tap_object(400,50)
273
- # @app.ScribbleArea.gesture(:Right, 1, 50)}
274
- # == returns
275
- # NilClass
276
- # description: -
277
- # example: -
278
- #
279
- #
280
- def multi_touch(&block)
281
-
282
- multitouch_operation(&block)
283
-
284
- end
285
-
286
- private
287
-
288
- def multitouch_operation(&block)
289
-
290
- #make sure the situation is ok before freeze
291
- self.force_refresh
292
-
293
- @sut.freeze
204
+ # &block
205
+ # Proc
206
+ # description: code block containing the operations to perform.
207
+ # example: {@app.ScribbleArea.tap_object(400,50)
208
+ # @app.ScribbleArea.gesture(:Right, 1, 50)}
209
+ # == returns
210
+ # NilClass
211
+ # description: -
212
+ # example: -
213
+ #
214
+ #
215
+ def multi_touch(&block)
216
+
217
+ multitouch_operation(&block)
218
+
219
+ end
220
+
221
+ private
222
+
223
+ def multitouch_operation(&block)
224
+
225
+ #make sure the situation is ok before freeze
226
+ find_object_state = @sut.parameter[ :use_find_object, false ]
227
+ @sut.parameter[ :use_find_object] = false
228
+ self.force_refresh
229
+
230
+ @sut.freeze
294
231
 
295
- #disable sleep to avoid unnecessary sleeping
296
- MobyUtil::Parameter[ @sut.id ][ :sleep_disabled] = 'true'
232
+ #disable sleep to avoid unnecessary sleeping
233
+ @sut.parameter[ :sleep_disabled ] = true
297
234
 
298
- command = MobyCommand::Group.new(0, self, block )
299
- command.set_multitouch(true)
300
- ret = @sut.execute_command( command )
301
-
302
- MobyUtil::Parameter[ @sut.id ][ :sleep_disabled] = 'false'
235
+ command = MobyCommand::Group.new(0, self, block )
236
+ command.set_multitouch(true)
237
+ ret = @sut.execute_command( command )
238
+
239
+ @sut.parameter[ :sleep_disabled ] = false
303
240
 
304
- #sleep the biggest stored value
305
- sleep MobyUtil::Parameter[ @sut.id ][ :skipped_sleep_time, 0 ] if MobyUtil::Parameter[ @sut.id ][ :skipped_sleep_time, 0 ] > 0
241
+ #sleep the biggest stored value
242
+ sleep @sut.parameter[ :skipped_sleep_time, 0 ] if @sut.parameter[ :skipped_sleep_time, 0 ] > 0
306
243
 
307
- #reset to 0
308
- MobyUtil::Parameter[ @sut.id ][ :skipped_sleep_time] = 0
244
+ #reset values
245
+ @sut.parameter[ :skipped_sleep_time ] = 0
246
+ @sut.parameter[ :use_find_object] = find_object_state
247
+
248
+ @sut.unfreeze
309
249
 
310
- @sut.unfreeze
311
-
312
250
  end
313
-
251
+
314
252
  # enable hooking for performance measurement & debug logging
315
- MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
253
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
316
254
 
317
- end # Application
255
+ end # Application
318
256
 
319
257
  end # QT
320
258