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,147 @@
|
|
1
|
+
############################################################################
|
2
|
+
##
|
3
|
+
## Copyright (C) 2017 Link Motion Oy
|
4
|
+
## Author(s): Juhapekka Piiroinen <juhapekka.piiroinen@link-motion.com>
|
5
|
+
##
|
6
|
+
## All rights reserved.
|
7
|
+
## Contact: Link Motion (info@link-motion.com)
|
8
|
+
##
|
9
|
+
## This file is part of CuteDriver.
|
10
|
+
##
|
11
|
+
## This library is free software; you can redistribute it and/or
|
12
|
+
## modify it under the terms of the GNU Lesser General Public
|
13
|
+
## License version 2.1 as published by the Free Software Foundation
|
14
|
+
## and appearing in the file LICENSE.LGPL included in the packaging
|
15
|
+
## of this file.
|
16
|
+
##
|
17
|
+
############################################################################
|
18
|
+
|
19
|
+
module MobyBehaviour
|
20
|
+
|
21
|
+
module QT
|
22
|
+
|
23
|
+
# == description
|
24
|
+
#
|
25
|
+
# == behaviour
|
26
|
+
# QtGpu
|
27
|
+
#
|
28
|
+
# == requires
|
29
|
+
# testability-driver-qt-sut-plugin
|
30
|
+
#
|
31
|
+
# == input_type
|
32
|
+
# *
|
33
|
+
#
|
34
|
+
# == sut_type
|
35
|
+
# QT
|
36
|
+
#
|
37
|
+
# == sut_version
|
38
|
+
# *
|
39
|
+
#
|
40
|
+
# == objects
|
41
|
+
# *
|
42
|
+
#
|
43
|
+
module Gpu
|
44
|
+
|
45
|
+
include MobyBehaviour::QT::Behaviour
|
46
|
+
|
47
|
+
# == description
|
48
|
+
# Start collecting GPU usage per second data for the app.
|
49
|
+
#
|
50
|
+
# == returns
|
51
|
+
# NilClass
|
52
|
+
# description: -
|
53
|
+
# example: -
|
54
|
+
#
|
55
|
+
# == exceptions
|
56
|
+
# ArgumentError
|
57
|
+
# description: In case the given parameters are not valid.
|
58
|
+
#
|
59
|
+
def start_gpu_measurement
|
60
|
+
|
61
|
+
begin
|
62
|
+
|
63
|
+
log_gpu_mem(:interval => 1, :filePath => '/tmp')
|
64
|
+
|
65
|
+
rescue Exception
|
66
|
+
|
67
|
+
$logger.behaviour "FAIL;Failed start_gpu_mem_measurement.;#{ identity };start_gpu_mem_measurement;"
|
68
|
+
raise
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
$logger.behaviour "PASS;Operation start_gpu_mem_measurement executed successfully.;#{ identity };start_gpu_mem_measurement;"
|
73
|
+
|
74
|
+
nil
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
# == description
|
79
|
+
# Stop collecting GPU usage data for the object.
|
80
|
+
#
|
81
|
+
# == returns
|
82
|
+
# Array
|
83
|
+
# description: An Array of GPU entries. Each entry is a hash table that contains the value and time stamp {value => 42.00, usedMem => 42.00, freeMem => 12.34, totalMem => 43.21, processPrivateMem => 32.14, processSharedMem => 23.41 time_stamp => 06:49:42.259}
|
84
|
+
# example: [{value => 42.0, usedMem => 42.0, freeMem => 123.0, totalMem => 256.0, processPrivateMem => 12.0, processSharedMem => 32.0, time_stamp => 06:49:42.259}, {value => 32.0, usedMem => 42.0, freeMem => 123.0, totalMem => 256.0, processPrivateMem => 12.0, processSharedMem => 32.0, time_stamp => 06:49:43.259}]
|
85
|
+
#
|
86
|
+
# == exceptions
|
87
|
+
# ArgumentError
|
88
|
+
# description: In case the given parameters are not valid.
|
89
|
+
#
|
90
|
+
def stop_gpu_measurement
|
91
|
+
|
92
|
+
begin
|
93
|
+
|
94
|
+
results = parse_results_gpu( stop_gpu_log() )
|
95
|
+
|
96
|
+
rescue Exception
|
97
|
+
|
98
|
+
$logger.behaviour "FAIL;Failed stop_gpu_measurement.;#{ identity };stop_gpu_measurement;"
|
99
|
+
|
100
|
+
raise
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
$logger.behaviour "PASS;Operation stop_gpu_measurement executed successfully.;#{ identity };stop_gpu_measurement;"
|
105
|
+
|
106
|
+
results
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
private
|
112
|
+
|
113
|
+
def parse_results_gpu( results_xml )
|
114
|
+
state_object = @sut.state_object( results_xml )
|
115
|
+
|
116
|
+
results = []
|
117
|
+
|
118
|
+
count = state_object.logData.attribute( 'entryCount' ).to_i
|
119
|
+
|
120
|
+
for i in 0...count
|
121
|
+
totalMem = state_object.logEntry(:id => i.to_s).attribute('totalMem').to_f
|
122
|
+
usedMem = state_object.logEntry(:id => i.to_s).attribute('usedMem').to_f
|
123
|
+
freeMem = state_object.logEntry(:id => i.to_s).attribute('freeMem').to_f
|
124
|
+
processPrivateMem = state_object.logEntry(:id => i.to_s).attribute('processPrivateMem').to_f
|
125
|
+
processSharedMem = state_object.logEntry(:id => i.to_s).attribute('processSharedMem').to_f
|
126
|
+
|
127
|
+
time_stamp = state_object.logEntry(:id => i.to_s).attribute('timeStamp')
|
128
|
+
|
129
|
+
entry = {:value => usedMem, :usedMem => usedMem, :freeMem => freeMem, :totalMem => totalMem, :processPrivateMem => processPrivateMem, :processSharedMem => processSharedMem, :time_stamp => time_stamp}
|
130
|
+
|
131
|
+
results.push(entry)
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
results
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
# enable hooking for performance measurement & debug logging
|
140
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
141
|
+
|
142
|
+
end # Gpu
|
143
|
+
|
144
|
+
end # QT
|
145
|
+
|
146
|
+
end # MobyBase
|
147
|
+
|
@@ -0,0 +1,142 @@
|
|
1
|
+
############################################################################
|
2
|
+
##
|
3
|
+
## Copyright (C) 2017 Link Motion Oy
|
4
|
+
## Author(s): Juhapekka Piiroinen <juhapekka.piiroinen@link-motion.com>
|
5
|
+
##
|
6
|
+
## All rights reserved.
|
7
|
+
## Contact: Link Motion (info@link-motion.com)
|
8
|
+
##
|
9
|
+
## This file is part of CuteDriver.
|
10
|
+
##
|
11
|
+
## This library is free software; you can redistribute it and/or
|
12
|
+
## modify it under the terms of the GNU Lesser General Public
|
13
|
+
## License version 2.1 as published by the Free Software Foundation
|
14
|
+
## and appearing in the file LICENSE.LGPL included in the packaging
|
15
|
+
## of this file.
|
16
|
+
##
|
17
|
+
############################################################################
|
18
|
+
|
19
|
+
module MobyBehaviour
|
20
|
+
|
21
|
+
module QT
|
22
|
+
|
23
|
+
# == description
|
24
|
+
#
|
25
|
+
# == behaviour
|
26
|
+
# QtMem
|
27
|
+
#
|
28
|
+
# == requires
|
29
|
+
# testability-driver-qt-sut-plugin
|
30
|
+
#
|
31
|
+
# == input_type
|
32
|
+
# *
|
33
|
+
#
|
34
|
+
# == sut_type
|
35
|
+
# QT
|
36
|
+
#
|
37
|
+
# == sut_version
|
38
|
+
# *
|
39
|
+
#
|
40
|
+
# == objects
|
41
|
+
# *
|
42
|
+
#
|
43
|
+
module Mem
|
44
|
+
|
45
|
+
include MobyBehaviour::QT::Behaviour
|
46
|
+
|
47
|
+
# == description
|
48
|
+
# Start collecting MEM usage per second data for the app.
|
49
|
+
#
|
50
|
+
# == returns
|
51
|
+
# NilClass
|
52
|
+
# description: -
|
53
|
+
# example: -
|
54
|
+
#
|
55
|
+
# == exceptions
|
56
|
+
# ArgumentError
|
57
|
+
# description: In case the given parameters are not valid.
|
58
|
+
#
|
59
|
+
def start_mem_measurement
|
60
|
+
|
61
|
+
begin
|
62
|
+
|
63
|
+
log_mem(:interval => 1, :filePath => '/tmp')
|
64
|
+
|
65
|
+
rescue Exception
|
66
|
+
|
67
|
+
$logger.behaviour "FAIL;Failed start_mem_measurement.;#{ identity };start_mem_measurement;"
|
68
|
+
raise
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
$logger.behaviour "PASS;Operation start_mem_measurement executed successfully.;#{ identity };start_mem_measurement;"
|
73
|
+
|
74
|
+
nil
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
# == description
|
79
|
+
# Stop collecting MEM usage data for the object.
|
80
|
+
#
|
81
|
+
# == returns
|
82
|
+
# Array
|
83
|
+
# description: An Array of MEM entries. Each entry is a hash table that contains the value and time stamp {value => 42.00, heapSize => 42.00, time_stamp => 06:49:42.259}
|
84
|
+
# example: [{value => 42.0, heapSize => 42.0, time_stamp => 06:49:42.259}, {value => 32.0, heapSize => 32.0, time_stamp => 06:49:43.259}]
|
85
|
+
#
|
86
|
+
# == exceptions
|
87
|
+
# ArgumentError
|
88
|
+
# description: In case the given parameters are not valid.
|
89
|
+
#
|
90
|
+
def stop_mem_measurement
|
91
|
+
|
92
|
+
begin
|
93
|
+
|
94
|
+
results = parse_results_mem( stop_mem_log() )
|
95
|
+
|
96
|
+
rescue Exception
|
97
|
+
|
98
|
+
$logger.behaviour "FAIL;Failed stop_mem_measurement.;#{ identity };stop_mem_measurement;"
|
99
|
+
|
100
|
+
raise
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
$logger.behaviour "PASS;Operation stop_mem_measurement executed successfully.;#{ identity };stop_mem_measurement;"
|
105
|
+
|
106
|
+
results
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
private
|
112
|
+
|
113
|
+
def parse_results_mem( results_xml )
|
114
|
+
state_object = @sut.state_object( results_xml )
|
115
|
+
results = []
|
116
|
+
|
117
|
+
count = state_object.logData.attribute( 'entryCount' ).to_i
|
118
|
+
|
119
|
+
for i in 0...count
|
120
|
+
heapSize = state_object.logEntry(:id => i.to_s).attribute('heapSize').to_i
|
121
|
+
|
122
|
+
time_stamp = state_object.logEntry(:id => i.to_s).attribute('timeStamp')
|
123
|
+
|
124
|
+
entry = {:value => heapSize, :heapSize => heapSize, :time_stamp => time_stamp}
|
125
|
+
|
126
|
+
results.push(entry)
|
127
|
+
|
128
|
+
end
|
129
|
+
|
130
|
+
results
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
# enable hooking for performance measurement & debug logging
|
135
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
136
|
+
|
137
|
+
end # Mem
|
138
|
+
|
139
|
+
end # QT
|
140
|
+
|
141
|
+
end # MobyBase
|
142
|
+
|
@@ -0,0 +1,146 @@
|
|
1
|
+
############################################################################
|
2
|
+
##
|
3
|
+
## Copyright (C) 2017 Link Motion Oy
|
4
|
+
## Author(s): Juhapekka Piiroinen <juhapekka.piiroinen@link-motion.com>
|
5
|
+
##
|
6
|
+
## All rights reserved.
|
7
|
+
## Contact: Link Motion (info@link-motion.com)
|
8
|
+
##
|
9
|
+
## This file is part of CuteDriver.
|
10
|
+
##
|
11
|
+
## This library is free software; you can redistribute it and/or
|
12
|
+
## modify it under the terms of the GNU Lesser General Public
|
13
|
+
## License version 2.1 as published by the Free Software Foundation
|
14
|
+
## and appearing in the file LICENSE.LGPL included in the packaging
|
15
|
+
## of this file.
|
16
|
+
##
|
17
|
+
############################################################################
|
18
|
+
|
19
|
+
module MobyBehaviour
|
20
|
+
|
21
|
+
module QT
|
22
|
+
|
23
|
+
# == description
|
24
|
+
#
|
25
|
+
# == behaviour
|
26
|
+
# QtPwr
|
27
|
+
#
|
28
|
+
# == requires
|
29
|
+
# testability-driver-qt-sut-plugin
|
30
|
+
#
|
31
|
+
# == input_type
|
32
|
+
# *
|
33
|
+
#
|
34
|
+
# == sut_type
|
35
|
+
# QT
|
36
|
+
#
|
37
|
+
# == sut_version
|
38
|
+
# *
|
39
|
+
#
|
40
|
+
# == objects
|
41
|
+
# *
|
42
|
+
#
|
43
|
+
module Pwr
|
44
|
+
|
45
|
+
include MobyBehaviour::QT::Behaviour
|
46
|
+
|
47
|
+
# == description
|
48
|
+
# Start collecting PWR usage per second data for the app.
|
49
|
+
#
|
50
|
+
# == returns
|
51
|
+
# NilClass
|
52
|
+
# description: -
|
53
|
+
# example: -
|
54
|
+
#
|
55
|
+
# == exceptions
|
56
|
+
# ArgumentError
|
57
|
+
# description: In case the given parameters are not valid.
|
58
|
+
#
|
59
|
+
def start_pwr_measurement
|
60
|
+
|
61
|
+
begin
|
62
|
+
|
63
|
+
log_pwr(:interval => 1, :filePath => '/tmp')
|
64
|
+
|
65
|
+
rescue Exception
|
66
|
+
|
67
|
+
$logger.behaviour "FAIL;Failed start_pwr_measurement.;#{ identity };start_pwr_measurement;"
|
68
|
+
raise
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
$logger.behaviour "PASS;Operation start_pwr_measurement executed successfully.;#{ identity };start_pwr_measurement;"
|
73
|
+
|
74
|
+
nil
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
# == description
|
79
|
+
# Stop collecting PWR usage data for the object.
|
80
|
+
#
|
81
|
+
# == returns
|
82
|
+
# Array
|
83
|
+
# description: An Array of PWR entries. Each entry is a hash table that contains the value and time stamp {value => 42.00, voltage => 32.00, current => 42.00, time_stamp => 06:49:42.259}
|
84
|
+
# example: [{value => 42.0, current => 42.0, voltage => 12.0, time_stamp => 06:49:42.259}, {value => 32.0, current => 32.0, voltage => 42.0, time_stamp => 06:49:43.259}]
|
85
|
+
#
|
86
|
+
# == exceptions
|
87
|
+
# ArgumentError
|
88
|
+
# description: In case the given parameters are not valid.
|
89
|
+
#
|
90
|
+
def stop_pwr_measurement
|
91
|
+
|
92
|
+
begin
|
93
|
+
|
94
|
+
results = parse_results_pwr( stop_pwr_log() )
|
95
|
+
|
96
|
+
rescue Exception
|
97
|
+
|
98
|
+
$logger.behaviour "FAIL;Failed stop_pwr_measurement.;#{ identity };stop_pwr_measurement;"
|
99
|
+
|
100
|
+
raise
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
$logger.behaviour "PASS;Operation stop_pwr_measurement executed successfully.;#{ identity };stop_pwr_measurement;"
|
105
|
+
|
106
|
+
results
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
private
|
112
|
+
|
113
|
+
def parse_results_pwr( results_xml )
|
114
|
+
state_object = @sut.state_object( results_xml )
|
115
|
+
|
116
|
+
results = []
|
117
|
+
|
118
|
+
count = state_object.logData.attribute( 'entryCount' ).to_i
|
119
|
+
|
120
|
+
for i in 0...count
|
121
|
+
|
122
|
+
value = state_object.logEntry(:id => i.to_s).attribute('current').to_f
|
123
|
+
current = state_object.logEntry(:id => i.to_s).attribute('current').to_f
|
124
|
+
voltage = state_object.logEntry(:id => i.to_s).attribute('voltage').to_f
|
125
|
+
|
126
|
+
time_stamp = state_object.logEntry(:id => i.to_s).attribute('timeStamp')
|
127
|
+
|
128
|
+
entry = {:value => value, :current => current, :voltage => voltage, :time_stamp => time_stamp}
|
129
|
+
|
130
|
+
results.push(entry)
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
results
|
135
|
+
|
136
|
+
end
|
137
|
+
|
138
|
+
# enable hooking for performance measurement & debug logging
|
139
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
140
|
+
|
141
|
+
end # Pwr
|
142
|
+
|
143
|
+
end # QT
|
144
|
+
|
145
|
+
end # MobyBase
|
146
|
+
|
@@ -0,0 +1,192 @@
|
|
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
|
+
# Events specific behaviours
|
26
|
+
#
|
27
|
+
# == behaviour
|
28
|
+
# QtEvents
|
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
|
+
# *;application
|
44
|
+
#
|
45
|
+
module Events
|
46
|
+
|
47
|
+
include MobyBehaviour::QT::Behaviour
|
48
|
+
|
49
|
+
# == description
|
50
|
+
# Enable event listening. You can specify which events you want to listen for by including the names of
|
51
|
+
# those events separated by comma or integers if using user events. Use ALL if you want to listen for all
|
52
|
+
# events but be aware that there will be a lot of events.
|
53
|
+
# \n
|
54
|
+
# The events listened need to be sent the object to which the enabling is done for e.g. sut.button.enable_events('ALL')
|
55
|
+
# would listen to all events sent to the button. When disabling or getting the events the operation must be done to the same object.
|
56
|
+
#
|
57
|
+
# == arguments
|
58
|
+
# filter_array
|
59
|
+
# Array
|
60
|
+
# description: Array of the event named to listen
|
61
|
+
# example: ["Timer","MouseButtonPress","45677","67889"]
|
62
|
+
#
|
63
|
+
# params
|
64
|
+
# Hash
|
65
|
+
# description: -
|
66
|
+
# example: -
|
67
|
+
#
|
68
|
+
# == returns
|
69
|
+
# NilClass
|
70
|
+
# description: -
|
71
|
+
# example: -
|
72
|
+
#
|
73
|
+
# == exceptions
|
74
|
+
# Exception
|
75
|
+
# description: In case of an error
|
76
|
+
#
|
77
|
+
def enable_events(filter_array = nil, params = {})
|
78
|
+
|
79
|
+
begin
|
80
|
+
|
81
|
+
command = plugin_command #in qt_behaviour
|
82
|
+
command.command_name( 'EnableEvents' )
|
83
|
+
params_str = ''
|
84
|
+
filter_array.each {|value| params_str << value << ','} if filter_array
|
85
|
+
params['EventsToListen'] = params_str
|
86
|
+
command.command_params( params )
|
87
|
+
command.service( 'collectEvents' )
|
88
|
+
@sut.execute_command( command)
|
89
|
+
@@_events_enabled = true
|
90
|
+
|
91
|
+
rescue
|
92
|
+
|
93
|
+
$logger.behaviour "FAIL;Failed enable_events with refresh \"#{filter_array.to_s}\".;#{ identity };enable_events;"
|
94
|
+
raise $!
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
$logger.behaviour "PASS;Operation enable_events executed successfully with refresh \"#{ filter_array.to_s }\".;#{ identity };enable_events;"
|
99
|
+
|
100
|
+
nil
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
# == description
|
105
|
+
# Disables event listening on the target
|
106
|
+
#
|
107
|
+
# == returns
|
108
|
+
# NilClass
|
109
|
+
# description: -
|
110
|
+
# example: -
|
111
|
+
#
|
112
|
+
# == exceptions
|
113
|
+
# Exception
|
114
|
+
# description: In case of an error
|
115
|
+
#
|
116
|
+
def disable_events
|
117
|
+
|
118
|
+
begin
|
119
|
+
|
120
|
+
command = plugin_command #in qt_behaviour
|
121
|
+
command.command_name( 'DisableEvents' )
|
122
|
+
command.service( 'collectEvents' )
|
123
|
+
@sut.execute_command( command)
|
124
|
+
@@_events_enabled = false
|
125
|
+
|
126
|
+
rescue
|
127
|
+
|
128
|
+
$logger.behaviour "FAIL;Failed disable_events.;#{ identity };disable_events;"
|
129
|
+
|
130
|
+
raise $!
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
$logger.behaviour "PASS;Operation disable_events executed successfully.;#{ identity };disable_events;"
|
135
|
+
|
136
|
+
nil
|
137
|
+
|
138
|
+
end
|
139
|
+
|
140
|
+
# == description
|
141
|
+
# Gets event list occured since the enabling of events. The format of the XML string is the same as with the UI state.
|
142
|
+
# \n
|
143
|
+
#
|
144
|
+
# [b]NOTE:[/b]
|
145
|
+
# It is highly recommended to create a StateObject with result XML and access the data through appropriate API.
|
146
|
+
# \n
|
147
|
+
#
|
148
|
+
# See state_object method for more details.
|
149
|
+
#
|
150
|
+
# == returns
|
151
|
+
# String
|
152
|
+
# description: XML containing the details of the events logger since enable_events
|
153
|
+
# example: -
|
154
|
+
#
|
155
|
+
# == exceptions
|
156
|
+
# Exception
|
157
|
+
# description: In case of an error
|
158
|
+
#
|
159
|
+
def get_events
|
160
|
+
|
161
|
+
ret = nil
|
162
|
+
|
163
|
+
begin
|
164
|
+
|
165
|
+
command = plugin_command(true) #in qt_behaviour
|
166
|
+
command.command_name( 'GetEvents' )
|
167
|
+
command.service( 'collectEvents' )
|
168
|
+
ret = @sut.execute_command( command)
|
169
|
+
# TODO: how to parse the output?
|
170
|
+
|
171
|
+
rescue
|
172
|
+
|
173
|
+
$logger.behaviour "FAIL;Failed get_events.;#{ identity };get_events;"
|
174
|
+
|
175
|
+
raise $!
|
176
|
+
|
177
|
+
end
|
178
|
+
|
179
|
+
$logger.behaviour "PASS;Operation get_events executed successfully.;#{ identity };get_events;"
|
180
|
+
|
181
|
+
ret
|
182
|
+
|
183
|
+
end
|
184
|
+
|
185
|
+
# enable hooking for performance measurement & debug logging
|
186
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
187
|
+
|
188
|
+
end # EventsBehaviour
|
189
|
+
|
190
|
+
end
|
191
|
+
|
192
|
+
end # MobyBase
|