testability-driver-qt-sut-plugin 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/installer/extconf.rb +1 -1
  2. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/action.rb +4 -4
  3. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb +5 -2
  4. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/attribute.rb +130 -91
  5. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb +3 -3
  6. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb +5 -0
  7. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/file_transfer.rb +40 -26
  8. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb +1 -1
  9. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fps.rb +88 -71
  10. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/gesture.rb +10 -10
  11. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb +5 -5
  12. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/key_press.rb +3 -3
  13. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/method.rb +2 -2
  14. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/multitouch.rb +2 -2
  15. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/os.rb +4 -4
  16. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/qt_api_method.rb +5 -5
  17. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/record.rb +3 -3
  18. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/screen_capture.rb +11 -11
  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 +12 -12
  21. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb +7 -7
  22. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/treewidgetitemcolumn.rb +1 -1
  23. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/type_text.rb +1 -1
  24. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/view_item.rb +1 -1
  25. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/webkit.rb +126 -126
  26. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/widget.rb +49 -29
  27. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/group.rb +17 -21
  28. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb +4 -3
  29. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb +59 -86
  30. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/application.rb +19 -17
  31. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/group.rb +13 -10
  32. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/widget.rb +38 -25
  33. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/plugin.rb +6 -7
  34. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/fixture_parameter.rb +1 -1
  35. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/widget.rb +1 -4
  36. data/xml/template/qt.xml +1 -0
  37. metadata +28 -9
data/installer/extconf.rb CHANGED
@@ -27,7 +27,7 @@ begin
27
27
 
28
28
  rescue LoadError => exception
29
29
 
30
- Kernel::raise LoadError.new( "SUT plugin requires TDriver" )
30
+ raise LoadError, 'SUT plugin requires TDriver'
31
31
 
32
32
  end
33
33
 
@@ -85,12 +85,12 @@ module MobyBehaviour
85
85
  command.command_params( 'id' => id )
86
86
 
87
87
  @sut.execute_command( command )
88
- self.force_refresh({:id => get_application_id}) if refresh
88
+ force_refresh(:id => get_application_id) if refresh
89
89
 
90
90
  rescue Exception => e
91
91
 
92
92
  $logger.behaviour "FAIL;Failed hover with refresh \"#{ refresh.to_s }\".;#{ identity };hover;"
93
- Kernel::raise e
93
+ raise e
94
94
 
95
95
  end
96
96
 
@@ -133,12 +133,12 @@ module MobyBehaviour
133
133
  command.command_params( 'id'=>id )
134
134
 
135
135
  @sut.execute_command( command )
136
- self.force_refresh({:id => get_application_id}) if refresh
136
+ force_refresh(:id => get_application_id) if refresh
137
137
 
138
138
  rescue Exception => e
139
139
 
140
140
  $logger.behaviour "FAIL;Failed trigger with refresh \"#{ refresh.to_s }\".;#{ identity };trigger;"
141
- Kernel::raise e
141
+ raise e
142
142
 
143
143
  end
144
144
 
@@ -47,11 +47,12 @@ module MobyBehaviour
47
47
  #
48
48
  module Application
49
49
 
50
-
51
50
  @@__multitouch_operation = false
52
51
 
53
52
  def multitouch_ongoing?
53
+
54
54
  @@__multitouch_operation
55
+
55
56
  end
56
57
 
57
58
  # == description
@@ -239,6 +240,7 @@ module MobyBehaviour
239
240
  # direction
240
241
  # Symbol
241
242
  # description: For future support
243
+ # example: -
242
244
  #
243
245
  # == returns
244
246
  # NilClass
@@ -259,7 +261,8 @@ module MobyBehaviour
259
261
  find_object_state = @sut.parameter[ :use_find_object, false ]
260
262
 
261
263
  @sut.parameter[ :use_find_object ] = false
262
- self.force_refresh
264
+
265
+ force_refresh
263
266
 
264
267
  @sut.freeze
265
268
 
@@ -19,7 +19,7 @@
19
19
 
20
20
  module MobyBehaviour
21
21
 
22
- module QT
22
+ module QT
23
23
 
24
24
  # == description
25
25
  # Behaviours for handling attributes
@@ -42,11 +42,11 @@ module MobyBehaviour
42
42
  # == objects
43
43
  # *
