testability-driver-qt-sut-plugin 1.1.1 → 1.2.0

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 (40) hide show
  1. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/action.rb +7 -6
  2. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb +190 -182
  3. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/attribute.rb +2 -2
  4. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/behaviour.rb +17 -17
  5. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb +6 -6
  6. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb +6 -6
  7. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb +2 -2
  8. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fixture.rb +10 -14
  9. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fps.rb +7 -7
  10. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/gesture.rb +387 -338
  11. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb +177 -5
  12. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/key_press.rb +5 -5
  13. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/locale_db.rb +2 -1
  14. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/method.rb +34 -7
  15. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/multitouch.rb +4 -4
  16. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/os.rb +4 -4
  17. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/record.rb +6 -6
  18. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/screen_capture.rb +8 -12
  19. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/settings.rb +8 -8
  20. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/sut.rb +171 -115
  21. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb +2 -2
  22. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/treewidgetitemcolumn.rb +11 -7
  23. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/type_text.rb +2 -2
  24. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/view_item.rb +5 -5
  25. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/webkit.rb +13 -13
  26. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/widget.rb +54 -63
  27. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/find_object.rb +45 -28
  28. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/version.rb +34 -0
  29. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb +2 -2
  30. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/application.rb +174 -121
  31. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/find_object.rb +35 -26
  32. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/version.rb +56 -0
  33. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/plugin.rb +64 -16
  34. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/adapter.rb +138 -40
  35. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb +91 -83
  36. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/find_object_generator.rb +222 -44
  37. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/message_composer.rb +176 -10
  38. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/widget.rb +2 -2
  39. data/xml/behaviour/qt.xml +12 -0
  40. metadata +7 -5
@@ -19,32 +19,49 @@
19
19
 
20
20
  module MobyCommand
21
21
 
22
-
23
22
  class FindObjectCommand < MobyCommand::CommandData
24
-
25
-
26
- # Constructor
27
- # == params
28
- # btn_id:: (optional) String, id for the button perform this command on
29
- # command_type:: (optional) Symbol, defines the command to perform on the button
30
- # == returns
31
- # Touch:: New CommandData object
32
- # == raises
33
- # ArgumentError:: When the supplied command_type is invalid.
34
- def initialize(sut, app_details = nil, params = nil)
35
- @_params = params
36
- @_app_details = app_details
37
- @_sut = sut
38
- end
39
-
40
- def application_details
41
- @_app_details
42
- end
43
-
44
- def search_parameters
45
- @_params
46
- end
47
-
48
-
49
- end
50
- end
23
+
24
+ # Constructor
25
+ # == params
26
+ # btn_id:: (optional) String, id for the button perform this command on
27
+ # command_type:: (optional) Symbol, defines the command to perform on the button
28
+ # == returns
29
+ # MobyCommand::FindObjectCommand:: New CommandData object
30
+ # == raises
31
+ # ArgumentError:: When the supplied command_type is invalid.
32
+ def initialize( sut, app_details = nil, params = nil, checksum = nil )
33
+
34
+ @_params = params
35
+
36
+ @_app_details = app_details
37
+
38
+ @_sut = sut
39
+
40
+ @_checksum = checksum
41
+
42
+ end
43
+
44
+ # TODO: document me
45
+ def application_details
46
+
47
+ @_app_details
48
+
49
+ end
50
+
51
+ # TODO: document me
52
+ def search_parameters
53
+
54
+ @_params
55
+
56
+ end
57
+
58
+ # TODO: document me
59
+ def checksum
60
+
61
+ @_checksum
62
+
63
+ end
64
+
65
+ end # FindObjectCommand
66
+
67
+ end # MobyCommand
@@ -0,0 +1,34 @@
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 MobyCommand
21
+
22
+ class VersionCommand < MobyCommand::CommandData
23
+
24
+ # Constructor
25
+ # == params
26
+ # == returns
27
+ # MobyCommand::VersionCommand:: New CommandData object
28
+ # == raises
29
+ def initialize
30
+ end
31
+
32
+ end # VersionCommand
33
+
34
+ end # MobyCommand
@@ -42,7 +42,7 @@ module MobyCommand
42
42
  @@_valid_types = [ nil, :Standard, :Graphics, :Application, :Action, :Web ]
43
43
 
