cutedriver-qt-sut-plugin 2.0.0.20210120165900

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 (73) hide show
  1. checksums.yaml +7 -0
  2. data/env.rb +24 -0
  3. data/installer/extconf.rb +62 -0
  4. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin.rb +23 -0
  5. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/action.rb +157 -0
  6. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb +312 -0
  7. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/attribute.rb +300 -0
  8. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/behaviour.rb +214 -0
  9. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb +317 -0
  10. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_cpu.rb +145 -0
  11. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_gpu.rb +147 -0
  12. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_mem.rb +142 -0
  13. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_pwr.rb +146 -0
  14. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb +192 -0
  15. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/file_transfer.rb +375 -0
  16. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb +82 -0
  17. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fixture.rb +214 -0
  18. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fps.rb +189 -0
  19. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/gesture.rb +1039 -0
  20. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb +767 -0
  21. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/key_press.rb +166 -0
  22. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/locale_db.rb +157 -0
  23. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/method.rb +112 -0
  24. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/multitouch.rb +474 -0
  25. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/os.rb +100 -0
  26. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/qt_api_method.rb +148 -0
  27. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/record.rb +134 -0
  28. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/screen_capture.rb +279 -0
  29. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/settings.rb +302 -0
  30. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/sut.rb +840 -0
  31. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb +257 -0
  32. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/treewidgetitemcolumn.rb +117 -0
  33. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/type_text.rb +97 -0
  34. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/view_item.rb +97 -0
  35. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/webkit.rb +272 -0
  36. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/widget.rb +877 -0
  37. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/action.rb +30 -0
  38. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/configure_command.rb +38 -0
  39. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/drag.rb +44 -0
  40. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/find_object.rb +67 -0
  41. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/group.rb +44 -0
  42. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/infologger_command.rb +38 -0
  43. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb +171 -0
  44. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/tap.rb +54 -0
  45. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/version.rb +34 -0
  46. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb +199 -0
  47. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/agent.rb +54 -0
  48. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/application.rb +192 -0
  49. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/configure_command.rb +53 -0
  50. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/find_object.rb +48 -0
  51. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/fixture.rb +65 -0
  52. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/group.rb +57 -0
  53. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/infologger_command.rb +53 -0
  54. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/key_sequence.rb +93 -0
  55. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/screen_capture.rb +53 -0
  56. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/tap.rb +62 -0
  57. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/version.rb +46 -0
  58. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/widget.rb +98 -0
  59. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/plugin.rb +200 -0
  60. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/adapter.rb +466 -0
  61. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb +185 -0
  62. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/controller.rb +69 -0
  63. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/find_object_generator.rb +287 -0
  64. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/fixture_parameter.rb +77 -0
  65. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/message_composer.rb +370 -0
  66. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/widget.rb +79 -0
  67. data/lib/testability-driver-qt-sut-plugin.rb +24 -0
  68. data/xml/behaviour/qt.xml +845 -0
  69. data/xml/defaults/sut_qt.xml +9 -0
  70. data/xml/keymap/qt.xml +321 -0
  71. data/xml/keymap/win.xml +174 -0
  72. data/xml/template/qt.xml +141 -0
  73. metadata +127 -0