44
44
  #
45
- module Attribute
45
+ module Attribute
46
46
 
47
- include MobyBehaviour::QT::Behaviour
47
+ include MobyBehaviour::QT::Behaviour
48
48
 
49
- # == description
49
+ # == description
50
50
  # Sets an attribute of the target object.
51
51
  #
52
52
  # == arguments
@@ -95,8 +95,8 @@ module MobyBehaviour
95
95
  # default: nil
96
96
  #
97
97
  # == tables
98
- # attribute_types_table
99
- # title: Valid type argument values
98
+ # attribute_types_table
99
+ # title: Valid type argument values
100
100
  # |Type|Example|
101
101
  # |QRect|'10,10,150,150'|
102
102
  # |QPoint|'100,200'|
@@ -114,7 +114,7 @@ module MobyBehaviour
114
114
  # description: One of the arguments is not valid
115
115
  # RuntimeError
116
116
  # description: Setting of the attribute failed
117
- def set_attribute( attribute, value, type = nil )
117
+ def set_attribute( attribute, value, type = nil )
118
118
 
119
119
  # verify attribute argument variable type
120
120
  attribute.check_type [ Symbol, String ], 'wrong argument type $1 for attribute name (expected $2)'
@@ -131,131 +131,170 @@ module MobyBehaviour
131
131
  type.not_empty 'argument type must be either nil or non empty string' if type.kind_of?( String )
132
132
 
133
133
  # in qt_behaviour
134
- command = command_params
134
+ command = command_params
135
135
 
136
- command.transitions_off
136
+ command.transitions_off
137
137
 
138
- command.command_name( 'SetAttribute' )
138
+ command.command_name( 'SetAttribute' )
139
139
 
140
- case type
140
+ case type
141
141
 
142
- when nil
142
+ when nil
143
143
 
144
- # Implicit typing
144
+ # Implicit typing
145
145
 
146
- # by class
147
- if value.kind_of? Integer
148
- params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s.strip, 'attribute_type' => 'int'}
146
+ # by class
147
+ if value.kind_of? Integer
148
+ params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s.strip, 'attribute_type' => 'int'}
149
149
 
150
- elsif value.kind_of? Date
151
- temp_date = value.day.to_s << '.' << value.month.to_s << '.' << value.year.to_s
152
- params = { 'attribute_name' => attribute.to_s, 'attribute_value' => temp_date, 'attribute_type' => 'QDate' }
150
+ elsif value.kind_of? Date
151
+ temp_date = value.day.to_s << '.' << value.month.to_s << '.' << value.year.to_s
152
+ params = { 'attribute_name' => attribute.to_s, 'attribute_value' => temp_date, 'attribute_type' => 'QDate' }
153
153
 
154
- elsif value.kind_of? Time
155
- params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_i.to_s, 'attribute_type' => 'QDateTime' }
154
+ elsif value.kind_of? Time
155
+ params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_i.to_s, 'attribute_type' => 'QDateTime' }
156
156
 
157
- elsif value.kind_of? DateTime
158
- params = { 'attribute_name' => attribute.to_s, 'attribute_value' => Time.parse(value.to_s).to_i.to_s, 'attribute_type' => 'QDateTime' }
157
+ elsif value.kind_of? DateTime
158
+ params = { 'attribute_name' => attribute.to_s, 'attribute_value' => Time.parse(value.to_s).to_i.to_s, 'attribute_type' => 'QDateTime' }
159
159
 
160
- elsif value.kind_of? TrueClass
161
- params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s.downcase, 'attribute_type' => 'bool'}
160
+ elsif value.kind_of? TrueClass
161
+ params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s.downcase, 'attribute_type' => 'bool'}
162
162
 
163
- elsif value.kind_of? FalseClass
164
- params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s.downcase, 'attribute_type' => 'bool'}
163
+ elsif value.kind_of? FalseClass
164
+ params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s.downcase, 'attribute_type' => 'bool'}
165
165
 