44
44
  self.application_id(application_id )
45
- self.object_id( object_id )
45
+ self.set_object_id( object_id )
46
46
  self.object_type( object_type )
47
47
  self.command_name( command_name )
48
48
  self.command_params( params )
@@ -123,7 +123,7 @@ module MobyCommand
123
123
  # == returns
124
124
  # == raises
125
125
  # ArgumentError:: When the supplied id is not of type String
126
- def object_id(id)
126
+ def set_object_id(id)
127
127
  raise ArgumentError.new( "Object id must be a string." ) unless id == nil or id.kind_of?( String )
128
128
  @_object_id = id
129
129
  end
@@ -20,128 +20,181 @@
20
20
  module MobyController
21
21
 
22
22
  module QT
23
-
24
- module Application
25
-
23
+
24
+ module Application
25
+
26
26
  include MobyUtil::MessageComposer
27
27
 
28
- def set_adapter( adapter )
29
-
30
- @sut_adapter = adapter
31
-
32
- end
33
-
34
- # Execute the command).
35
- # Sends the message to the device using the @sut_adapter (see base class)
36
- # == params
37
- # == returns
38
- # == raises
39
- # ArgumentError: raised if unsupported command type
40
- def execute()
41
-
42
- return_response_crc = false
43
-
44
- # application ui state
45
- if @_command == :State
46
-
47
- command_xml = state_message()
48
- return_response_crc = true
49
-
50
- # launch application
51
- elsif @_command == :Run
52
- command_xml = run_message()
53
-
54
- # close
55
- elsif @_command == :Close
56
- command_xml = close_message()
57
-
58
- # close qttas
59
- elsif @_command == :CloseQttas
60
- #params = {'uid' => '0'}
61
- command_xml = make_xml_message({:service => 'closeApplication'},'Close',{'uid' => '0'})
62
-
63
- # kill application
64
- elsif @_command == :Kill
65
- command_xml = make_xml_message({:service => 'closeApplication'},'Kill',{'uid' => @_application_uid})
66
-
67
- # list application -- raises exception??
68
- elsif @_command == :List
69
- Kernel::raise ArgumentError.new( "Unknown command! " + @_command.to_s )
70
-
71
- # list applications
72
- elsif @_command == :ListApps
73
- service_details = {:service => 'listApps', :name => @_application_name, :id => @_application_uid}
74
- command_xml = make_xml_message(service_details, 'listApps', nil )
75
-
76
- # list started applications
77
- elsif @_command == :ListStartedApps
78
- service_details = {:service => 'startedApps', :name => @_application_name, :id => @_application_uid}
79
- command_xml = make_xml_message(service_details, 'startedApps', nil )
80
-
81
- # list crashed applications
82
- elsif @_command == :ListCrashedApps
83
- service_details = {:service => 'listCrashedApps', :name => @_application_name, :id => @_application_uid}
84
- command_xml = make_xml_message(service_details, 'listCrashedApps', nil )
85
-
86
- # shell command
87
- elsif @_command == :Shell
88
- command_xml = make_xml_message({:service => 'shellCommand'}, 'shellCommand', @_flags, @_application_name)
89
-
90
- # kill all application started by agent_qt
91
- elsif @_command == :KillAll
92
- command_xml = make_xml_message({:service =>'kill'},'Kill', nil)
93
-
94
- # tap screen
95
- elsif @_command == :TapScreen
96
- command_xml = make_xml_message({:service =>'tapScreen'}, 'TapScreen', params)
97
-
98
- # bring application to foreground
99
- elsif @_command == :BringToForeground
100
- command_xml = make_xml_message({:service => 'bringToForeground'},'BringToForeground', {'pid' => @_application_uid})
101
-
102
- # system info
103
- elsif @_command == :SystemInfo
104
- command_xml = make_xml_message({:service => 'systemInfo'}, 'systemInfo', nil)
105
-
106
- # start process memory logging
107
- elsif @_command == :ProcessMemLoggingStart
108
-
109
- parameters = {
110
- 'thread_name' => @_application_name,
111
- 'file_name' => @_flags[ :file_name ],
112
- 'timestamp' => @_flags[ :timestamp ],
113
- 'interval_s' => @_flags[ :interval_s] }
114
-
115
- command_xml = make_xml_message({:service => 'resourceLogging'}, 'ProcessMemLoggingStart', parameters)
116
-
117
-
118
- # stop process memory logging
119
- elsif @_command == :ProcessMemLoggingStop
120
- parameters = {'thread_name' => @_application_name,
121
- 'return_data' => @_flags[ :return_data ]}
122
-
123
- command_xml = make_xml_message({ :service =>'resourceLogging'}, 'ProcessMemLoggingStop',parameters)
124
-
125
- # start CPU load generating
126
- elsif @_command == :CpuLoadStart
127
- parameters = {'cpu_load' => @_flags[ :cpu_load ]}
128
- command_xml = make_xml_message({:service => 'resourceLogging'},'CpuLoadStart',parameters)
129
-
130
- # stop CPU load generating
131
- elsif @_command == :CpuLoadStop
132
- command_xml = make_xml_message({:service => 'resourceLogging'},'CpuLoadStop', nil)
133
-
134
- # unknown command
135
- else
136
- Kernel::raise ArgumentError.new( "Unknown command! " + @_command.to_s )
137
- end
138
-
139
- message = Comms::MessageGenerator.generate( command_xml )
140
- @sut_adapter.send_service_request( message, return_response_crc ) if message
141
- end
142
-
143
- end # application
144
-
145
- end # QT
28
+ def set_adapter( adapter )
29
+
30
+ @sut_adapter = adapter
31
+
32
+ end
33
+
34
+ # Execute the command
35
+ # Sends the message to the device using the @sut_adapter (see base class)
36
+ # == params
37
+ # == returns
38
+ # == raises
39
+ # ArgumentError: raised if unsupported command type
40
+ def execute
41
+
42
+ return_response_crc = false
43
+
44
+ case @_command
45
+
46
+ # application ui state
47
+ when :State
48
+
49
+ command_xml = state_message
50
+
51
+ return_response_crc = true
52
+
53
+ # launch application
54
+ when :Run
55
+
56
+ command_xml = run_message
57
+
58
+ # close
59
+ when :Close
60
+
61
+ command_xml = close_message
62
+
63
+ # close qttas
64
+ when :CloseQttas
65
+
66
+ command_xml = make_xml_message( { :service => 'closeApplication' }, 'Close', { 'uid' => '0' } )
67
+
68
+ # kill application
69
+ when :Kill
70
+
71
+ command_xml = make_xml_message( { :service => 'closeApplication' }, 'Kill', { 'uid' => @_application_uid } )
72
+
73
+ # list applications
74
+ when :ListApps
75
+
76
+ service_details = {
77
+ :service => 'listApps',
78
+ :name => @_application_name,
79
+ :id => @_application_uid
80
+ }
81
+
82
+ command_xml = make_xml_message( service_details, 'listApps', nil )
83
+
84
+ # list applications
85
+ when :ListRunningProcesses
86
+
87
+ service_details = {
88
+ :service => 'listRunningProcesses',
89
+ :name => @_application_name,
90
+ :id => @_application_uid
91
+ }
92
+
93
+ command_xml = make_xml_message( service_details, 'listRunningProcesses', nil )
94
+
95
+ # list started applications
96
+ when :ListStartedApps
97
+
98
+ service_details = {
99
+ :service => 'startedApps',
100
+ :name => @_application_name,
101
+ :id => @_application_uid
102
+ }
103
+
104
+ command_xml = make_xml_message( service_details, 'startedApps', nil )
105
+
106
+ # list crashed applications
107
+ when :ListCrashedApps
108
+
109
+ service_details = {
110
+ :service => 'listCrashedApps',
111
+ :name => @_application_name,
112
+ :id => @_application_uid
113
+ }
114
+
115
+ command_xml = make_xml_message( service_details, 'listCrashedApps', nil )
116
+
117
+ # shell command
118
+ when :Shell
119
+
120
+ command_xml = make_xml_message( { :service => 'shellCommand' }, 'shellCommand', @_flags, @_application_name )
121
+
122
+ # kill all application started by agent_qt
123
+ when :KillAll
124
+
125
+ command_xml = make_xml_message( { :service => 'kill' }, 'Kill', nil )
126
+
127
+ # tap screen
128
+ when :TapScreen
129
+
130
+ command_xml = make_xml_message( { :service =>'tapScreen' }, 'TapScreen', params)
131
+
132
+ # bring application to foreground
133
+ when :BringToForeground
134
+
135
+ command_xml = make_xml_message( { :service => 'bringToForeground' }, 'BringToForeground', { 'pid' => @_application_uid } )
136
+
137
+ # system info
138
+ when :SystemInfo
139
+
140
+ command_xml = make_xml_message( { :service => 'systemInfo' }, 'systemInfo', nil)
141
+
142
+ # start process memory logging
143
+ when :ProcessMemLoggingStart
144
+
145
+ parameters = {
146
+ 'thread_name' => @_application_name,
147
+ 'file_name' => @_flags[ :file_name ],
148
+ 'timestamp' => @_flags[ :timestamp ],
149
+ 'interval_s' => @_flags[ :interval_s ]
150
+ }
151
+
152
+ command_xml = make_xml_message( { :service => 'resourceLogging' }, 'ProcessMemLoggingStart', parameters )
153
+
154
+ # stop process memory logging
155
+ when :ProcessMemLoggingStop
156
+
157
+ parameters = {
158
+ 'thread_name' => @_application_name,
159
+ 'return_data' => @_flags[ :return_data ]
160
+ }
161
+
162
+ command_xml = make_xml_message( { :service =>'resourceLogging' }, 'ProcessMemLoggingStop', parameters )
163
+
164
+ # start CPU load generating
165
+ when :CpuLoadStart
166
+
167
+ parameters = {
168
+ 'cpu_load' => @_flags[ :cpu_load ]
169
+ }
170
+
171
+ command_xml = make_xml_message( { :service => 'resourceLogging' }, 'CpuLoadStart', parameters )
172
+
173
+ # stop CPU load generating
174
+ when :CpuLoadStop
175
+
176
+ command_xml = make_xml_message( { :service => 'resourceLogging' }, 'CpuLoadStop', nil )
177
+
178
+ # list application -- raises exception??
179
+ #when :List
180
+
181
+ #raise ArgumentError, "Unknown command! #{ @_command.to_s }"
182
+
183
+ else
184
+
185
+ # unknown command
186
+ raise ArgumentError, "Unknown command! #{ @_command.to_s }"
187
+
188
+ end
189
+
190
+ message = Comms::MessageGenerator.generate( command_xml )
191
+
192
+ @sut_adapter.send_service_request( message, return_response_crc ) if message
193
+
194
+ end
195
+
196
+ end # application
197
+
198
+ end # QT
146
199
 
