testability-driver-qt-sut-plugin 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/action.rb +7 -6
  2. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb +190 -182
  3. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/attribute.rb +2 -2
  4. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/behaviour.rb +17 -17
  5. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb +6 -6
  6. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb +6 -6
  7. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb +2 -2
  8. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fixture.rb +10 -14
  9. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fps.rb +7 -7
  10. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/gesture.rb +387 -338
  11. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb +177 -5
  12. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/key_press.rb +5 -5
  13. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/locale_db.rb +2 -1
  14. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/method.rb +34 -7
  15. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/multitouch.rb +4 -4
  16. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/os.rb +4 -4
  17. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/record.rb +6 -6
  18. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/screen_capture.rb +8 -12
  19. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/settings.rb +8 -8
  20. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/sut.rb +171 -115
  21. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb +2 -2
  22. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/treewidgetitemcolumn.rb +11 -7
  23. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/type_text.rb +2 -2
  24. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/view_item.rb +5 -5
  25. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/webkit.rb +13 -13
  26. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/widget.rb +54 -63
  27. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/find_object.rb +45 -28
  28. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/version.rb +34 -0
  29. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb +2 -2
  30. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/application.rb +174 -121
  31. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/find_object.rb +35 -26
  32. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/version.rb +56 -0
  33. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/plugin.rb +64 -16
  34. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/adapter.rb +138 -40
  35. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb +91 -83
  36. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/find_object_generator.rb +222 -44
  37. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/message_composer.rb +176 -10
  38. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/widget.rb +2 -2
  39. data/xml/behaviour/qt.xml +12 -0
  40. metadata +7 -5
@@ -81,19 +81,20 @@ module MobyBehaviour
81
81
  command = command_params #in qt_behaviour
82
82
  command.object_type( :Action )
83
83
  command.command_name( 'Hover' )
84
- command.object_id( @parent.id )
84
+ command.set_object_id( @parent.id )
85
85
  command.command_params( 'id' => id )
86
+
86
87
  @sut.execute_command( command )
87
88
  self.force_refresh({:id => get_application_id}) if refresh
88
89
 
89
90
  rescue Exception => e
90
91
 
91
- $logger.log "behaviour" , "FAIL;Failed hover with refresh \"#{ refresh.to_s }\".;#{ identity };hover;"
92
+ $logger.behaviour "FAIL;Failed hover with refresh \"#{ refresh.to_s }\".;#{ identity };hover;"
92
93
  Kernel::raise e
93
94
 
94
95
  end
95
96
 
96
- $logger.log "behaviour" , "PASS;Hover operation executed successfully with refresh \"#{ refresh.to_s }\".;#{ identity };hover;"
97
+ $logger.behaviour "PASS;Hover operation executed successfully with refresh \"#{ refresh.to_s }\".;#{ identity };hover;"
97
98
  nil
98
99
  end
99
100
 
@@ -128,7 +129,7 @@ module MobyBehaviour
128
129
  command = command_params #in qt_behaviour
129
130
  command.object_type( :Action )
130
131
  command.command_name( 'Trigger' )
131
- command.object_id( @parent.id )
132
+ command.set_object_id( @parent.id )
132
133
  command.command_params( 'id'=>id )
133
134
 
134
135
  @sut.execute_command( command )
@@ -136,12 +137,12 @@ module MobyBehaviour
136
137
 
137
138
  rescue Exception => e
138
139
 
139
- $logger.log "behaviour" , "FAIL;Failed trigger with refresh \"#{ refresh.to_s }\".;#{ identity };trigger;"
140
+ $logger.behaviour "FAIL;Failed trigger with refresh \"#{ refresh.to_s }\".;#{ identity };trigger;"
140
141
  Kernel::raise e
141
142
 
142
143
  end
143
144
 
144
- $logger.log "behaviour" , "PASS;Trigger operation executed successfully with refresh \"#{ refresh.to_s }\".;#{ identity };trigger;"
145
+ $logger.behaviour "PASS;Trigger operation executed successfully with refresh \"#{ refresh.to_s }\".;#{ identity };trigger;"
145
146
  nil
146
147
  end
147
148
 
@@ -45,232 +45,240 @@ module MobyBehaviour
45
45
  # == objects
46
46
  # Application