166
- else
167
- # by format
168
- # if ( value.kind_of?( Integer ) || ( value.kind_of?( String ) && value.strip == value.strip.to_i.to_s ) )
169
- if value.kind_of?( String ) && value.strip == value.strip.to_i.to_s
170
- params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s.strip, 'attribute_type' => 'int'}
166
+ else
167
+ # by format
168
+ # if ( value.kind_of?( Integer ) || ( value.kind_of?( String ) && value.strip == value.strip.to_i.to_s ) )
169
+ if value.kind_of?( String ) && value.strip == value.strip.to_i.to_s
170
+ params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s.strip, 'attribute_type' => 'int'}
171
171
 
172
- elsif (value == true || value == false || (value.kind_of?(String) && (value.strip.downcase == "true" || value.strip.downcase == "false")))
173
- params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s.downcase, 'attribute_type' => 'bool'}
172
+ elsif (value == true || value == false || (value.kind_of?(String) && (value.strip.downcase == "true" || value.strip.downcase == "false")))
173
+ params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s.downcase, 'attribute_type' => 'bool'}
174
174
 
175
- else
176
- params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s, 'attribute_type' => 'string'}
175
+ else
176
+ params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s, 'attribute_type' => 'string'}
177
177
 
178
- end
178
+ end
179
179
 
180
- end
180
+ end
181
181
 
182
- when "QRect"
183
- params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s, 'attribute_type' => 'QRect'}
182
+ when "QRect"
183
+ params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s, 'attribute_type' => 'QRect'}
184
184
 
185
- when "QPoint"
186
- params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s, 'attribute_type' => 'QPoint'}
185
+ when "QPoint"
186
+ params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s, 'attribute_type' => 'QPoint'}
187
187
 
188
- when "QSize"
189
- params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s, 'attribute_type' => 'QSize'}
188
+ when "QSize"
189
+ params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s, 'attribute_type' => 'QSize'}
190
190
 
191
- when "QDateTime"
191
+ when "QDateTime"
192
192
 
193
- params = { 'attribute_name' => attribute.to_s, 'attribute_type' => 'QDateTime' }
193
+ params = { 'attribute_name' => attribute.to_s, 'attribute_type' => 'QDateTime' }
194
194
 
195
- if value.kind_of? String
196
- params[ 'attribute_value' ] = value.to_s
195
+ if value.kind_of? String
196
+ params[ 'attribute_value' ] = value.to_s
197
197
 
198
- elsif value.kind_of? Integer
199
- params[ 'attribute_value' ] = value.to_s
198
+ elsif value.kind_of? Integer
199
+ params[ 'attribute_value' ] = value.to_s
200
200
 
201
- elsif value.kind_of? Time
202
- params[ 'attribute_value' ] = value.to_i.to_s
201
+ elsif value.kind_of? Time
202
+ params[ 'attribute_value' ] = value.to_i.to_s
203
203
 
204
- elsif value.kind_of? DateTime
205
- params[ 'attribute_value' ] = Time.parse( value.to_s ).to_i.to_s
204
+ elsif value.kind_of? DateTime
205
+ params[ 'attribute_value' ] = Time.parse( value.to_s ).to_i.to_s
206
206
 
207
- else
208
- Kernel::raise ArgumentError.new( "The value for QDateTime type attributes must be of type String, Integer, Time or DateTime, it was #{value.class.to_s}." )
207
+ else
208
+ raise ArgumentError.new( "The value for QDateTime type attributes must be of type String, Integer, Time or DateTime, it was #{value.class.to_s}." )
209
209
 
210
- end
210
+ end
211
211
 
212
- when "QDate"
212
+ when "QDate"
213
213
 
214
- params = { 'attribute_name' => attribute.to_s, 'attribute_type' => 'QDate' }
214
+ params = { 'attribute_name' => attribute.to_s, 'attribute_type' => 'QDate' }
215
215
 
216
- if value.kind_of? String
217
- params[ 'attribute_value' ] = value.to_s
216
+ if value.kind_of? String
217
+ params[ 'attribute_value' ] = value.to_s
218
218
 
219
- elsif value.kind_of? Date
220
- temp_date = value.day.to_s << '.' << value.month.to_s << '.' << value.year.to_s
221
- params[ 'attribute_value' ] = temp_date
219
+ elsif value.kind_of? Date
220
+ temp_date = value.day.to_s << '.' << value.month.to_s << '.' << value.year.to_s
221
+ params[ 'attribute_value' ] = temp_date
222
222
 