147
200
  end # MobyController
@@ -21,30 +21,39 @@ module MobyController
21
21
 
22
22
  module QT
23
23
 
24
- module FindObjectCommand
25
- include MobyUtil::FindObjectGenerator
26
-
27
- # Execute the command
28
- # Sends the message to the device using the @sut_adapter (see base class)
29
- # == params
30
- # == returns
31
- # == raises
32
- # NotImplementedError: raised if unsupported command type
33
- def execute
34
- msg = generate_message
35
- @sut_adapter.send_service_request(MobyController::QT::Comms::MessageGenerator.generate(msg), true)
36
- end
37
-
38
- def set_adapter( adapter )
39
- @sut_adapter = adapter
40
- end
41
-
42
- # enable hooking for performance measurement & debug logging
43
- TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
44
-
45
- end #module FindObjectCommand
46
-
47
- end #module QT
48
-
49
- end #module MobyController
24
+ module FindObjectCommand
25
+
26
+ include MobyUtil::FindObjectGenerator
27
+
28
+ # Execute the command
29
+ # Sends the message to the device using the @sut_adapter (see base class)
30
+ # == params
31
+ # == returns
32
+ # == raises
33
+ # NotImplementedError: raised if unsupported command type
34
+ def execute
35
+
36
+ @sut_adapter.send_service_request(
37
+
38
+ # *[ message, return_crc ]
39
+ MobyController::QT::Comms::MessageGenerator.generate( generate_message ), true
40
+
41
+ )
42
+
43
+ end
44
+
45
+ def set_adapter( adapter )
46
+
47
+ @sut_adapter = adapter
48
+
49
+ end
50
+
51
+ # enable hooking for performance measurement & debug logging
52
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
53
+
54
+ end # FindObjectCommand
55
+
56
+ end # QT
57
+
58
+ end # MobyController
50
59