47
47
  #
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
- #
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
+ #
56
56
  # == arguments
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
- #
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
+
74
+ wait_time = wait_time * 1000
75
+
76
+ fixture( 'popup', 'waitPopup',{ :className => class_name, :interval => wait_time.to_s } )
77
+
78
+ end
79
+
80
+ # == description
81
+ # Verify was the popup on the screen or not. The method uses TDriver verify internally for the verification.
82
+ # If the popup was shown then the entire application ui state is returned as a test object.
83
+ # More detailed verification can be done for the object (e.g. the content of the popup, labels etc...).
84
+ # \n
85
+ # [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.
86
+ #
84
87
  # == arguments
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})
88
+ # class_name
89
+ # String
90
+ # description: Name of the popup implementation class. Base class name can also be used.
91
+ # example: PopupClass
92
+ #
93
+ # time_out
94
+ # Integer
95
+ # description: Time in seconds for how long to wait for the popup data.
96
+ # example: 5
97
+ #
98
+ # == returns
99
+ # TestObject
100
+ # description: An ui state test object from the time the popup was detected. Can be used the same way as other test objects.
101
+ # example: -
102
+ #
103
+ def verify_popup( class_name, time_out = 5 )
104
+
105
+ response = nil
106
+
107
+ verify( time_out ){
108
+
109
+ response = @sut.application.fixture( 'popup', 'printPopup', { :className => class_name } )
110
+
107
111
  }
108
112
 
109
- MobyBase::StateObject.new( xml_source )
113
+ @sut.state_object( response )
110
114
 
111
- end
115
+ end
112
116
 
113
- # == description
114
- # Taps the given objects at the same time (multitouch).
115
- #
117
+ # == description
118
+ # Taps the given objects at the same time (multitouch).
119
+ #
116
120
  # == arguments
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
121
+ # objects
122
+ # Array
123
+ # description: Array of objects to tap.
124
+ # example: [@app.Square( :name => 'topLeft' ), @app.Square( :name => 'topRight' )]
125
+ #
126
+ # == returns
127
+ # NilClass
128
+ # description: -
129
+ # example: -
130
+ #
131
+ # == exceptions
128
132
  # ArgumentError
129
133
  # description: objects is not an array
130
134
  #
131
- def tap_objects(objects)
135
+ def tap_objects(objects)
132
136
 
133
- raise ArgumentError.new("Nothing to tap") unless objects.kind_of?(Array)
137
+ raise ArgumentError.new("Nothing to tap") unless objects.kind_of?(Array)
134
138
 
135
- multitouch_operation{
136
- objects.each { |o| o.tap }
137
- }
139
+ multitouch_operation{
140
+ objects.each { |o| o.tap }
141
+ }
138
142
 
139
- end
143
+ end
140
144
 
141
- # == description
142
- # Taps down the given objects at the same time (multitouch).
143
- #
145
+ # == description
146
+ # Taps down the given objects at the same time (multitouch).
147
+ #
144
148
  # == arguments
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
149
+ # objects
150
+ # Array
151
+ # description: Array of objects to tap down.
152
+ # example: [@app.Square( :name => 'topLeft' ), @app.Square( :name => 'topRight' )]
153
+ #
154
+ # == returns
155
+ # NilClass
156
+ # description: -
157
+ # example: -
158
+ #
159
+ # == exceptions
156
160
  # ArgumentError
157
161
  # description: objects is not an array
158
162
  #
159
- def tap_down_objects(objects)
163
+ def tap_down_objects(objects)
160
164
 
161
- raise ArgumentError, 'Nothing to tap' unless objects.kind_of?( Array )
165
+ raise ArgumentError, 'Nothing to tap' unless objects.kind_of?( Array )
162
166
 
163
- multitouch_operation{
164
- objects.each { |o| o.tap_down }
165
- }
167
+ multitouch_operation{
168
+ objects.each { |o| o.tap_down }
169
+ }
166
170
 
167
- end
171
+ end
168
172
 
169
173
 
170
- # == description
171
- # Taps up the given objects at the same time (multitouch).
172
- #
174
+ # == description
175
+ # Taps up the given objects at the same time (multitouch).
176
+ #
173
177
  # == arguments
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
178
+ # objects
179
+ # Array
180
+ # description: Array of objects to tap up.
181
+ # example: [@app.Square( :name => 'topLeft' ), @app.Square( :name => 'topRight' )]
182
+ #
183
+ # == returns
184
+ # NilClass
185
+ # description: -
186
+ # example: -
187
+ #
188
+ # == exceptions
185
189
  # ArgumentError
186
190
  # description: objects is not an array
187
191
  #
188
- def tap_up_objects(objects)
192
+ def tap_up_objects(objects)
189
193
 