223
- else
224
- Kernel::raise ArgumentError.new( "The value for QDate type attributes must be of type String or Date, it was #{value.class.to_s}." )
223
+ else
224
+ raise ArgumentError.new( "The value for QDate type attributes must be of type String or Date, it was #{value.class.to_s}." )
225
225
 
226
- end
226
+ end
227
227
 
228
- else
228
+ else
229
229
 
230
- #puts "Unidentified.\nName: " << attribute.to_s << "\nValue: " << value.to_s << "\nType: " << type.to_s
231
- params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s, 'attribute_type' => type.to_s }
230
+ #puts "Unidentified.\nName: " << attribute.to_s << "\nValue: " << value.to_s << "\nType: " << type.to_s
231
+ params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s, 'attribute_type' => type.to_s }
232
232
 
233
- end
233
+ end
234
234
 
235
- command.command_params( params )
236
- command.service( 'objectManipulation' )
237
- returnValue = @sut.execute_command( command )
238
-
239
- returnValue = "OK"
240
- begin
241
- returnValue = @sut.execute_command( command )
242
- rescue
243
- $logger.behaviour "FAIL;Failed when calling method set_attribute with values attribute:#{attribute.to_s} value:#{value.to_s}.;#{identity};set_attribute;"
244
- Kernel::raise RuntimeError.new("Setting attribute '%s' to value '%s' failed with error: %s" % [attribute, value, returnValue])
245
- end
246
-
247
- $logger.behaviour "PASS;The method set_attribute was executed successfully with with values attribute:#{attribute.to_s} value:#{value.to_s}.;#{identity};set_attribute;"
248
-
249
- nil
235
+ command.command_params( params )
236
+ command.service( 'objectManipulation' )
237
+ returnValue = @sut.execute_command( command )
238
+
239
+ returnValue = "OK"
240
+ begin
241
+ returnValue = @sut.execute_command( command )
242
+ rescue
243
+ $logger.behaviour "FAIL;Failed when calling method set_attribute with values attribute:#{attribute.to_s} value:#{value.to_s}.;#{identity};set_attribute;"
244
+ raise RuntimeError.new("Setting attribute '%s' to value '%s' failed with error: %s" % [attribute, value, returnValue])
245
+ end
246
+
247
+ $logger.behaviour "PASS;The method set_attribute was executed successfully with with values attribute:#{attribute.to_s} value:#{value.to_s}.;#{identity};set_attribute;"
248
+
249
+ nil
250
250
 
251
251
 
252
- end
252
+ end
253
253
 
254
- # enable hooking for performance measurement & debug logging
255
- TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
254
+ # == description
255
+ # Wrapper method to set test object's attribute value. See [link="#QtAttribute:set_attribute"]supported value argument types[/link] and [link="#attribute_types_table"]attribute types table[/link].\n\n
256
+ # Minimum number of required arguments is 2; attribute name and new value. Please see examples for correct call sequence.
257
+ #
258
+ # == arguments
259
+ # name
260
+ # String
261
+ # description: Attribute name
262
+ # example: "attribute_name"
263
+ # *arguments
264
+ # Array
265
+ # description: Attribute value and type
266
+ # example: ["0,0", "QPoint"]
267
+ #
268
+ # == returns
269
+ # NilClass
270
+ # description: -
271
+ # example: -
272
+ def []=( name, *arguments )
273
+
274
+ _argument_count = arguments.count
275
+
276
+ if _argument_count == 0 || _argument_count > 2
277
+
278
+ raise ArgumentError, "wrong number of arguments (#{ _argument_count } of 2)"
279
+
280
+ elsif _argument_count == 2
281
+
282
+ # set_attribute( name, arguments.last, arguments.first )
283
+ arguments.reverse!
284
+
285
+ end
286
+
287
+ # do magic
288
+ set_attribute( name, *arguments )
289
+
290
+ nil
291
+
292
+ end
256
293
 
294
+ # enable hooking for performance measurement & debug logging
295
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
257
296
 
258
- end
297
+ end
259
298
 
260
- end
299
+ end
261
300
  end
@@ -228,7 +228,7 @@ module MobyBehaviour
228
228
  rescue Exception => e
229
229
 
230
230
  $logger.behaviour "FAIL;Failed to enable event logging. With event_list \"#{event_list};log_events"
231
- Kernel::raise e
231
+ raise e
232
232
 
