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,257 @@
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
+ # Synchronization specific behaviours
26
+ #
27
+ # == behaviour
28
+ # QtSynchronization
29
+ #
30
+ # == requires
31
+ # testability-driver-qt-sut-plugin
32
+ #
33
+ # == input_type
34
+ # touch
35
+ #
36
+ # == sut_type
37
+ # QT
38
+ #
39
+ # == sut_version
40
+ # *
41
+ #
42
+ # == objects
43
+ # *
44
+ #
45
+ module Synchronization
46
+
47
+ include MobyBehaviour::QT::Behaviour
48
+
49
+ class SignalNotEmittedException < RuntimeError
50
+
51
+ end
52
+
53
+ class EventNotReceivedException < RuntimeError
54
+
55
+ end
56
+
57
+ class EventsEnabledException < RuntimeError
58
+ end
59
+
60
+ # == description
61
+ # Synchronizes script execution to a signal. Test script execution is stopped until the expected signal is emitted or the timeout occurs.
62
+ # If no signals of the given type are found before the timeout an error is raised.\n
63
+ # \n
64
+ # [b]NOTE:[/b] Using wait_for_signal will reset and clear any previously set signal listening status.
65
+ # == arguments
66
+ # signal_timeout
67
+ # Fixnum
68
+ # description: Timeout, in seconds. A timeout of zero means that the signal must have been listened to and emitted before this method is called.
69
+ # example: 60
70
+ #
71
+ # signal_name
72
+ # String
73
+ # description: Name of the signal that is to be emitted.
74
+ # example: "clicked()"
75
+ #
76
+ # params
77
+ # Hash
78
+ # description: Optional parameters for wait for signal
79
+ # example: "{:retry_timeout => 10, :retry_interval => 0.1}"
80
+ # &block
81
+ # Proc
82
+ # description: Optional code block to be executed while listening signals
83
+ # example: -
84
+ #
85
+ # == returns
86
+ # NilClass
87
+ # description: -
88
+ # example: -
89
+ #
90
+ # == exceptions
91
+ # SignalNotEmittedException
92
+ # description: The expected signal was not emitted before the timeout was reached.
93
+ #
94
+ # ArgumentError
95
+ # description: signal_name was not a valid String or signal_timeout was not a non negative Integer
96
+ #
97
+ def wait_for_signal( signal_timeout, signal_name, params = nil, &block )
98
+
99
+ signal_timeout.check_type Integer, 'wrong argument type $1 for signal timeout (expected $2)'
100
+ #raise ArgumentError.new("The timeout argument was of wrong type: expected 'Integer' was '%s'" % signal_timeout.class ) unless signal_timeout.kind_of?( Integer )
101
+
102
+ signal_timeout.not_negative 'signal timeout value $1 cannot be negative'
103
+ #raise ArgumentError.new("The timeout argument had a value of '%s', it must be a non negative Integer.'" % signal_timeout ) unless signal_timeout >= 0
104
+
105
+
106
+ signal_name.check_type String, 'wrong argument type $1 for signal name (expected $2)'
107
+ #raise ArgumentError.new("The signal name argument was of wrong type: expected 'String' was '%s'" % signal_name.class ) unless signal_name.kind_of?( String )
108
+
109
+ signal_name.not_empty 'signal name cannot be empty'
110
+ #raise ArgumentError.new("The signal name argument must not be an empty String.") unless !signal_name.empty?
111
+
112
+ params.check_type [ Hash, NilClass ], 'wrong argument type $1 for signal parameters (expected $2)'
113
+
114
+ # enable signal listening
115
+ fixture( 'signal', 'enable_signal', :signal => signal_name )
116
+
117
+ # execute code block if any given
118
+ begin
119
+
120
+ if params.kind_of?( Hash ) && params.has_key?( :retry_timeout )
121
+
122
+ MobyUtil::Retryable.until( :timeout => params[:retry_timeout], :interval => params[:retry_interval], :exception => SignalNotEmittedException) {
123
+
124
+ do_wait_signal(signal_timeout, signal_name, &block)
125
+
126
+ }
127
+
128
+ else
129
+
130
+ do_wait_signal(signal_timeout, signal_name, &block)
131
+
132
+ end
133
+
134
+ ensure
135
+
136
+ begin
137
+ fixture( "signal", "remove_signals" )
138
+ rescue Exception => e
139
+ $logger.warning "Fixture removal failed. Message received: #{e.message}"
140
+ end
141
+
142
+ end
143
+
144
+ nil
145
+
146
+ end # wait_for_signal
147
+
148
+ # == description
149
+ # Ensure that an event is fired into the target element
150
+ #
151
+ # [b]NOTE:[/b] Limitations:
152
+ # enable_events can not be enabled. multitouch operations are not supported.
153
+ #
154
+ # == arguments
155
+ # params
156
+ # Hash
157
+ # description: Arguments hash, see below
158
+ # example: Optional paramaters, see table params below.
159
+ #
160
+ #
161
+ # &block
162
+ # Proc
163
+ # description: Code block that triggers the event
164
+ # example: @app.Button.tap
165
+ #
166
+ # == tables
167
+ # params
168
+ # title: Hash argument params
169
+ # description: Valid keys for argument tap_params as hash
170
+ # |Key|Description|Type|Example|Default|
171
+ # |:retry_interval|Time between retries if the event is not received|Float|2|1|
172
+ # |:retry_timeout|Timeout for retry cycle|Integer|5|30|
173
+ # |:sleep_time|Sleep time before fetching events from client|Foat|0.4|0.2|
174
+ #
175
+ # == returns
176
+ # NilClass
177
+ # description: -
178
+ # example: -
179
+ #
180
+ # == exceptions
181
+ # EventsEnabledException
182
+ # description: enable_events is enabled. Event monitoring can not be enabled at the same time
183
+ #
184
+ # EventNotReceivedException
185
+ # description: Target object did not received any events defined
186
+ #
187
+ def ensure_event(params = nil, &block)
188
+
189
+ raise EventsEnabledException.new("enable_events is used - ensure_events can not be Used at the same time.") if @@_events_enabled
190
+ raise ArgumentError.new("Must be called to TestObject" ) unless kind_of? MobyBase::TestObject
191
+
192
+ retry_timeout = (params.nil? || params[:retry_timeout].nil?) ? 30 : params[:retry_timeout]
193
+ retry_interval = (params.nil? || params[:retry_interval].nil?) ? 1 : params[:retry_interval]
194
+ sleep_time = (params.nil? || params[:sleep_time].nil?) ? 0.2 : params[:sleep_time]
195
+
196
+ events = ['MouseButtonPress,TouchBegin,GraphicsSceneMousePress,KeyPress']
197
+ if params && params[:events]
198
+ events = params[:events]
199
+ end
200
+ app = get_application
201
+ begin
202
+ app.enable_events(events, {"track_id" => id.to_s})
203
+
204
+ MobyUtil::Retryable.until(:timeout => retry_timeout,:interval => retry_interval, :exception => EventNotReceivedException) {
205
+ block.call if block_given?
206
+ sleep sleep_time
207
+ ev = app.get_events
208
+ begin
209
+ @sut.state_object(ev).events.attribute('trackedFound')
210
+ rescue MobyBase::AttributeNotFoundError
211
+ $stderr.puts "Warning: Operation not received by object #{id} : #{self.name}. Retrying"
212
+ raise EventNotReceivedException.new("No event received during call")
213
+ end
214
+ }
215
+ ensure
216
+ app.disable_events
217
+ end
218
+ end
219
+
220
+ private
221
+
222
+ def do_wait_signal(signal_timeout, signal_name, &block)
223
+
224
+ timeout_deadline = ( Time.now + signal_timeout )
225
+
226
+ signal_found = false
227
+
228
+ block.call if block_given?
229
+
230
+ while( Time.now < timeout_deadline && !signal_found )
231
+
232
+ begin
233
+
234
+ result = fixture( 'signal', 'get_signal' )
235
+
236
+ signals_xml = MobyUtil::XML.parse_string( result )
237
+
238
+ _signal_found_xml, unused_rule = @test_object_adapter.get_objects( signals_xml, { :type => 'QtSignal', :name => signal_name }, true )
239
+
240
+ signal_found = true unless _signal_found_xml.empty?
241
+
242
+ end # begin
243
+
244
+ end # while
245
+
246
+ raise SignalNotEmittedException, "The signal #{ signal_name } was not emitted within #{ signal_timeout } seconds." unless signal_found
247
+
248
+ end
249
+
250
+ # enable hooking for performance measurement & debug logging
251
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
252
+
253
+ end # Synchronization
254
+
255
+ end # QT
256
+
257
+ end # MobyBehaviour
@@ -0,0 +1,117 @@
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 MobyBehaviour
23
+
24
+ module QT
25
+
26
+ # == description
27
+ # TreeWidgetItemColumn specific behaviours
28
+ #
29
+ # == behaviour
30
+ # QtTreeWidgetItemColumn
31
+ #
32
+ # == requires
33
+ # testability-driver-qt-sut-plugin
34
+ #
35
+ # == input_type
36
+ # *
37
+ #
38
+ # == sut_type
39
+ # QT
40
+ #
41
+ # == sut_version
42
+ # *
43
+ #
44
+ # == objects
45
+ # TreeWidgetItemColumn
46
+ #
47
+ module TreeWidgetItemColumn
48
+
49
+ include MobyBehaviour::QT::Behaviour
50
+
51
+ # == description
52
+ # Sets the check state of the item in QTreeWidgetItemColumn.\n
53
+ #
54
+ # == arguments
55
+ # new_state
56
+ # Integer
57
+ # description: State of checkable item, see supported values in [link="#check_state_enums"]table[/link] below
58
+ # example: 0
59
+ #
60
+ # == returns
61
+ # NilClass
62
+ # description: -
63
+ # example: -
64
+ #
65
+ # == tables
66
+ # check_state_enums
67
+ # title: Supported item states (Qt 4.7)
68
+ # description: See Qt documentation for allowed values to QT::CheckState
69
+ # |Enum|Value|Description|
70
+ # |Qt::Unchecked|0|The item is unchecked.|
71
+ # |Qt::PartiallyChecked|1|The item is partially checked.|
72
+ # |Qt::Checked|2|The item is checked.|
73
+ #
74
+ # == returns
75
+ def check_state( new_state )
76
+
77
+ ret = nil
78
+
79
+ begin
80
+
81
+ raise ArgumentError.new( "new_state must be an integer. Check qt docs for allowed values (Qt::CheckState." ) unless new_state.kind_of?(Integer)
82
+
83
+ command = MobyCommand::WidgetCommand.new
84
+
85
+ command.set_object_id(attribute('parentWidget'))
86
+
87
+ command.application_id(get_application_id)
88
+ command.object_type(:Standard)
89
+ command.command_name('CheckState')
90
+
91
+ command.set_event_type( sut_parameters[ :event_type, "0" ] )
92
+
93
+ params = {:state => new_state, :column => attribute('column'), :item => attribute('parentItem')}
94
+
95
+ command.set_event_type( sut_parameters[ :event_type, "0" ] )
96
+
97
+ command.command_params(params)
98
+ @sut.execute_command(command)
99
+
100
+ rescue Exception => e
101
+
102
+ $logger.behaviour "FAIL;Failed select"#{identity};drag;"
103
+ raise e
104
+
105
+ end
106
+
107
+ $logger.behaviour "PASS;Operation select executed successfully"#{identity};drag;"
108
+ ret
109
+
110
+ end
111
+
112
+ # enable hooking for performance measurement & debug logging
113
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
114
+ end
115
+
116
+ end
117
+ end
@@ -0,0 +1,97 @@
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 MobyBehaviour
23
+
24
+ module QT
25
+
26
+ # == description
27
+ # TypeText specific behaviours
28
+ #
29
+ # == behaviour
30
+ # QtTypeText
31
+ #
32
+ # == requires
33
+ # testability-driver-qt-sut-plugin
34
+ #
35
+ # == input_type
36
+ # *
37
+ #
38
+ # == sut_type
39
+ # QT
40
+ #
41
+ # == sut_version
42
+ # *
43
+ #
44
+ # == objects
45
+ # *
46
+ #
47
+ module TypeText
48
+
49
+ include MobyBehaviour::QT::Behaviour
50
+
51
+ # == description
52
+ # Write text on to a widget (e.g QLineEdit) as if it was typed by user
53
+ # \n
54
+ # == arguments
55
+ # text
56
+ # String
57
+ # description: Text to type
58
+ # example: "abc"
59
+ #
60
+ # == returns
61
+ # NilClass
62
+ # description: -
63
+ # example: -
64
+ #
65
+ # == exceptions
66
+ # Exception
67
+ # description: No special exceptions, may throw any exception
68
+ def type_text( text )
69
+ ret = nil
70
+
71
+ begin
72
+ command = command_params #in qt_behaviour
73
+ command.command_name('TypeText')
74
+ command.command_value(text)
75
+ @sut.execute_command(command)
76
+ sleep 0.2
77
+
78
+ rescue Exception => e
79
+
80
+ $logger.behaviour "FAIL;Failed type_text with text \"#{text}\".;#{identity};type_text;"
81
+ raise e
82
+
83
+ end
84
+
85
+ $logger.behaviour "PASS;Operation type_text executed successfully with text \"#{text}\".;#{identity};type_text;"
86
+
87
+ ret
88
+
89
+ end
90
+
91
+ # enable hooking for performance measurement & debug logging
92
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
93
+
94
+
95
+ end
96
+ end
97
+ end