190
- raise ArgumentError, 'Nothing to tap' unless objects.kind_of?( Array )
194
+ raise ArgumentError, 'Nothing to tap' unless objects.kind_of?( Array )
191
195
 
192
- multitouch_operation{
193
- objects.each { |o| o.tap_up }
194
- }
196
+ multitouch_operation{
197
+ objects.each { |o| o.tap_up }
198
+ }
195
199
 
196
- end
200
+ end
197
201
 
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
- #
202
+ # == description
203
+ # Performs the given operations at the same time (when possible).\n
204
+ # \n
205
+ # [b]NOTE:[/b] Only UI behaviours can be used here (e.g. taps, gestures).
206
+ #
203
207
  # == arguments
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
- # == description
222
- # Resizes the application window so that width becomes height and vice versa.
223
- #
208
+ # &block
209
+ # Proc
210
+ # description: code block containing the operations to perform.
211
+ # example: {@app.ScribbleArea.tap_object(400,50)
212
+ # @app.ScribbleArea.gesture(:Right, 1, 50)}
213
+ # == returns
214
+ # NilClass
215
+ # description: -
216
+ # example: -
217
+ #
218
+ #
219
+ def multi_touch(&block)
220
+
221
+ multitouch_operation( &block )
222
+
223
+ end
224
+
225
+ # == description
226
+ # Resizes the application window so that width becomes height and vice versa.
227
+ #
224
228
  # == arguments
225
- # Symbol
226
- # direction
227
- # description: For future support
228
- #
229
- # == returns
230
- # NilClass
231
- # description: -
232
- # example: -
233
- #
234
- #
235
- def change_orientation(direction = nil)
236
- self.fixture('qt','change_orientation')
237
- end
238
-
239
- private
240
-
241
- def multitouch_operation(&block)
242
-
243
- #make sure the situation is ok before freeze
244
- find_object_state = @sut.parameter[ :use_find_object, false ]
245
- @sut.parameter[ :use_find_object] = false
246
- self.force_refresh
247
-
248
- @sut.freeze
229
+ # Symbol
230
+ # direction
231
+ # description: For future support
232
+ #
233
+ # == returns
234
+ # NilClass
235
+ # description: -
236
+ # example: -
237
+ #
238
+ def change_orientation( direction = nil )
239
+
240
+ fixture('qt','change_orientation')
241
+
242
+ end
243
+
244
+ private
245
+
246
+ def multitouch_operation( &block )
247
+
248
+ # make sure the situation is ok before freeze
249
+ find_object_state = @sut.parameter[ :use_find_object, false ]
250
+
251
+ @sut.parameter[ :use_find_object ] = false
252
+ self.force_refresh
253
+
254
+ @sut.freeze
249
255
 
250
- #disable sleep to avoid unnecessary sleeping
251
- @sut.parameter[ :sleep_disabled ] = true
256
+ #disable sleep to avoid unnecessary sleeping
257
+ @sut.parameter[ :sleep_disabled ] = true
258
+
259
+ command = MobyCommand::Group.new( 0, self, block )
260
+
261
+ command.set_multitouch( true )
252
262
 
253
- command = MobyCommand::Group.new(0, self, block )
254
- command.set_multitouch(true)
255
- ret = @sut.execute_command( command )
263
+ @sut.execute_command( command )
256
264
 
257
- @sut.parameter[ :sleep_disabled ] = false
265
+ @sut.parameter[ :sleep_disabled ] = false
258
266
 
259
- #sleep the biggest stored value
260
- sleep @sut.parameter[ :skipped_sleep_time, 0 ] if @sut.parameter[ :skipped_sleep_time, 0 ] > 0
267
+ # sleep the biggest stored value
268
+ sleep @sut.parameter[ :skipped_sleep_time, 0 ].to_f if @sut.parameter[ :skipped_sleep_time, 0 ].to_f > 0
261
269
 
262
- #reset values
263
- @sut.parameter[ :skipped_sleep_time ] = 0
264
- @sut.parameter[ :use_find_object] = find_object_state
270
+ # reset values
271
+ @sut.parameter[ :skipped_sleep_time ] = 0
272
+ @sut.parameter[ :use_find_object] = find_object_state
265
273
 
266
- @sut.unfreeze
274
+ @sut.unfreeze
267
275
 
268
276
  end
269
-
277
+
270
278
  # enable hooking for performance measurement & debug logging
271
279
  TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
272
280
 
273
- end # Application
281
+ end # Application
274
282
 
275
283
  end # QT
276
284