233
233
  end
234
234
 
@@ -253,7 +253,7 @@ module MobyBehaviour
253
253
  rescue Exception => e
254
254
 
255
255
  $logger.behaviour "FAIL;Failed to stop event logging.;stop_event_logging"
256
- Kernel::raise e
256
+ raise e
257
257
 
258
258
  end
259
259
 
@@ -288,7 +288,7 @@ module MobyBehaviour
288
288
  rescue Exception => e
289
289
 
290
290
  $logger.behaviour "FAIL;Failed to configure logger. With params \"#{params_hash.to_s};configure_logger"
291
- Kernel::raise e
291
+ raise e
292
292
 
293
293
  end
294
294
 
@@ -60,6 +60,11 @@ module MobyBehaviour
60
60
  # description: Array of the event named to listen
61
61
  # example: ["Timer","MouseButtonPress","45677","67889"]
62
62
  #
63
+ # params
64
+ # Hash
65
+ # description: -
66
+ # example: -
67
+ #
63
68
  # == returns
64
69
  # NilClass
65
70
  # description: -
@@ -70,8 +70,9 @@ module MobyBehaviour
70
70
  #
71
71
  # == info
72
72
  #
73
- def delete_from_sut(arguments)
74
- MobyBase::Error.raise( :WrongArgumentType, arguments.class, "hash" ) unless arguments.kind_of?( Hash )
73
+ def delete_from_sut( arguments )
74
+
75
+ arguments.check_type Hash, "wrong argument type $1 for #{ __method__.to_s } method (expected $2)"
75
76
 
76
77
  if arguments.include?( :file )
77
78
 
@@ -107,8 +108,8 @@ module MobyBehaviour
107
108
 
108
109
  else
109
110
 
110
- Kernel::raise ArgumentError.new( "Argument :file not found") unless arguments.include?( :file )
111
- Kernel::raise ArgumentError.new( "Argument :dir not found") unless arguments.include?( :dir )
111
+ arguments.require_key :file, 'Argument $1 not found'
112
+ arguments.require_key :dir, 'Argument $1 not found'
112
113
 
113
114
  end
114
115
 
@@ -137,8 +138,9 @@ module MobyBehaviour
137
138
  #
138
139
  # == info
139
140
  #
140
- def copy_from_sut(arguments)
141
- MobyBase::Error.raise( :WrongArgumentType, arguments.class, "hash" ) unless arguments.kind_of?( Hash )
141
+ def copy_from_sut( arguments )
142
+
143
+ arguments.check_type Hash, "wrong argument type $1 for #{ __method__.to_s } method (expected $2)"
142
144
 
143
145
  device_path=arguments[ :from ].gsub('\\','/') if arguments.include?( :from )
144
146
 
@@ -169,8 +171,10 @@ module MobyBehaviour
169
171
  end
170
172
  return list_of_files
171
173
  else
172
- Kernel::raise ArgumentError.new( "Argument :file not found") unless arguments.include?( :file )
173
- return receive_file_from_device(File.join(tmp_path,name),File.join(tmp_path,name))
174
+
175
+ arguments.require_key :file, 'Argument $1 not found'
176
+
177
+ receive_file_from_device(file,File.join(arguments[ :to ],File.basename(file)))
174
178
 
175
179
  end
176
180
  end
@@ -200,13 +204,15 @@ module MobyBehaviour
200
204
  # == info
201
205
  #
202
206
  def copy_to_sut(arguments)
203
- MobyBase::Error.raise( :WrongArgumentType, arguments.class, "hash" ) unless arguments.kind_of?( Hash )
204
- Kernel::raise ArgumentError.new( "Argument :to not found") unless arguments.include?( :to )
207
+
208
+ arguments.check_type Hash, "wrong argument type $1 for #{ __method__.to_s } method (expected $2)"
209
+
210
+ arguments.require_key :to, 'Argument $1 not found'
205
211
 
206
212
  begin
207
213
  local_dir = Dir.new( arguments[ :from ] ) if arguments.include?( :from )
208
- rescue Errno::ENOENT => ee
209
- Kernel::raise RuntimeError.new( "The source folder does not exist. Details:\n" + ee.inspect )
214
+ rescue Errno::ENOENT
215
+ raise RuntimeError, "The source folder does not exist. Details:\n#{ $!.inspect }"
210
216
  end
