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.
- checksums.yaml +7 -0
- data/env.rb +24 -0
- data/installer/extconf.rb +62 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin.rb +23 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/action.rb +157 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb +312 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/attribute.rb +300 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/behaviour.rb +214 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb +317 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_cpu.rb +145 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_gpu.rb +147 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_mem.rb +142 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_pwr.rb +146 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb +192 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/file_transfer.rb +375 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb +82 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fixture.rb +214 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fps.rb +189 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/gesture.rb +1039 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb +767 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/key_press.rb +166 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/locale_db.rb +157 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/method.rb +112 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/multitouch.rb +474 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/os.rb +100 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/qt_api_method.rb +148 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/record.rb +134 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/screen_capture.rb +279 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/settings.rb +302 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/sut.rb +840 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb +257 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/treewidgetitemcolumn.rb +117 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/type_text.rb +97 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/view_item.rb +97 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/webkit.rb +272 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/widget.rb +877 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/action.rb +30 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/configure_command.rb +38 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/drag.rb +44 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/find_object.rb +67 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/group.rb +44 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/infologger_command.rb +38 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb +171 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/tap.rb +54 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/version.rb +34 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb +199 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/agent.rb +54 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/application.rb +192 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/configure_command.rb +53 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/find_object.rb +48 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/fixture.rb +65 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/group.rb +57 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/infologger_command.rb +53 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/key_sequence.rb +93 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/screen_capture.rb +53 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/tap.rb +62 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/version.rb +46 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/widget.rb +98 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/plugin.rb +200 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/adapter.rb +466 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb +185 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/controller.rb +69 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/find_object_generator.rb +287 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/fixture_parameter.rb +77 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/message_composer.rb +370 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/widget.rb +79 -0
- data/lib/testability-driver-qt-sut-plugin.rb +24 -0
- data/xml/behaviour/qt.xml +845 -0
- data/xml/defaults/sut_qt.xml +9 -0
- data/xml/keymap/qt.xml +321 -0
- data/xml/keymap/win.xml +174 -0
- data/xml/template/qt.xml +141 -0
- metadata +127 -0
data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/fixture_parameter.rb
ADDED
@@ -0,0 +1,77 @@
|
|
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
|
+
|
21
|
+
|
22
|
+
module MobyUtil
|
23
|
+
|
24
|
+
class FixtureParameter
|
25
|
+
|
26
|
+
attr_accessor :parameters
|
27
|
+
|
28
|
+
def initialize( *args )
|
29
|
+
@parameters = []
|
30
|
+
# accept array as multiple arguments, hash for one argument
|
31
|
+
args = [ [ args.first ] ] if args.size == 1 && args.first.kind_of?( Hash )
|
32
|
+
args.each{ | argument | add_parameter( argument.first ) }
|
33
|
+
end
|
34
|
+
|
35
|
+
def add_parameter( hash )
|
36
|
+
|
37
|
+
raise ArgumentError.new("Argument :value and :type must be defined. Actual hash: #{ hash.inspect }") unless hash.has_key?( :type ) and hash.has_key?( :value )
|
38
|
+
|
39
|
+
@parameters.push( hash )
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
def remove_parameter( index_or_range )
|
44
|
+
|
45
|
+
# value can be range or index, or array of ranges or indexes
|
46
|
+
@parameters.slice!( index_or_range )
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
def list_parameters
|
51
|
+
|
52
|
+
return @parameters.inspect
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
def to_s
|
57
|
+
|
58
|
+
Nokogiri::XML::Builder.new{
|
59
|
+
|
60
|
+
fixture_parameters{
|
61
|
+
|
62
|
+
parameters.each_index{ | index |
|
63
|
+
|
64
|
+
parameter( parameters[index].merge( :id => index) )
|
65
|
+
|
66
|
+
}
|
67
|
+
|
68
|
+
}
|
69
|
+
|
70
|
+
}.to_xml
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
@@ -0,0 +1,370 @@
|
|
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 MobyUtil
|
21
|
+
|
22
|
+
module MessageComposer
|
23
|
+
|
24
|
+
class TasCommands
|
25
|
+
|
26
|
+
# TODO: document me
|
27
|
+
def initialize( options = {} )
|
28
|
+
|
29
|
+
@command_attributes = options
|
30
|
+
|
31
|
+
@targets = []
|
32
|
+
|
33
|
+
end # initialize
|
34
|
+
|
35
|
+
# TODO: document me
|
36
|
+
def target( options = {} )
|
37
|
+
|
38
|
+
@targets << { :arguments => options, :objects => [], :commands => [] }
|
39
|
+
|
40
|
+
end # target
|
41
|
+
|
42
|
+
# TODO: document me
|
43
|
+
def targets
|
44
|
+
|
45
|
+
@targets
|
46
|
+
|
47
|
+
end # targets
|
48
|
+
|
49
|
+
def object( *arguments )
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
# TODO: document me
|
54
|
+
def command( *arguments )
|
55
|
+
|
56
|
+
command_hash = { :parameters => [] }
|
57
|
+
|
58
|
+
while arguments.count > 0
|
59
|
+
|
60
|
+
value = arguments.shift
|
61
|
+
|
62
|
+
if value.kind_of?( Hash )
|
63
|
+
|
64
|
+
command_hash[ :arguments ] = value
|
65
|
+
|
66
|
+
else
|
67
|
+
|
68
|
+
command_hash[ :value ] = value
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
@targets.last[ :commands ] << command_hash
|
75
|
+
|
76
|
+
end # command
|
77
|
+
|
78
|
+
# TODO: document me
|
79
|
+
def parameter( *arguments )
|
80
|
+
|
81
|
+
params_hash = {}
|
82
|
+
|
83
|
+
while arguments.count > 0
|
84
|
+
|
85
|
+
value = arguments.shift
|
86
|
+
|
87
|
+
if value.kind_of?( Hash )
|
88
|
+
|
89
|
+
params_hash[ :arguments ] = value
|
90
|
+
|
91
|
+
else
|
92
|
+
|
93
|
+
params_hash[ :value ] = value
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
@targets.last[ :commands ][ :parameters ] << params_hash
|
100
|
+
|
101
|
+
end # parameter
|
102
|
+
|
103
|
+
# TODO: document me
|
104
|
+
def to_xml
|
105
|
+
|
106
|
+
targets = targets_to_xml
|
107
|
+
|
108
|
+
if targets.length > 0
|
109
|
+
|
110
|
+
"<TasCommands #{ @command_attributes.to_attributes }>#{ targets }</TasCommands>"
|
111
|
+
|
112
|
+
else
|
113
|
+
|
114
|
+
"<TasCommands #{ @command_attributes.to_attributes } />"
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
end # to_xml
|
120
|
+
|
121
|
+
private
|
122
|
+
|
123
|
+
# TODO: document me
|
124
|
+
def targets_to_xml
|
125
|
+
|
126
|
+
@targets.collect do | target |
|
127
|
+
|
128
|
+
commands = target[ :commands ].collect do | command |
|
129
|
+
|
130
|
+
value = command[ :value ]
|
131
|
+
|
132
|
+
params = command[ :parameters ].collect do | parameter |
|
133
|
+
|
134
|
+
if parameter.has_key?( :value )
|
135
|
+
|
136
|
+
"<param #{ parameters[ :arguments ].to_attributes }>#{ parameters[ :value ] }</param>"
|
137
|
+
|
138
|
+
else
|
139
|
+
|
140
|
+
"<param #{ parameters[ :arguments ].to_attributes } />"
|
141
|
+
|
142
|
+
end
|
143
|
+
|
144
|
+
end.join
|
145
|
+
|
146
|
+
value = params if params.count > 0
|
147
|
+
|
148
|
+
unless value.nil?
|
149
|
+
|
150
|
+
"<Command #{ command[ :arguments ].to_attributes }>#{ command[ :value ] }</Command>"
|
151
|
+
|
152
|
+
else
|
153
|
+
|
154
|
+
"<Command #{ command[ :arguments ].to_attributes } />"
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
end
|
159
|
+
|
160
|
+
if commands.count > 0
|
161
|
+
|
162
|
+
commands.unshift("<Target #{ target[ :arguments ].to_attributes }></Target>")
|
163
|
+
|
164
|
+
else
|
165
|
+
|
166
|
+
commands.unshift("<Target #{ target[ :arguments ].to_attributes } />")
|
167
|
+
|
168
|
+
end
|
169
|
+
|
170
|
+
commands.join
|
171
|
+
|
172
|
+
end.join
|
173
|
+
|
174
|
+
end # targets_to_xml
|
175
|
+
|
176
|
+
end # TasCommands
|
177
|
+
|
178
|
+
def make_parametrized_message( service_details, command_name, params, command_params = {} )
|
179
|
+
service_details[:plugin_timeout] = $parameters[ @_sut.id ][ :qttas_plugin_timeout, 10000 ] if @_sut
|
180
|
+
|
181
|
+
Nokogiri::XML::Builder.new{
|
182
|
+
TasCommands( service_details ) {
|
183
|
+
Target( :TasId => "Application" ) {
|
184
|
+
Command( ( params || {} ).merge( :name => command_name ) ){
|
185
|
+
command_params.collect{ | name, value |
|
186
|
+
param( :name => name, :value => value )
|
187
|
+
}
|
188
|
+
}
|
189
|
+
}
|
190
|
+
}
|
191
|
+
}.to_xml
|
192
|
+
|
193
|
+
end
|
194
|
+
|
195
|
+
def hash_to_attributes( hash )
|
196
|
+
|
197
|
+
( hash || {} ).collect{ | value | "#{ value.first }=\"#{ value.last }\"" }.join(" ")
|
198
|
+
|
199
|
+
end
|
200
|
+
|
201
|
+
def make_xml_message( service_details, command_name, params, command_value = nil )
|
202
|
+
service_details[:plugin_timeout] = $parameters[ @_sut.id ][ :qttas_plugin_timeout, 10000 ] if @_sut
|
203
|
+
|
204
|
+
=begin
|
205
|
+
|
206
|
+
# create message as string
|
207
|
+
#MobyUtil::MessageComposer::hash_to_attributes 140 0.00405100 0.00405100 0.010% 0.00002894
|
208
|
+
#MobyUtil::MessageComposer::make_xml_message 70 0.00762200 0.00357100 0.009% 0.00010889
|
209
|
+
|
210
|
+
"<TasCommands #{ hash_to_attributes( service_details ) }>" <<
|
211
|
+
"<Target TasId=\"Application\">" <<
|
212
|
+
"<Command name=\"#{ command_name }\" #{ hash_to_attributes( params ) }#{ command_value ? ">#{ command_value }</Command>" : " />" }" <<
|
213
|
+
"</Target>" <<
|
214
|
+
"</TasCommands>"
|
215
|
+
|
216
|
+
# vs.
|
217
|
+
|
218
|
+
# create message using builder
|
219
|
+
#MobyUtil::MessageComposer::make_xml_message 70 0.03611100 0.03611100 0.090% 0.00051587
|
220
|
+
|
221
|
+
# create message
|
222
|
+
MobyUtil::XML.build{
|
223
|
+
TasCommands( service_details ) {
|
224
|
+
Target( :TasId => "Application" ) {
|
225
|
+
Command( command_value || "", ( params || {} ).merge( :name => command_name ) )
|
226
|
+
}
|
227
|
+
}
|
228
|
+
}.to_xml
|
229
|
+
|
230
|
+
=end
|
231
|
+
|
232
|
+
# construct xml message as string; using builder is approx. 67% slower, see statistics above
|
233
|
+
"<TasCommands #{ hash_to_attributes( service_details ) }><Target TasId=\"Application\"><Command name=\"#{ command_name }\" #{ hash_to_attributes( params ) }#{ command_value ? ">#{ command_value }</Command>" : " />" }</Target></TasCommands>"
|
234
|
+
|
235
|
+
end
|
236
|
+
|
237
|
+
def make_fixture_message(fixture_plugin, params)
|
238
|
+
service_details[:plugin_timeout] = $parameters[ @_sut.id ][ :qttas_plugin_timeout, 10000 ] if @_sut
|
239
|
+
|
240
|
+
Nokogiri::XML::Builder.new{
|
241
|
+
TasCommands( :id => params[:application_id].to_s, :service => "fixture", :async => params[:async].to_s ) {
|
242
|
+
Target( :TasId => params[:object_id].to_s, :type => params[:object_type].to_s ) {
|
243
|
+
Command( :name => "Fixture", :plugin => fixture_plugin, :method => params[:command_name].to_s ) {
|
244
|
+
params[:parameters].collect{ | name, value |
|
245
|
+
param( :name => name, :value => value )
|
246
|
+
}
|
247
|
+
}
|
248
|
+
}
|
249
|
+
}
|
250
|
+
}.to_xml
|
251
|
+
end
|
252
|
+
|
253
|
+
def encode_string( source )
|
254
|
+
source = source.to_s
|
255
|
+
source.gsub!( '&', '&' );
|
256
|
+
source.gsub!( '>', '>' );
|
257
|
+
source.gsub!( '<', '<' );
|
258
|
+
source.gsub!( '"', '"' );
|
259
|
+
source.gsub!( '\'', ''' );
|
260
|
+
source
|
261
|
+
end
|
262
|
+
|
263
|
+
def make_filters
|
264
|
+
|
265
|
+
params = {}
|
266
|
+
|
267
|
+
# get sut paramteres only once, store to local variable
|
268
|
+
sut_parameters = $parameters[ @_sut.id ]
|
269
|
+
|
270
|
+
params[ 'filterProperties' ] = $last_parameter if sut_parameters[ :filter_properties, nil ]
|
271
|
+
params[ 'pluginBlackList' ] = $last_parameter if sut_parameters[ :plugin_blacklist, nil ]
|
272
|
+
params[ 'pluginWhiteList' ] = $last_parameter if sut_parameters[ :plugin_whitelist, nil ]
|
273
|
+
params[ 'useViewCrop' ] = "true" if sut_parameters[ :use_crop_view, nil ]
|
274
|
+
|
275
|
+
case sut_parameters[ :filter_type, 'none' ]
|
276
|
+
|
277
|
+
when 'dynamic'
|
278
|
+
|
279
|
+
white_list = TDriver::AttributeFilter.filter_string
|
280
|
+
params['attributeWhiteList'] = white_list if white_list
|
281
|
+
|
282
|
+
when 'static'
|
283
|
+
|
284
|
+
params['attributeBlackList'] = $last_parameter if sut_parameters[ :attribute_blacklist, nil ]
|
285
|
+
params['attributeWhiteList'] = $last_parameter if sut_parameters[ :attribute_whitelist, nil ]
|
286
|
+
|
287
|
+
end
|
288
|
+
|
289
|
+
params
|
290
|
+
|
291
|
+
end
|
292
|
+
|
293
|
+
def state_message
|
294
|
+
|
295
|
+
app_details = { :service => 'uiState', :name => @_application_name, :id => @_application_uid }
|
296
|
+
|
297
|
+
app_details[ :applicationUid ] = @_refresh_args[ :applicationUid ] if @_refresh_args.include?( :applicationUid )
|
298
|
+
|
299
|
+
app_details[ :checksum ] = @_checksum unless @_checksum.nil?
|
300
|
+
|
301
|
+
params = @_flags || {}
|
302
|
+
|
303
|
+
case $parameters[ @_sut.id ][ :filter_type, 'none' ]
|
304
|
+
|
305
|
+
when 'none'
|
306
|
+
|
307
|
+
command_xml = make_xml_message( app_details, 'UiState', params )
|
308
|
+
|
309
|
+
when 'dynamic'
|
310
|
+
|
311
|
+
params[ :filtered ] = 'true'
|
312
|
+
|
313
|
+
command_xml = make_parametrized_message( app_details, 'UiState', params, make_filters )
|
314
|
+
|
315
|
+
else
|
316
|
+
|
317
|
+
command_xml = make_parametrized_message( app_details, 'UiState', params, make_filters )
|
318
|
+
|
319
|
+
end
|
320
|
+
|
321
|
+
command_xml
|
322
|
+
|
323
|
+
end
|
324
|
+
|
325
|
+
def run_message
|
326
|
+
#clone to not make changes permanent
|
327
|
+
arguments = $parameters[ @_sut.id ][ :application_start_arguments, "" ].clone
|
328
|
+
if @_arguments
|
329
|
+
arguments << "," unless arguments.empty?
|
330
|
+
arguments << @_arguments
|
331
|
+
end
|
332
|
+
|
333
|
+
parameters = {
|
334
|
+
'application_path' => @_application_name,
|
335
|
+
'arguments' => arguments,
|
336
|
+
'environment' => @_environment,
|
337
|
+
'directory' => @_working_directory,
|
338
|
+
'events_to_listen' => @_events_to_listen,
|
339
|
+
'signals_to_listen' => @_signals_to_listen,
|
340
|
+
'start_command' => @_start_command
|
341
|
+
}
|
342
|
+
|
343
|
+
#set search
|
344
|
+
search_path = $parameters[ @_sut.id ][ :app_path, nil ]
|
345
|
+
parameters[:app_path] = search_path if search_path
|
346
|
+
|
347
|
+
make_xml_message({:service => 'startApplication'}, 'Run', parameters)
|
348
|
+
end
|
349
|
+
|
350
|
+
def close_message
|
351
|
+
|
352
|
+
sut_parameters = $parameters[ @_sut.id ]
|
353
|
+
|
354
|
+
parameters = {
|
355
|
+
'uid' => @_application_uid,
|
356
|
+
'kill' => ( @_flags || {} )[ :force_kill ] || sut_parameters[ :application_close_kill ],
|
357
|
+
'wait_time' => sut_parameters[ :application_close_wait ]
|
358
|
+
}
|
359
|
+
|
360
|
+
make_xml_message({:service => 'closeApplication', :id => @_application_uid }, 'Close', parameters)
|
361
|
+
end
|
362
|
+
|
363
|
+
# enable hoo./base/test_object/factory.rb:king for performance measurement & debug logging
|
364
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
365
|
+
|
366
|
+
end
|
367
|
+
|
368
|
+
|
369
|
+
end
|
370
|
+
|
@@ -0,0 +1,79 @@
|
|
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
|
+
|
21
|
+
module MobyUtil
|
22
|
+
|
23
|
+
class Widget
|
24
|
+
|
25
|
+
# Common method, tap up or down
|
26
|
+
def self.tap_updown_object(tap_params, y, button, identity, command_name)
|
27
|
+
begin
|
28
|
+
behavior_name = command_name == 'MousePress' ? 'tap_down_object' : 'tap_up_object'
|
29
|
+
if tap_params.kind_of? Hash
|
30
|
+
x = tap_params[:x].nil? ? -1 : tap_params[:x]
|
31
|
+
y = tap_params[:y].nil? ? -1 : tap_params[:y]
|
32
|
+
button = tap_params[:button].nil? ? (:Left) : tap_params[:button]
|
33
|
+
use_tap_screen = tap_params[:use_tap_screen] == true ? 'true' :
|
34
|
+
$parameters[ @sut.id][ :use_tap_screen, 'false']
|
35
|
+
else
|
36
|
+
x = tap_params
|
37
|
+
use_tap_screen = $parameters[ @sut.id ][ :use_tap_screen, 'false' ]
|
38
|
+
end
|
39
|
+
|
40
|
+
raise ArgumentError.new( "Coordinate x:#{x} x_abs:#{x} outside object." ) unless (x <= attribute('width').to_i and x >= 0)
|
41
|
+
raise ArgumentError.new( "Coordinate y:#{y} y_abs:#{y} outside object." ) unless (y <= attribute('height').to_i and y >= 0)
|
42
|
+
|
43
|
+
command = command_params #in qt_behaviour
|
44
|
+
command.command_name(command_name)
|
45
|
+
|
46
|
+
x_tap = attribute('x_absolute').to_i + x.to_i
|
47
|
+
y_tap = attribute('y_absolute').to_i + y.to_i
|
48
|
+
|
49
|
+
mouse_move = @sut.parameter[:in_tap_move_pointer]
|
50
|
+
mouse_move = 'false' unless mouse_move
|
51
|
+
|
52
|
+
params = { 'x'=>x_tap.to_s, 'y' => y_tap.to_s, 'button' => @@_buttons_map[button], 'mouseMove'=>mouse_move }
|
53
|
+
# use coordinates
|
54
|
+
params['useCoordinates'] = 'true'
|
55
|
+
params['useTapScreen'] = use_tap_screen
|
56
|
+
command.command_params(params)
|
57
|
+
|
58
|
+
@sut.execute_command(command)
|
59
|
+
|
60
|
+
rescue Exception => e
|
61
|
+
|
62
|
+
$logger.behaviour "FAIL;Failed #{behavior_name} with x \"#{x}\", y \"#{y}\", button \"#{button.to_s}\".;#{identity};#{behavior_name};"
|
63
|
+
raise e
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
$logger.behaviour "PASS;Operation #{behavior_name} executed successfully with x \"#{x}\", y \"#{y}\", button \"#{button.to_s}\".;#{identity};#{behavior_name};"
|
68
|
+
|
69
|
+
nil
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|