@@ -0,0 +1,375 @@
1
+ ############################################################################
2
+ ##
3
+ ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ## All rights reserved.
5
+ ## Contact: Nokia Corporation (testabilitydriver@nokia.com)
6
+ ##
7
+ ## This file is part of TDriver.
8
+ ##
9
+ ## If you have questions regarding the use of this file, please contact
10
+ ## Nokia at testabilitydriver@nokia.com .
11
+ ##
12
+ ## This library is free software; you can redistribute it and/or
13
+ ## modify it under the terms of the GNU Lesser General Public
14
+ ## License version 2.1 as published by the Free Software Foundation
15
+ ## and appearing in the file LICENSE.LGPL included in the packaging
16
+ ## of this file.
17
+ ##
18
+ ############################################################################
19
+
20
+ module MobyBehaviour
21
+
22
+ module QT
23
+
24
+ # == description
25
+ # This module contains implementation to control sut file transfers
26
+ #
27
+ # == behaviour
28
+ # FileTransfer
29
+ #
30
+ # == requires
31
+ # testability-driver-qt-sut-plugin
32
+ #
33
+ # == input_type
34
+ # *
35
+ #
36
+ # == sut_type
37
+ # qt
38
+ #
39
+ # == sut_version
40
+ # *
41
+ #
42
+ # == objects
43
+ # sut
44
+ #
45
+ module FileTransfer
46
+
47
+ include MobyBehaviour::QT::Behaviour
48
+
49
+ # == description
50
+ # Delete files from sut \n
51
+ #
52
+ #
53
+ # == arguments
54
+ # arguments
55
+ # Hash
56
+ # description: Hash containing parameters to be used in file transfer
57
+ # example: Following symbols are supported
58
+ # [:file]
59
+ # [:from]
60
+ # [:dir]
61
+ #
62
+ # == returns
63
+ # Array
64
+ # description: Deleted files
65
+ # example: ["/dir/file.txt","/dir/file2.txt"]
66
+ #
67
+ # == exceptions
68
+ # ArgumentErrors
69
+ # description: For missing / wrong argument types
70
+ #
71
+ # == info
72
+ #
73
+ def delete_from_sut( arguments )
74
+
75
+ arguments.check_type Hash, "wrong argument type $1 for #{ __method__.to_s } method (expected $2)"
76
+
77
+ if arguments.include?( :file )
78
+
79
+ file=arguments[ :file ].gsub('\\','/')
80
+ device_path=arguments[ :from ].gsub('\\','/') if arguments.include?(:from)
81
+
82
+ if device_path!=nil
83
+
84
+ ret_list_of_files = []
85
+ list_of_files = list_files_from_sut(:from=>device_path,:file=>file)
86
+ list_of_files.each do |name|
87
+ if fixture("file", "delete_file", {:file_name => name}) == "OK"
88
+ ret_list_of_files << name
89
+ end
90
+ end
91
+ return ret_list_of_files
92
+
93
+ else
94
+
95
+ if fixture("file", "delete_file", {:file_name => file}) == "OK"
96
+ return File.basename(file)
97
+ end
98
+ return
99
+
100
+ end
101
+
102
+ elsif arguments.include?(:dir)
103
+
104
+ if fixture("file", "rm_dir", {:file_name => arguments[:dir]}) == "OK"
105
+ return arguments[:dir]
106
+ end
107
+ return
108
+
109
+ else
110
+
111
+ arguments.require_key :file, 'Argument $1 not found'
112
+ arguments.require_key :dir, 'Argument $1 not found'
113
+
114
+ end
115
+
116
+ end
117
+
118
+ # == description
119
+ # Copy files from sut \n
120
+ #
121
+ # == arguments
122
+ # arguments
123
+ # Hash
124
+ # description: Hash containing parameters to be used in file transfer
125
+ # example: Following symbols are supported
126
+ # [:file]
127
+ # [:from]
128
+ # [:to]
129
+ #
130
+ # == returns
131
+ # Array
132
+ # description: Copied files
133
+ # example: ["/dir/file.txt","/dir/file2.txt"]
134
+ #
135
+ # == exceptions
136
+ # ArgumentErrors
137
+ # description: For missing / wrong argument types
138
+ #
139
+ # == info
140
+ #
141
+ def copy_from_sut( arguments )
142
+
143
+ arguments.check_type Hash, "wrong argument type $1 for #{ __method__.to_s } method (expected $2)"
144
+
145
+ device_path=arguments[ :from ].gsub('\\','/') if arguments.include?( :from )
146
+
147
+ if arguments[ :file ]!=nil
148
+ file=arguments[ :file ].gsub('\\','/')
149
+ else
150
+ file='*.*'
151
+ end
152
+
153
+ if arguments[:to]!=nil
154
+ tmp_path=arguments[:to].gsub('\\','/')
155
+ if File::directory?(tmp_path)==false
156
+ FileUtils.mkdir_p tmp_path
157
+ end
158
+ else
159
+ tmp_path=Dir.getwd
160
+ end
161
+
162
+ if device_path!=nil
163
+ list_of_files = list_files_from_sut(:from=>device_path,:file=>file)
164
+
165
+
166
+ list_of_files.each do |name|
167
+ end_index=(name.index File.basename(name))-1
168
+ start_index=(name.index device_path)+device_path.length
169
+ file_folder=name[start_index..end_index]
170
+ receive_file_from_device(name,File.join("#{tmp_path}#{file_folder}",File.basename(name)))
171
+ end
172
+ return list_of_files
173
+ else
174
+
175
+ arguments.require_key :file, 'Argument $1 not found'
176
+
177
+ receive_file_from_device(file,File.join(arguments[ :to ],File.basename(file)))
178
+
179
+ end
180
+ end
181
+
182
+ # == description
183
+ # Copy files to sut \n
184
+ #
185
+ # == arguments
186
+ # arguments
187
+ # Hash
188
+ # description: Hash containing parameters to be used in file transfer
189
+ # example: Following symbols are supported
190
+ # [:file]
191
+ # [:from]
192
+ # [:to]
193
+ #
194
+ #
195
+ # == returns
196
+ # Array
197
+ # description: Copied files
198
+ # example: ["/dir/file.txt","/dir/file2.txt"]
199
+ #
200
+ # == exceptions
201
+ # ArgumentErrors
202
+ # description: For missing / wrong argument types
203
+ #
204
+ # == info
205
+ #
206
+ def copy_to_sut(arguments)
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'
211
+
212
+ begin
213
+ local_dir = Dir.new( arguments[ :from ] ) if arguments.include?( :from )
214
+ rescue Errno::ENOENT
215
+ raise RuntimeError, "The source folder does not exist. Details:\n#{ $!.inspect }"
216
+ end
217
+
218
+ if arguments[ :file ]!=nil
219
+ file=arguments[ :file ].gsub('\\','/')
220
+ else file='*.*'
221
+ file='*.*'
222
+ end
223
+ transfered_files=Array.new
224
+
225
+ #ensure that the base dir exist
226
+ fixture("file","mk_dir",{:file_name=>"#{arguments[ :to ]}"})
227
+
228
+ if arguments.include?( :file )==false
229
+
230
+ arguments.require_key :from, 'Argument $1 not found'
231
+
232
+ local_dir.entries.each do | local_file_or_subdir |
233
+ if !File.directory?( File.join( arguments[ :from ], local_file_or_subdir ) )
234
+ send_file_to_device(
235
+ File.join( arguments[ :from ], local_file_or_subdir ),
236
+ File.join( arguments[ :to ], File.basename(local_file_or_subdir))
237
+ )
238
+ transfered_files << "#{arguments[ :to ]}/#{File.basename(local_file_or_subdir)}"
239
+ elsif local_file_or_subdir != "." && local_file_or_subdir != ".."
240
+ fixture("file","mk_dir",{:file_name=>"#{arguments[ :to ]}/#{local_file_or_subdir}"})
241
+ transfered_files << copy_to_sut(:from=>"#{arguments[ :from ]}/#{local_file_or_subdir}",
242
+ :to=>"#{arguments[ :to ]}/#{File.basename(local_file_or_subdir)}")
243
+ end
244
+ end
245
+ elsif arguments.include?( :file ) && arguments.include?( :from )
246
+ local_dir.entries.each do | local_file_or_subdir |
247
+ if !File.directory?( File.join( arguments[ :from ], local_file_or_subdir ) )
248
+ send_file_to_device(
249
+ File.join( arguments[ :from ],local_file_or_subdir ),
250
+ File.join( arguments[ :to ], File.basename(local_file_or_subdir))
251
+ ) if local_file_or_subdir.include?(file)
252
+ transfered_files << "#{arguments[ :to ]}/#{File.basename(local_file_or_subdir)}"
253
+ elsif local_file_or_subdir != "." && local_file_or_subdir != ".."
254
+ fixture("file","mk_dir",{:file_name=>"#{arguments[ :to ]}/#{local_file_or_subdir}"})
255
+ transfered_files << copy_to_sut(:file => arguments( :file ), :from=>"#{arguments[ :from ]}/#{local_file_or_subdir}",
256
+ :to=>"#{arguments[ :to ]}/#{local_file_or_subdir}")
257
+ end
258
+ end
259
+ else
260
+
261
+ arguments.require_key :file, 'Argument $1 not found'
262
+
263
+ fixture("file","mk_dir",{:file_name=>{:file_name=>arguments[ :to ]}})
264
+ send_file_to_device(
265
+ file,
266
+ File.join(arguments[ :to ],File.basename(file))
267
+ )
268
+ transfered_files << "#{arguments[ :to ]}/#{File.basename(file)}"
269
+ end
270
+ return transfered_files
271
+ end
272
+
273
+ # == description
274
+ # List files from sut \n
275
+ #
276
+ # == arguments
277
+ # arguments
278
+ # Hash
279
+ # description: Hash containing parameters to be used in file transfer
280
+ # example: Following symbols are supported
281
+ # [:file]
282
+ # [:from]
283
+ #
284
+ # == returns
285
+ # Array
286
+ # description: file list array
287
+ # example: ["/dir/file.txt","/dir/file2.txt"]
288
+ #
289
+ # == exceptions
290
+ # ArgumentErrors
291
+ # description: For missing / wrong argument types
292
+ #
293
+ # == Info
294
+ #
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
+
301
+ device_path=arguments[ :from ].gsub('\\','/')
302
+
303
+ if arguments[ :file ]!=nil
304
+ file=arguments[ :file ].gsub('\\','/')
305
+ else file='*.*'
306
+ file='*.*'
307
+ end
308
+ list_of_files = fixture("file", "list_files",
309
+ {:file_name => file,
310
+ :file_path => device_path}).split(';')
311
+ return list_of_files
312
+
313
+ end
314
+
315
+ private
316
+
317
+ def receive_file_from_device(device_file,local_file)
318
+ if File::directory?(File.dirname(local_file))==false
319
+ FileUtils.mkdir_p File.dirname(local_file)
320
+ end
321
+ new_file = File.new(local_file, 'wb')
322
+ block_size = sut_parameters[:qt_file_transfer_block_size].to_i
323
+ temp_size = block_size
324
+ offset = 0
325
+ while( temp_size == block_size )
326
+ temp_data = Base64.decode64( fixture("file", "read_file_part",
327
+ {:file_name => device_file,
328
+ :file_offset => offset,
329
+ :data_lenght => block_size
330
+ }) )
331
+ temp_size = temp_data.size
332
+ offset = offset + temp_size
333
+ new_file.write(temp_data)
334
+ print "\r Downloaded #{offset} bytes of #{device_file}"
335
+ end
336
+ new_file.close
337
+ return local_file
338
+ end
339
+
340
+ def send_file_to_device(local_file, device_file)
341
+ fixture("file", "delete_file", {:file_name => device_file})
342
+ block_max_size = sut_parameters[:qt_file_transfer_block_size].to_i
343
+ offset = 0
344
+ file_size = File::Stat.new(local_file).size
345
+ file_to_be_sent = File.open(local_file,"rb")
346
+ while(offset < file_size)
347
+ block_size = file_size - offset
348
+ if(block_size > block_max_size)
349
+ block_size = block_max_size
350
+ end
351
+ buff = file_to_be_sent.readpartial(block_size)
352
+ if(buff != nil)
353
+ file_data = Base64.encode64(buff)
354
+ fixture("file","write_file_append",
355
+ { :file_name=>device_file,
356
+ :file_data=>file_data,
357
+ :file_offset=>offset,
358
+ :data_lenght=>buff.size} )
359
+ offset = offset + buff.size
360
+ end
361
+ print "\r Uploaded #{offset}/#{file_size} bytes of #{local_file}"
362
+
363
+ end
364
+ file_to_be_sent.close
365
+ end
366
+
367
+ # enable hooking for performance measurement & debug logging
368
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
369
+
370
+
371
+ end
372
+
373
+ end
374
+
375
+ end
@@ -0,0 +1,82 @@
1
+ ############################################################################
2
+ ##
3
+ ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ## All rights reserved.
5
+ ## Contact: Nokia Corporation (testabilitydriver@nokia.com)
6
+ ##
7
+ ## This file is part of TDriver.
8
+ ##
9
+ ## If you have questions regarding the use of this file, please contact
10
+ ## Nokia at testabilitydriver@nokia.com .
11
+ ##
12
+ ## This library is free software; you can redistribute it and/or
13
+ ## modify it under the terms of the GNU Lesser General Public
14
+ ## License version 2.1 as published by the Free Software Foundation
15
+ ## and appearing in the file LICENSE.LGPL included in the packaging
16
+ ## of this file.
17
+ ##
18
+ ############################################################################
19
+
20
+ # Find behaviours
21
+ #
22
+ # Methods for finding test objects on the suttest objet state
23
+ module MobyBehaviour
24
+
25
+ module QT
26
+
27
+ # == description
28
+ # Defines methods to find test objects and scroll them to the display
29
+ #
30
+ # == behaviour
31
+ # QtFind
32
+ #
33
+ # == requires
34
+ # testability-driver-qt-sut-plugin
35
+ #
36
+ # == input_type
37
+ # *
38
+ #
39
+ # == sut_type
40
+ # qt
41
+ #
42
+ # == sut_version
43
+ # *
44
+ #
45
+ # == objects
46
+ # *
47
+ #
48
+ module Find
49
+ include MobyBehaviour::QT::Behaviour
50
+
51
+ # == nodoc
52
+ # TODO: fix this
53
+ def find_and_center (find_hash = {})
54
+ begin
55
+ search_result = find(find_hash)
56
+
57
+ ## Calculate Center
58
+ myWindow = search_result.sut.application.find(:parent => 0, :isWindow => "true") # throws multiple found exeptions
59
+ window_width = myWindow.attribute('width').to_i/2
60
+ window_height = myWindow.attribute('height').to_i/2
61
+ window_x = myWindow.attribute('x_absolute').to_i + window_width.to_i
62
+ window_y = myWindow.attribute('y_absolute').to_i + window_height.to_i
63
+
64
+ ## flick_to (center)
65
+ search_result.flick_to(window_x.to_i, window_y.to_i)
66
+ rescue Exception => e
67
+ ##$logger.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
+ ## Rescue from center and flick
69
+ raise e
70
+ end
71
+ $logger.behaviour "PASS;Test object found and centered.;#{id.to_s};sut;{};application;" << find_hash.inspect
72
+ search_result
73
+ end
74
+
75
+ # enable hooking for performance measurement & debug logging
76
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
77
+
78
+ end # module Find
79
+
80
+ end # module QT
81
+
82
+ end # module MobyBehaviour