testability-driver-qt-sut-plugin 0.9.2
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.
- data/env.rb +26 -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 +156 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb +318 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/attribute.rb +227 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/behaviour.rb +140 -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/events.rb +165 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/file_transfer.rb +333 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb +80 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fixture.rb +178 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/gesture.rb +906 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb +604 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/key_press.rb +152 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/locale_db.rb +151 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/method.rb +85 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/multitouch.rb +455 -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 +124 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/screen_capture.rb +283 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/sut.rb +492 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb +113 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/treewidgetitemcolumn.rb +93 -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 +230 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/widget.rb +663 -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 +50 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/fixture.rb +45 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/group.rb +48 -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 +170 -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/widget.rb +226 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/application.rb +264 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/configure_command.rb +60 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/find_object.rb +114 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/fixture.rb +67 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/group.rb +52 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/infologger_command.rb +62 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/key_sequence.rb +99 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/screen_capture.rb +54 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/tap.rb +51 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/widget.rb +72 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/plugin.rb +119 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/adapter.rb +225 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb +154 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/controller.rb +58 -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/widget.rb +82 -0
- data/lib/testability-driver-qt-sut-plugin.rb +24 -0
- data/xml/behaviour/qt.xml +717 -0
- data/xml/defaults/sut_qt.xml +9 -0
- data/xml/keymap/qt.xml +321 -0
- data/xml/template/qt.xml +124 -0
- metadata +141 -0
|
@@ -0,0 +1,60 @@
|
|
|
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 MobyController
|
|
21
|
+
|
|
22
|
+
module QT
|
|
23
|
+
|
|
24
|
+
module ConfigureCommand
|
|
25
|
+
|
|
26
|
+
# Execute the command
|
|
27
|
+
# Sends the message to the device using the @sut_adapter (see base class)
|
|
28
|
+
# == params
|
|
29
|
+
# == returns
|
|
30
|
+
# == raises
|
|
31
|
+
# NotImplementedError: raised if unsupported command type
|
|
32
|
+
def execute
|
|
33
|
+
|
|
34
|
+
@sut_adapter.send_service_request(
|
|
35
|
+
Comms::MessageGenerator.generate(
|
|
36
|
+
Nokogiri::XML::Builder.new{
|
|
37
|
+
TasCommands( :service => "confService", :id=> application_id ) {
|
|
38
|
+
Target( :TasId => "Application" ) {
|
|
39
|
+
Command( value || "", ( params || {} ).merge( :name => name ) )
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}.to_xml
|
|
43
|
+
)
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def set_adapter( adapter )
|
|
49
|
+
@sut_adapter = adapter
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# enable hooking for performance measurement & debug logging
|
|
53
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
54
|
+
|
|
55
|
+
end #module ConfigureCommand
|
|
56
|
+
|
|
57
|
+
end #module QT
|
|
58
|
+
|
|
59
|
+
end #module MobyController
|
|
60
|
+
|
data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/find_object.rb
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
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 MobyController
|
|
21
|
+
|
|
22
|
+
module QT
|
|
23
|
+
|
|
24
|
+
module FindObjectCommand
|
|
25
|
+
|
|
26
|
+
# Execute the command
|
|
27
|
+
# Sends the message to the device using the @sut_adapter (see base class)
|
|
28
|
+
# == params
|
|
29
|
+
# == returns
|
|
30
|
+
# == raises
|
|
31
|
+
# NotImplementedError: raised if unsupported command type
|
|
32
|
+
def execute
|
|
33
|
+
filters = make_params if MobyUtil::Parameter[ @_sut.id ][ :filter_type, 'none' ] == 'dynamic'
|
|
34
|
+
|
|
35
|
+
params = search_parameters
|
|
36
|
+
|
|
37
|
+
builder = Nokogiri::XML::Builder.new do |xml|
|
|
38
|
+
xml.TasCommands( ( application_details || {} ).merge( :service => "findObject") ) {
|
|
39
|
+
xml.Target{
|
|
40
|
+
add_objects(xml, params)
|
|
41
|
+
xml.Command( :name => 'findObject' ){
|
|
42
|
+
filters.collect{ | name, value |
|
|
43
|
+
xml.param( :name => name, :value => value )
|
|
44
|
+
}
|
|
45
|
+
} if MobyUtil::Parameter[ @_sut.id ][ :filter_type, 'none' ] == 'dynamic'
|
|
46
|
+
} if params and params.size > 0
|
|
47
|
+
}
|
|
48
|
+
end
|
|
49
|
+
msg = builder.to_xml
|
|
50
|
+
#puts msg.to_s
|
|
51
|
+
|
|
52
|
+
@sut_adapter.send_service_request(Comms::MessageGenerator.generate(msg), true)
|
|
53
|
+
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def set_adapter( adapter )
|
|
57
|
+
@sut_adapter = adapter
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
private
|
|
61
|
+
|
|
62
|
+
def add_objects(builder, params)
|
|
63
|
+
parent = builder.parent
|
|
64
|
+
params.each{|objectParams| parent = create_object_node(builder, objectParams, parent)}
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def create_object_node(builder, params, parent)
|
|
68
|
+
node = Nokogiri::XML::Node.new('object', builder.doc)
|
|
69
|
+
params.keys.each{|key| node[key.to_s] = params[key].to_s}
|
|
70
|
+
parent.add_child(node)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def make_params
|
|
75
|
+
params = {}
|
|
76
|
+
|
|
77
|
+
# get sut paramteres only once, store to local variable
|
|
78
|
+
sut_parameters = MobyUtil::Parameter[ @_sut.id ]
|
|
79
|
+
|
|
80
|
+
params[ 'filterProperties' ] = $last_parameter if sut_parameters[ :filter_properties, nil ]
|
|
81
|
+
params[ 'pluginBlackList' ] = $last_parameter if sut_parameters[ :plugin_blacklist, nil ]
|
|
82
|
+
params[ 'pluginWhiteList' ] = $last_parameter if sut_parameters[ :plugin_whitelist, nil ]
|
|
83
|
+
|
|
84
|
+
case sut_parameters[ :filter_type, 'none' ]
|
|
85
|
+
|
|
86
|
+
when 'dynamic'
|
|
87
|
+
|
|
88
|
+
# updates the filter with the current backtrace file list
|
|
89
|
+
MobyUtil::DynamicAttributeFilter.instance.update_filter( caller( 0 ) )
|
|
90
|
+
|
|
91
|
+
white_list = MobyUtil::DynamicAttributeFilter.instance.filter_string
|
|
92
|
+
params['attributeWhiteList'] = white_list if white_list
|
|
93
|
+
|
|
94
|
+
when 'static'
|
|
95
|
+
|
|
96
|
+
params['attributeBlackList'] = $last_parameter if sut_parameters[ :attribute_blacklist, nil ]
|
|
97
|
+
params['attributeWhiteList'] = $last_parameter if sut_parameters[ :attribute_whitelist, nil ]
|
|
98
|
+
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
params
|
|
102
|
+
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
# enable hooking for performance measurement & debug logging
|
|
107
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
108
|
+
|
|
109
|
+
end #module FindObjectCommand
|
|
110
|
+
|
|
111
|
+
end #module QT
|
|
112
|
+
|
|
113
|
+
end #module MobyController
|
|
114
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
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 MobyController
|
|
21
|
+
|
|
22
|
+
module QT
|
|
23
|
+
|
|
24
|
+
module Fixture
|
|
25
|
+
|
|
26
|
+
# Execute the command
|
|
27
|
+
# Sends the message to the device using the @sut_adapter (see base class)
|
|
28
|
+
# == params
|
|
29
|
+
# == returns
|
|
30
|
+
# == raises
|
|
31
|
+
# NotImplementedError: raised if unsupported command type
|
|
32
|
+
def execute
|
|
33
|
+
|
|
34
|
+
Kernel::raise ArgumentError.new( "Fixture '%s' not found for sut id '%s'" % [ @name, @sut_adapter.sut_id ] ) if ( fixture_plugin = MobyUtil::Parameter[ @sut_adapter.sut_id.to_sym ][ :fixtures ][ @name.to_sym, nil ] ).nil?
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@sut_adapter.send_service_request(
|
|
38
|
+
Comms::MessageGenerator.generate(
|
|
39
|
+
Nokogiri::XML::Builder.new{
|
|
40
|
+
TasCommands( :id => @context.application_id, :transitions => @context.transitions, :service => "fixture", :async => @context.asynchronous ) {
|
|
41
|
+
Target( :TasId => @context.object_id, :type => @context.object_type ) {
|
|
42
|
+
Command( :name => "Fixture", :plugin => fixture_plugin, :method => @context.command ) {
|
|
43
|
+
@context.params.collect{ | name, value |
|
|
44
|
+
param( :name => name, :value => value )
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}.to_xml
|
|
50
|
+
)
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def set_adapter( adapter )
|
|
56
|
+
@sut_adapter = adapter
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# enable hooking for performance measurement & debug logging
|
|
60
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
end # Fixture
|
|
64
|
+
|
|
65
|
+
end #module QT
|
|
66
|
+
|
|
67
|
+
end #module MobyController
|
|
@@ -0,0 +1,52 @@
|
|
|
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 MobyController
|
|
21
|
+
|
|
22
|
+
module QT
|
|
23
|
+
|
|
24
|
+
module Group
|
|
25
|
+
|
|
26
|
+
# Execute the command).
|
|
27
|
+
# Sends the message to the device using the @sut_adapter (see base class)
|
|
28
|
+
# == params
|
|
29
|
+
# == returns
|
|
30
|
+
# == raises
|
|
31
|
+
# NotImplementedError: raised if unsupported command type
|
|
32
|
+
def execute
|
|
33
|
+
builder = Nokogiri::XML::Builder.new{
|
|
34
|
+
TasCommands( :id=> application.id.to_s, :transitions => 'true', :service => 'uiCommand', :interval => interval.to_s, :multitouch => multitouch.to_s)
|
|
35
|
+
}
|
|
36
|
+
@sut_adapter.set_message_builder(builder)
|
|
37
|
+
block.call
|
|
38
|
+
@sut_adapter.send_grouped_request
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def set_adapter( adapter )
|
|
42
|
+
@sut_adapter = adapter
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# enable hooking for performance measurement & debug logging
|
|
46
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
47
|
+
|
|
48
|
+
end #module Group
|
|
49
|
+
|
|
50
|
+
end #module QT
|
|
51
|
+
|
|
52
|
+
end #module MobyController
|
|
@@ -0,0 +1,62 @@
|
|
|
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 MobyController
|
|
21
|
+
|
|
22
|
+
module QT
|
|
23
|
+
|
|
24
|
+
module InfoLoggerCommand
|
|
25
|
+
|
|
26
|
+
# Execute the command
|
|
27
|
+
# Sends the message to the device using the @sut_adapter (see base class)
|
|
28
|
+
# == params
|
|
29
|
+
# == returns
|
|
30
|
+
# == raises
|
|
31
|
+
# NotImplementedError: raised if unsupported command type
|
|
32
|
+
def execute
|
|
33
|
+
|
|
34
|
+
@sut_adapter.send_service_request(
|
|
35
|
+
Comms::MessageGenerator.generate(
|
|
36
|
+
Nokogiri::XML::Builder.new{
|
|
37
|
+
TasCommands( :service => "infoService", :id=> application_id, :interval => params[:interval] ) {
|
|
38
|
+
Target( :TasId => "Application" ) {
|
|
39
|
+
Command( value || "", ( params || {} ).merge( :name => name ) )
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}.to_xml
|
|
43
|
+
)
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def set_adapter( adapter )
|
|
49
|
+
|
|
50
|
+
@sut_adapter = adapter
|
|
51
|
+
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# enable hooking for performance measurement & debug logging
|
|
55
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
end # InfoLoggerCommand
|
|
59
|
+
|
|
60
|
+
end #module QT
|
|
61
|
+
|
|
62
|
+
end #module MobyController
|
data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/key_sequence.rb
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
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 MobyController
|
|
21
|
+
|
|
22
|
+
module QT
|
|
23
|
+
|
|
24
|
+
module KeySequence
|
|
25
|
+
|
|
26
|
+
def set_adapter( adapter )
|
|
27
|
+
@sut_adapter = adapter
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Execute the command(s). Iterated trough the @message_array and sends all
|
|
31
|
+
# message to the device using the @sut_adapter (see base class)
|
|
32
|
+
# == params
|
|
33
|
+
# == returns
|
|
34
|
+
# == raises
|
|
35
|
+
# RuntimeError: No service request to be sent due to key sequence is empty
|
|
36
|
+
def execute
|
|
37
|
+
message = Comms::MessageGenerator.generate(make_message)
|
|
38
|
+
@sut_adapter.send_service_request( message )
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
#
|
|
43
|
+
# Internal message generation method. Makes xml messages from the command_data
|
|
44
|
+
# == params
|
|
45
|
+
# none
|
|
46
|
+
def make_message
|
|
47
|
+
|
|
48
|
+
press_types = { :KeyDown => 'KeyPress', :KeyUp => 'KeyRelease' }
|
|
49
|
+
|
|
50
|
+
sut = @_sut
|
|
51
|
+
sequence = @sequence
|
|
52
|
+
|
|
53
|
+
message = Nokogiri::XML::Builder.new{
|
|
54
|
+
|
|
55
|
+
TasCommands( :id => sut.application.id, :transitions => 'true', :service => 'uiCommand' ){
|
|
56
|
+
|
|
57
|
+
Target( :TasId => 'FOCUSWIDGET', :type => 'Standard' ){
|
|
58
|
+
|
|
59
|
+
sequence.each{ | key_press |
|
|
60
|
+
|
|
61
|
+
key_press[ :value ].tap{ | key |
|
|
62
|
+
|
|
63
|
+
# raise exception if value type other than Fixnum or Symbol
|
|
64
|
+
Kernel::raise ArgumentError.new( "Wrong argument type %s for key (Expected: %s)" % [ key.class, "Symbol/Fixnum" ] ) unless [ Fixnum, Symbol ].include?( key.class )
|
|
65
|
+
|
|
66
|
+
# verify that keymap is defined for sut if symbol used.
|
|
67
|
+
Kernel::raise ArgumentError.new("Symbol #{ key.inspect } cannot be used due to no keymap defined for #{ sut.id } in TDriver configuration file.") if key.kind_of?( Symbol ) && MobyUtil::Parameter[ sut.id ][ :keymap ].nil?
|
|
68
|
+
|
|
69
|
+
# retrieve corresponding scan code (type of string, convert to fixnum) for symbol from keymap if available
|
|
70
|
+
key = MobyUtil::Parameter[ sut.id ][ :keymap ][ key ].hex unless MobyUtil::Parameter[ sut.id ][ :keymap ][ key ].nil?
|
|
71
|
+
|
|
72
|
+
# raise exception if value is other than fixnum
|
|
73
|
+
Kernel::raise ArgumentError.new( "Scan code for :%s not defined in keymap" % key ) unless key.kind_of?( Fixnum )
|
|
74
|
+
|
|
75
|
+
# determine keypress type
|
|
76
|
+
press_type = { :KeyDown => 'KeyPress', :KeyUp => 'KeyRelease' }.fetch( key_press[ :type ] ){ "KeyClick" }
|
|
77
|
+
|
|
78
|
+
Command( key.to_s, "name" => press_type.to_s, "modifiers" => "0", "delay" => "0")
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}.to_xml
|
|
87
|
+
|
|
88
|
+
message
|
|
89
|
+
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# enable hooking for performance measurement & debug logging
|
|
93
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
94
|
+
|
|
95
|
+
end #class
|
|
96
|
+
|
|
97
|
+
end #module QT
|
|
98
|
+
|
|
99
|
+
end #module MobyController
|