211
217
 
212
218
  if arguments[ :file ]!=nil
@@ -220,7 +226,9 @@ module MobyBehaviour
220
226
  fixture("file","mk_dir",{:file_name=>"#{arguments[ :to ]}"})
221
227
 
222
228
  if arguments.include?( :file )==false
223
- Kernel::raise ArgumentError.new( "Argument :from not found") unless arguments.include?( :from )
229
+
230
+ arguments.require_key :from, 'Argument $1 not found'
231
+
224
232
  local_dir.entries.each do | local_file_or_subdir |
225
233
  if !File.directory?( File.join( arguments[ :from ], local_file_or_subdir ) )
226
234
  send_file_to_device(
@@ -249,10 +257,12 @@ module MobyBehaviour
249
257
  end
250
258
  end
251
259
  else
252
- Kernel::raise ArgumentError.new( "Argument :file not found") unless arguments.include?( :file )
260
+
261
+ arguments.require_key :file, 'Argument $1 not found'
262
+
253
263
  fixture("file","mk_dir",{:file_name=>{:file_name=>arguments[ :to ]}})
254
264
  send_file_to_device(
255
- File.join(Dir.pwd,file),
265
+ file,
256
266
  File.join(arguments[ :to ],File.basename(file))
257
267
  )
258
268
  transfered_files << "#{arguments[ :to ]}/#{File.basename(file)}"
@@ -282,9 +292,12 @@ module MobyBehaviour
282
292
  #
283
293
  # == Info
284
294
  #
285
- def list_files_from_sut(arguments)
286
- MobyBase::Error.raise( :WrongArgumentType, arguments.class, "hash" ) unless arguments.kind_of?( Hash )
287
- Kernel::raise ArgumentError.new( "Argument :from not found") unless arguments.include?( :from )
295
+ def list_files_from_sut( arguments )
296
+
297
+ arguments.check_type Hash, "wrong argument type $1 for #{ __method__.to_s } method (expected $2)"
298
+
299
+ arguments.require_key :from, 'Argument $1 not found'
300
+
288
301
  device_path=arguments[ :from ].gsub('\\','/')
289
302
 
290
303
  if arguments[ :file ]!=nil
@@ -306,7 +319,7 @@ module MobyBehaviour
306
319
  FileUtils.mkdir_p File.dirname(local_file)
307
320
  end
308
321
  new_file = File.new(local_file, 'wb')
309
- block_size = 100000
322
+ block_size = sut_parameters[:qt_file_transfer_block_size].to_i
310
323
  temp_size = block_size
311
324
  offset = 0
312
325
  while( temp_size == block_size )
@@ -318,6 +331,7 @@ module MobyBehaviour
318
331
  temp_size = temp_data.size
319
332
  offset = offset + temp_size
320
333
  new_file.write(temp_data)
334
+ print "\r Downloaded #{offset} bytes of #{device_file}"
321
335
  end
322
336
  new_file.close
323
337
  return local_file
@@ -325,11 +339,10 @@ module MobyBehaviour
325
339
 
326
340
  def send_file_to_device(local_file, device_file)
327
341
  fixture("file", "delete_file", {:file_name => device_file})
328
- block_max_size = 100000
342
+ block_max_size = sut_parameters[:qt_file_transfer_block_size].to_i
329
343
  offset = 0
330
- file_size = File.stat(local_file).size
331
-
332
- file_to_be_sent = File.open(local_file,"rb")
344
+ file_size = File::Stat.new(local_file).size
345
+ file_to_be_sent = File.open(local_file,"rb")
333
346
  while(offset < file_size)
334
347
  block_size = file_size - offset
335
348
  if(block_size > block_max_size)
@@ -345,13 +358,14 @@ module MobyBehaviour
345
358
  :data_lenght=>buff.size} )
346
359
  offset = offset + buff.size
347
360
  end
361
+ print "\r Uploaded #{offset}/#{file_size} bytes of #{local_file}"
362
+
348
363
  end
349
364
  file_to_be_sent.close
350
365
  end
351
366
 
352
-
353
- # enable hooking for performance measurement & debug logging
354
- TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
367
+ # enable hooking for performance measurement & debug logging
368
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
355
369
 
356
370
 
357
371
  end