cutedriver-qt-sut-plugin 2.0.0.20210120165900
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,300 @@
|
|
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
|
+
# Behaviours for handling attributes
|
26
|
+
#
|
27
|
+
# == behaviour
|
28
|
+
# QtAttribute
|
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
|
+
# *
|
44
|
+
#
|
45
|
+
module Attribute
|
46
|
+
|
47
|
+
include MobyBehaviour::QT::Behaviour
|
48
|
+
|
49
|
+
# == description
|
50
|
+
# Sets an attribute of the target object.
|
51
|
+
#
|
52
|
+
# == arguments
|
53
|
+
# attribute
|
54
|
+
# String
|
55
|
+
# description: Name of the attribute to be set as string
|
56
|
+
# example: "text"
|
57
|
+
#
|
58
|
+
# Symbol
|
59
|
+
# description: Name of the attribute to be set as symbol
|
60
|
+
# example: :text
|
61
|
+
#
|
62
|
+
# value
|
63
|
+
# String
|
64
|
+
# description: New value of the attribute.
|
65
|
+
# example: "Menu"
|
66
|
+
#
|
67
|
+
# Integer
|
68
|
+
# description: New value of the attribute.
|
69
|
+
# example: 200
|
70
|
+
#
|
71
|
+
# TrueClass
|
72
|
+
# description: New value of the attribute.
|
73
|
+
# example: true
|
74
|
+
#
|
75
|
+
# FalseClass
|
76
|
+
# description: New value of the attribute.
|
77
|
+
# example: false
|
78
|
+
#
|
79
|
+
# Date
|
80
|
+
# description: New value of the attribute.
|
81
|
+
# example: Date.today
|
82
|
+
#
|
83
|
+
# Time
|
84
|
+
# description: New value of the attribute.
|
85
|
+
# example: Time.now
|
86
|
+
#
|
87
|
+
# DateTime
|
88
|
+
# description: New value of the attribute.
|
89
|
+
# example: DateTime.now
|
90
|
+
#
|
91
|
+
# type
|
92
|
+
# String
|
93
|
+
# description: Type of the value. If this argument is not given, the type will be detected based on the class of the value argument.
|
94
|
+
# example: "QPoint"
|
95
|
+
# default: nil
|
96
|
+
#
|
97
|
+
# == tables
|
98
|
+
# attribute_types_table
|
99
|
+
# title: Valid type argument values
|
100
|
+
# |Type|Example|
|
101
|
+
# |QRect|'10,10,150,150'|
|
102
|
+
# |QPoint|'100,200'|
|
103
|
+
# |QSize|'50,80'|
|
104
|
+
# |QDate|'15.08.2009'|
|
105
|
+
# |QDateTime|'1373352400'|
|
106
|
+
#
|
107
|
+
# == returns
|
108
|
+
# NilClass
|
109
|
+
# description: Always returns nil
|
110
|
+
# example: nil
|
111
|
+
#
|
112
|
+
# == exceptions
|
113
|
+
# ArgumentError
|
114
|
+
# description: One of the arguments is not valid
|
115
|
+
# RuntimeError
|
116
|
+
# description: Setting of the attribute failed
|
117
|
+
def set_attribute( attribute, value, type = nil )
|
118
|
+
|
119
|
+
# verify attribute argument variable type
|
120
|
+
attribute.check_type [ Symbol, String ], 'wrong argument type $1 for attribute name (expected $2)'
|
121
|
+
|
122
|
+
# verify type argument variable type
|
123
|
+
type.check_type [ NilClass, String ], 'wrong argument type $1 for attribute type (expected $2)'
|
124
|
+
|
125
|
+
# convert symbol to string
|
126
|
+
attribute = attribute.to_s if attribute.kind_of?( Symbol )
|
127
|
+
|
128
|
+
# raise exception if attribute name was not given
|
129
|
+
attribute.not_empty 'attribute name cannot be be empty string'
|
130
|
+
|
131
|
+
type.not_empty 'argument type must be either nil or non empty string' if type.kind_of?( String )
|
132
|
+
|
133
|
+
# in qt_behaviour
|
134
|
+
command = command_params
|
135
|
+
|
136
|
+
command.transitions_off
|
137
|
+
|
138
|
+
command.command_name( 'SetAttribute' )
|
139
|
+
|
140
|
+
case type
|
141
|
+
|
142
|
+
when nil
|
143
|
+
|
144
|
+
# Implicit typing
|
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'}
|
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' }
|
153
|
+
|
154
|
+
elsif value.kind_of? Time
|
155
|
+
params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_i.to_s, 'attribute_type' => 'QDateTime' }
|
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' }
|
159
|
+
|
160
|
+
elsif value.kind_of? TrueClass
|
161
|
+
params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s.downcase, 'attribute_type' => 'bool'}
|
162
|
+
|
163
|
+
elsif value.kind_of? FalseClass
|
164
|
+
params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s.downcase, 'attribute_type' => 'bool'}
|
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'}
|
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'}
|
174
|
+
|
175
|
+
else
|
176
|
+
params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s, 'attribute_type' => 'string'}
|
177
|
+
|
178
|
+
end
|
179
|
+
|
180
|
+
end
|
181
|
+
|
182
|
+
when "QRect"
|
183
|
+
params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s, 'attribute_type' => 'QRect'}
|
184
|
+
|
185
|
+
when "QPoint"
|
186
|
+
params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s, 'attribute_type' => 'QPoint'}
|
187
|
+
|
188
|
+
when "QSize"
|
189
|
+
params = { 'attribute_name' => attribute.to_s, 'attribute_value' => value.to_s, 'attribute_type' => 'QSize'}
|
190
|
+
|
191
|
+
when "QDateTime"
|
192
|
+
|
193
|
+
params = { 'attribute_name' => attribute.to_s, 'attribute_type' => 'QDateTime' }
|
194
|
+
|
195
|
+
if value.kind_of? String
|
196
|
+
params[ 'attribute_value' ] = value.to_s
|
197
|
+
|
198
|
+
elsif value.kind_of? Integer
|
199
|
+
params[ 'attribute_value' ] = value.to_s
|
200
|
+
|
201
|
+
elsif value.kind_of? Time
|
202
|
+
params[ 'attribute_value' ] = value.to_i.to_s
|
203
|
+
|
204
|
+
elsif value.kind_of? DateTime
|
205
|
+
params[ 'attribute_value' ] = Time.parse( value.to_s ).to_i.to_s
|
206
|
+
|
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
|
+
|
210
|
+
end
|
211
|
+
|
212
|
+
when "QDate"
|
213
|
+
|
214
|
+
params = { 'attribute_name' => attribute.to_s, 'attribute_type' => 'QDate' }
|
215
|
+
|
216
|
+
if value.kind_of? String
|
217
|
+
params[ 'attribute_value' ] = value.to_s
|
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
|
222
|
+
|
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
|
+
|
226
|
+
end
|
227
|
+
|
228
|
+
else
|
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 }
|
232
|
+
|
233
|
+
end
|
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
|
+
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
|
+
|
251
|
+
|
252
|
+
end
|
253
|
+
|
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
|
293
|
+
|
294
|
+
# enable hooking for performance measurement & debug logging
|
295
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
296
|
+
|
297
|
+
end
|
298
|
+
|
299
|
+
end
|
300
|
+
end
|
@@ -0,0 +1,214 @@
|
|
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
|
+
# Base behaviour
|
26
|
+
#
|
27
|
+
# == behaviour
|
28
|
+
# QtBehaviour
|
29
|
+
#
|
30
|
+
# == requires
|
31
|
+
# sut_qt
|
32
|
+
#
|
33
|
+
# == sut_type
|
34
|
+
# qt
|
35
|
+
#
|
36
|
+
# == input_type
|
37
|
+
# All
|
38
|
+
#
|
39
|
+
# == sut_version
|
40
|
+
# *
|
41
|
+
#
|
42
|
+
# == objects
|
43
|
+
# sut;application
|
44
|
+
#
|
45
|
+
module Behaviour
|
46
|
+
|
47
|
+
include MobyBehaviour::Behaviour
|
48
|
+
|
49
|
+
@@_valid_buttons = [ :NoButton, :Left, :Right, :Middle ]
|
50
|
+
@@_buttons_map = { :NoButton => '0', :Left => '1', :Right => '2', :Middle => '4' }
|
51
|
+
@@_valid_directions = [ :Up, :Down, :Left, :Right ]
|
52
|
+
@@_direction_map = { :Up => '0', :Down => '180', :Left => '270', :Right => '90' }
|
53
|
+
@@_pinch_directions = { :Horizontal => '90', :Vertical => '0'}
|
54
|
+
@@_rotate_direction = [ :Clockwise, :CounterClockwise ]
|
55
|
+
@@_events_enabled = false
|
56
|
+
|
57
|
+
# == nodoc
|
58
|
+
# should this method be private?
|
59
|
+
def command_params( command = MobyCommand::WidgetCommand.new )
|
60
|
+
|
61
|
+
if attribute( 'objectType' ) == 'Graphics' and attribute( 'visibleOnScreen' ) == 'false' and @creation_attributes[ :visibleOnScreen ] != 'false'
|
62
|
+
|
63
|
+
begin
|
64
|
+
|
65
|
+
#try to make the item visible if so wanted
|
66
|
+
fixture( 'qt', 'ensureVisible' ) if sut_parameters[ :ensure_visible, false ].true?
|
67
|
+
fixture( 'qt', 'ensureQmlVisible') if sut_parameters[ :ensure_qml_visible, false ].true?
|
68
|
+
|
69
|
+
@creation_attributes.merge!( 'visibleOnScreen' => 'true' )
|
70
|
+
|
71
|
+
@parent.child( @creation_attributes )
|
72
|
+
|
73
|
+
rescue
|
74
|
+
|
75
|
+
raise MobyBase::TestObjectNotVisibleError
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
_object_type = attribute( 'objectType' ).intern
|
82
|
+
|
83
|
+
#for components with object visible on screen but not actual widgets or graphicsitems
|
84
|
+
if _object_type == :Embedded
|
85
|
+
|
86
|
+
_object_type = @parent.attribute( 'objectType' ).intern
|
87
|
+
|
88
|
+
_object_id = @parent.id
|
89
|
+
|
90
|
+
else
|
91
|
+
|
92
|
+
_object_id = @id
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
command.application_id( get_application_id )
|
97
|
+
|
98
|
+
command.set_object_id( _object_id )
|
99
|
+
|
100
|
+
command.object_type( _object_type )
|
101
|
+
|
102
|
+
command.set_event_type( sut_parameters[ :event_type, "0" ] )
|
103
|
+
|
104
|
+
# set app id as vkb if the attribute exists as the command needs to go to the vkb app
|
105
|
+
begin
|
106
|
+
|
107
|
+
# raises exception if value not found
|
108
|
+
value = attribute( 'vkb_app_id' )
|
109
|
+
|
110
|
+
command.application_id( value )
|
111
|
+
|
112
|
+
rescue MobyBase::AttributeNotFoundError
|
113
|
+
|
114
|
+
end
|
115
|
+
|
116
|
+
command
|
117
|
+
|
118
|
+
end
|
119
|
+
|
120
|
+
private
|
121
|
+
|
122
|
+
# == nodoc
|
123
|
+
# should this method be private?
|
124
|
+
def plugin_command( require_response = false, command = MobyCommand::WidgetCommand.new )
|
125
|
+
command.set_event_type(sut_parameters[ :event_type, "0" ])
|
126
|
+
command.application_id( get_application_id )
|
127
|
+
command.set_object_id( @id )
|
128
|
+
command.object_type( attribute('objectType' ).intern)
|
129
|
+
command.transitions_off
|
130
|
+
command
|
131
|
+
end
|
132
|
+
|
133
|
+
# TODO: document me
|
134
|
+
def do_sleep(time)
|
135
|
+
|
136
|
+
time = time.to_f * 1.3
|
137
|
+
|
138
|
+
#for flicks the duration of the gesture is short but animation (scroll etc..) may not
|
139
|
+
#so wait at least one second
|
140
|
+
time = 1 if time < 1
|
141
|
+
sleep time
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
# TODO: document me
|
146
|
+
def center_x
|
147
|
+
|
148
|
+
#x = attribute( 'x_absolute' ).to_i
|
149
|
+
#width = attribute( 'width' ).to_i
|
150
|
+
#x = x + ( width/2 )
|
151
|
+
#x.to_s
|
152
|
+
|
153
|
+
( ( attribute( 'x_absolute' ).to_i ) + ( attribute( 'width' ).to_i / 2 ) ).to_s
|
154
|
+
|
155
|
+
end
|
156
|
+
|
157
|
+
# TODO: document me
|
158
|
+
def center_y
|
159
|
+
|
160
|
+
#y = attribute( 'y_absolute' ).to_i
|
161
|
+
#height = attribute( 'height' ).to_i
|
162
|
+
#y = y + ( height/2 )
|
163
|
+
#y.to_s
|
164
|
+
|
165
|
+
( ( attribute( 'y_absolute' ).to_i ) + ( attribute( 'height' ).to_i / 2 ) ).to_s
|
166
|
+
|
167
|
+
end
|
168
|
+
|
169
|
+
# TODO: document me
|
170
|
+
def param_set_configured?( params, key )
|
171
|
+
|
172
|
+
if params.kind_of?(Hash) && params.has_key?(key)
|
173
|
+
|
174
|
+
#( params[ key ].nil? ? sut_parameters[ key, 'false' ] : params[ key ].to_s ).to_s == "true"
|
175
|
+
|
176
|
+
( params[ key ] || sut_parameters[ key, false ] ).true?
|
177
|
+
|
178
|
+
else
|
179
|
+
|
180
|
+
#sut_parameters[ key, 'false' ].true?
|
181
|
+
|
182
|
+
sut_parameters[ key, false ].true?
|
183
|
+
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
# TODO: document me
|
188
|
+
def execute_behavior( params, command )
|
189
|
+
|
190
|
+
if !get_application.multitouch_ongoing? && !@@_events_enabled && param_set_configured?( params, :ensure_event )
|
191
|
+
|
192
|
+
ensure_event(:retry_timeout => 5, :retry_interval => 0.5) {
|
193
|
+
|
194
|
+
@sut.execute_command( command )
|
195
|
+
|
196
|
+
}
|
197
|
+
|
198
|
+
else
|
199
|
+
|
200
|
+
@sut.execute_command( command )
|
201
|
+
|
202
|
+
end
|
203
|
+
|
204
|
+
end
|
205
|
+
|
206
|
+
# enable hooking for performance measurement & debug logging
|
207
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
208
|
+
|
209
|
+
end
|
210
|
+
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
214
|
+
|