testability-driver-qt-sut-plugin 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/env.rb
ADDED
@@ -0,0 +1,26 @@
|
|
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
|
+
PLUGIN_NAME = "Testability Driver Qt SUT plugin"
|
23
|
+
GEM_NAME = 'testability-driver-qt-sut-plugin'
|
24
|
+
GEM_SUMMARY = 'Testability Driver - Testability Driver Interface Qt SUT plugin'
|
25
|
+
PLUGIN_VERSION = "0.8.4"
|
26
|
+
|
@@ -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
|
+
|
21
|
+
|
22
|
+
require 'rubygems'
|
23
|
+
|
24
|
+
begin
|
25
|
+
|
26
|
+
require 'tdriver/util/common'
|
27
|
+
|
28
|
+
rescue LoadError => exception
|
29
|
+
|
30
|
+
Kernel::raise LoadError.new( "SUT plugin requires TDriver" )
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
MobyUtil::GemHelper.install( MobyUtil::FileHelper.tdriver_home ){ | tdriver_home_folder |
|
35
|
+
|
36
|
+
[
|
37
|
+
|
38
|
+
# default parameters & sut configuration
|
39
|
+
[ "../xml/defaults/*.xml", "defaults/", true ],
|
40
|
+
|
41
|
+
# parameters
|
42
|
+
[ '../xml/behaviour/*.xml', "behaviours/", true ],
|
43
|
+
[ '../xml/behaviour/*.xml', "default/behaviours/", true ],
|
44
|
+
|
45
|
+
# templates
|
46
|
+
[ "../xml/template/*.xml", "templates/", true ],
|
47
|
+
[ "../xml/template/*.xml", "default/templates/", true ],
|
48
|
+
|
49
|
+
# behaviours
|
50
|
+
[ "../xml/keymap/*.xml", "keymaps/", true ],
|
51
|
+
[ "../xml/keymap/*.xml", "default/keymaps/", true ]
|
52
|
+
|
53
|
+
].each { | task |
|
54
|
+
|
55
|
+
source, destination, overwrite = task
|
56
|
+
|
57
|
+
MobyUtil::FileHelper.copy_file( source, "#{ tdriver_home_folder }/#{ destination }", false, overwrite, true )
|
58
|
+
|
59
|
+
}
|
60
|
+
|
61
|
+
}
|
62
|
+
|
@@ -0,0 +1,23 @@
|
|
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
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'testability-driver-qt-sut-plugin/plugin.rb' ) )
|
23
|
+
|
@@ -0,0 +1,156 @@
|
|
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
|
+
# This module contains behaviours specific to actions
|
26
|
+
#
|
27
|
+
# == behaviour
|
28
|
+
# QtAction
|
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
|
+
# QAction
|
44
|
+
#
|
45
|
+
module Action
|
46
|
+
|
47
|
+
include MobyBehaviour::QT::Behaviour
|
48
|
+
|
49
|
+
# == description
|
50
|
+
# Hover over an action inside a visible widget.\n
|
51
|
+
# \n
|
52
|
+
# Hover is done by determining action's coordinates inside parent widget and moving mouse cursor there.
|
53
|
+
# Therefore, the parent object in script must be a visible widget containing that action.
|
54
|
+
# For example, a menu must be opened first, before actions inside the menu can be hovered.\n
|
55
|
+
# \n
|
56
|
+
# [b]NOTE:[/b] Moving mouse cursor over action's position may not do anything,
|
57
|
+
# unless test application window is topmost, or at least not obscured by other windows.
|
58
|
+
# This can be a problem especially when testing desktop applications on Windows 7.\n
|
59
|
+
# \n
|
60
|
+
# [b]IMPORTANT:[/b] In future this method may be changed to call hover slot of QAction instead of using mouse,
|
61
|
+
# or deprecated and replace by a new method of different name better describing that this uses mouse.
|
62
|
+
#
|
63
|
+
# == arguments
|
64
|
+
# refresh
|
65
|
+
# Boolean
|
66
|
+
# description: Determine is refresh done after trigger command
|
67
|
+
# example: true
|
68
|
+
# default: false
|
69
|
+
#
|
70
|
+
# == returns
|
71
|
+
# NilClass
|
72
|
+
# description: -
|
73
|
+
# example: -
|
74
|
+
#
|
75
|
+
# == exceptions
|
76
|
+
# Exception
|
77
|
+
# description: No special exceptions, may throw any exception
|
78
|
+
def hover( refresh = false )
|
79
|
+
begin
|
80
|
+
|
81
|
+
command = command_params #in qt_behaviour
|
82
|
+
command.object_type( :Action )
|
83
|
+
command.command_name( 'Hover' )
|
84
|
+
command.object_id( @parent.id )
|
85
|
+
command.command_params( 'id' => id )
|
86
|
+
@sut.execute_command( command )
|
87
|
+
self.force_refresh({:id => get_application_id}) if refresh
|
88
|
+
|
89
|
+
rescue Exception => e
|
90
|
+
|
91
|
+
MobyUtil::Logger.instance.log "behaviour" , "FAIL;Failed hover with refresh \"#{ refresh.to_s }\".;#{ identity };hover;"
|
92
|
+
Kernel::raise e
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
MobyUtil::Logger.instance.log "behaviour" , "PASS;Hover operation executed successfully with refresh \"#{ refresh.to_s }\".;#{ identity };hover;"
|
97
|
+
nil
|
98
|
+
end
|
99
|
+
|
100
|
+
# == description
|
101
|
+
# Activate action inside a visible widget.\n
|
102
|
+
# \n
|
103
|
+
# Trigger is done by determining action's coordinates inside parent widget, performing mouse press down and up there.
|
104
|
+
# Therefore, the parent object in script must be a visible widget containing that action.
|
105
|
+
# For example, a menu must be opened first, before actions inside the menu can be triggered.\n
|
106
|
+
# \n
|
107
|
+
# [b]IMPORTANT:[/b] In future this method may be changed to call trigger slot of QAction instead of using mouse,
|
108
|
+
# or deprecated and replace by a differently named method better describing that this uses mouse.
|
109
|
+
#
|
110
|
+
# == arguments
|
111
|
+
# refresh
|
112
|
+
# Boolean
|
113
|
+
# description: Determine is refresh done after trigger command
|
114
|
+
# example: true
|
115
|
+
# default: false
|
116
|
+
#
|
117
|
+
# == returns
|
118
|
+
# NilClass
|
119
|
+
# description: -
|
120
|
+
# example: -
|
121
|
+
#
|
122
|
+
# == exceptions
|
123
|
+
# Exception
|
124
|
+
# description: No special exceptions, may throw any exception
|
125
|
+
def trigger( refresh = false )
|
126
|
+
|
127
|
+
begin
|
128
|
+
command = command_params #in qt_behaviour
|
129
|
+
command.object_type( :Action )
|
130
|
+
command.command_name( 'Trigger' )
|
131
|
+
command.object_id( @parent.id )
|
132
|
+
command.command_params( 'id'=>id )
|
133
|
+
|
134
|
+
@sut.execute_command( command )
|
135
|
+
self.force_refresh({:id => get_application_id}) if refresh
|
136
|
+
|
137
|
+
rescue Exception => e
|
138
|
+
|
139
|
+
MobyUtil::Logger.instance.log "behaviour" , "FAIL;Failed trigger with refresh \"#{ refresh.to_s }\".;#{ identity };trigger;"
|
140
|
+
Kernel::raise e
|
141
|
+
|
142
|
+
end
|
143
|
+
|
144
|
+
MobyUtil::Logger.instance.log "behaviour" , "PASS;Trigger operation executed successfully with refresh \"#{ refresh.to_s }\".;#{ identity };trigger;"
|
145
|
+
nil
|
146
|
+
end
|
147
|
+
|
148
|
+
# enable hooking for performance measurement & debug logging
|
149
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
150
|
+
|
151
|
+
|
152
|
+
end # Action
|
153
|
+
|
154
|
+
end # QT
|
155
|
+
|
156
|
+
end # MobyBehaviour
|
data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb
ADDED
@@ -0,0 +1,318 @@
|
|
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
|
+
include TDriverVerify
|
21
|
+
|
22
|
+
module MobyBehaviour
|
23
|
+
|
24
|
+
module QT
|
25
|
+
|
26
|
+
# == description
|
27
|
+
# Application specific behaviours
|
28
|
+
#
|
29
|
+
# == behaviour
|
30
|
+
# QtApplication
|
31
|
+
#
|
32
|
+
# == requires
|
33
|
+
# testability-driver-qt-sut-plugin
|
34
|
+
#
|
35
|
+
# == input_type
|
36
|
+
# touch
|
37
|
+
#
|
38
|
+
# == sut_type
|
39
|
+
# qt
|
40
|
+
#
|
41
|
+
# == sut_version
|
42
|
+
# *
|
43
|
+
#
|
44
|
+
# == objects
|
45
|
+
# Application
|
46
|
+
#
|
47
|
+
module Application
|
48
|
+
|
49
|
+
# == description
|
50
|
+
# Drag from the start coordinates to the end coordinates.
|
51
|
+
#
|
52
|
+
# == arguments
|
53
|
+
# start_x
|
54
|
+
# Integer
|
55
|
+
# description: Starting x coordinate
|
56
|
+
# example: 10
|
57
|
+
#
|
58
|
+
# == arguments
|
59
|
+
# start_y
|
60
|
+
# Integer
|
61
|
+
# description: Starting y coordinate
|
62
|
+
# example: 10
|
63
|
+
#
|
64
|
+
# == arguments
|
65
|
+
# end_x
|
66
|
+
# Integer
|
67
|
+
# description: End x coordinate
|
68
|
+
# example: 30
|
69
|
+
#
|
70
|
+
# == arguments
|
71
|
+
# end_y
|
72
|
+
# Integer
|
73
|
+
# description: End y coordinate
|
74
|
+
# example: 100
|
75
|
+
#
|
76
|
+
# duration
|
77
|
+
# Integer
|
78
|
+
# description: How long will the drag take in millis
|
79
|
+
# example: 1000
|
80
|
+
#
|
81
|
+
# == returns
|
82
|
+
# NilClass
|
83
|
+
# description: -
|
84
|
+
# example: -
|
85
|
+
#
|
86
|
+
def drag( start_x, start_y, end_x, end_y, duration = 1000 )
|
87
|
+
|
88
|
+
@sut.execute_command( MobyCommand::Drag.new( start_x, start_y, end_x, end_y, duration ) )
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
# == description
|
93
|
+
# Kills the application process
|
94
|
+
#
|
95
|
+
# == returns
|
96
|
+
# NilClass
|
97
|
+
# description: -
|
98
|
+
# example: -
|
99
|
+
#
|
100
|
+
def kill
|
101
|
+
|
102
|
+
@sut.execute_command( MobyCommand::Application.new( :Kill, self.executable_name, self.uid, self.sut, nil ) )
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
# == description
|
107
|
+
# Start to track a popup that may appear on the screen. Tracking is done based on the class name of the
|
108
|
+
# widget implementing popup functionality. Base class name can also be used in case framework level
|
109
|
+
# popup base class is available. The idea of the detection is to track info notes that appear
|
110
|
+
# on the screen for a moment and are therefore difficult to verify manually.
|
111
|
+
#
|
112
|
+
# == arguments
|
113
|
+
# class_name
|
114
|
+
# String
|
115
|
+
# description: Name of the popup implementation class. Base class name can also be used.
|
116
|
+
# example: PopupClass
|
117
|
+
#
|
118
|
+
# wait_time
|
119
|
+
# Integer
|
120
|
+
# description: How long to wait for the popup to appear
|
121
|
+
# example: 5
|
122
|
+
#
|
123
|
+
# == returns
|
124
|
+
# NilClass
|
125
|
+
# description: -
|
126
|
+
# example: -
|
127
|
+
#
|
128
|
+
def track_popup(class_name, wait_time=1)
|
129
|
+
wait_time = wait_time*1000
|
130
|
+
fixture('popup', 'waitPopup',{:className => class_name, :interval => wait_time.to_s})
|
131
|
+
end
|
132
|
+
|
133
|
+
# == description
|
134
|
+
# Verify was the popup on the screen or not. The method uses matti verify internally for the verification.
|
135
|
+
# If the popup was shown then the entire application ui state is returned as a test object.
|
136
|
+
# More detailed verification can be done for the object (e.g. the content of the popup, labels etc...).
|
137
|
+
# \n
|
138
|
+
# Note: If the popup does not close the verification will fail. Detection is based on grabbing the ui state just before the popup closes.
|
139
|
+
#
|
140
|
+
# == arguments
|
141
|
+
# class_name
|
142
|
+
# String
|
143
|
+
# description: Name of the popup implementation class. Base class name can also be used.
|
144
|
+
# example: PopupClass
|
145
|
+
#
|
146
|
+
# time_out
|
147
|
+
# Integer
|
148
|
+
# description: Time in seconds for how long to wait for the popup data.
|
149
|
+
# example: 5
|
150
|
+
#
|
151
|
+
# == returns
|
152
|
+
# TestObject
|
153
|
+
# description: An ui state test object from the time the popup was detected. Can be used the same way as other test objects.
|
154
|
+
# example: -
|
155
|
+
#
|
156
|
+
#
|
157
|
+
def verify_popup(class_name, time_out = 5)
|
158
|
+
xml_source = nil
|
159
|
+
verify(time_out) {xml_source = @sut.application.fixture('popup', 'printPopup',{:className => class_name})}
|
160
|
+
MobyBase::StateObject.new( xml_source )
|
161
|
+
end
|
162
|
+
|
163
|
+
# == description
|
164
|
+
# Bring the application to foreground. Note! Currently this works only for Symbian OS target!
|
165
|
+
#
|
166
|
+
# == returns
|
167
|
+
# NilClass
|
168
|
+
# description: -
|
169
|
+
# example: -
|
170
|
+
#
|
171
|
+
#
|
172
|
+
def bring_to_foreground
|
173
|
+
@sut.execute_command(MobyCommand::Application.new(:BringToForeground, nil, self.uid, self.sut))
|
174
|
+
end
|
175
|
+
|
176
|
+
# == description
|
177
|
+
# Taps the given objects at the same time (multitouch).
|
178
|
+
#
|
179
|
+
# == arguments
|
180
|
+
# objects
|
181
|
+
# Array
|
182
|
+
# description: Array of objects to tap.
|
183
|
+
# example: [@app.Square( :name => 'topLeft' ), @app.Square( :name => 'topRight' )]
|
184
|
+
#
|
185
|
+
# == returns
|
186
|
+
# NilClass
|
187
|
+
# description: -
|
188
|
+
# example: -
|
189
|
+
#
|
190
|
+
# == exceptions
|
191
|
+
# ArgumentError
|
192
|
+
# description: objects is not an array
|
193
|
+
#
|
194
|
+
def tap_objects(objects)
|
195
|
+
|
196
|
+
raise ArgumentError.new("Nothing to tap") unless objects.kind_of?(Array)
|
197
|
+
|
198
|
+
multitouch_operation{
|
199
|
+
objects.each { |o| o.tap }
|
200
|
+
}
|
201
|
+
|
202
|
+
end
|
203
|
+
|
204
|
+
# == description
|
205
|
+
# Taps down the given objects at the same time (multitouch).
|
206
|
+
#
|
207
|
+
# == arguments
|
208
|
+
# objects
|
209
|
+
# Array
|
210
|
+
# description: Array of objects to tap down.
|
211
|
+
# example: [@app.Square( :name => 'topLeft' ), @app.Square( :name => 'topRight' )]
|
212
|
+
#
|
213
|
+
# == returns
|
214
|
+
# NilClass
|
215
|
+
# description: -
|
216
|
+
# example: -
|
217
|
+
#
|
218
|
+
# == exceptions
|
219
|
+
# ArgumentError
|
220
|
+
# description: objects is not an array
|
221
|
+
#
|
222
|
+
def tap_down_objects(objects)
|
223
|
+
|
224
|
+
raise ArgumentError.new("Nothing to tap") unless objects.kind_of?(Array)
|
225
|
+
|
226
|
+
multitouch_operation{
|
227
|
+
objects.each { |o| o.tap_down }
|
228
|
+
}
|
229
|
+
|
230
|
+
end
|
231
|
+
|
232
|
+
|
233
|
+
# == description
|
234
|
+
# Taps up the given objects at the same time (multitouch).
|
235
|
+
#
|
236
|
+
# == arguments
|
237
|
+
# objects
|
238
|
+
# Array
|
239
|
+
# description: Array of objects to tap up.
|
240
|
+
# example: [@app.Square( :name => 'topLeft' ), @app.Square( :name => 'topRight' )]
|
241
|
+
#
|
242
|
+
# == returns
|
243
|
+
# NilClass
|
244
|
+
# description: -
|
245
|
+
# example: -
|
246
|
+
#
|
247
|
+
# == exceptions
|
248
|
+
# ArgumentError
|
249
|
+
# description: objects is not an array
|
250
|
+
#
|
251
|
+
def tap_up_objects(objects)
|
252
|
+
|
253
|
+
raise ArgumentError.new("Nothing to tap") unless objects.kind_of?(Array)
|
254
|
+
|
255
|
+
multitouch_operation{
|
256
|
+
objects.each { |o| o.tap_up }
|
257
|
+
}
|
258
|
+
|
259
|
+
end
|
260
|
+
|
261
|
+
# == description
|
262
|
+
# Performs the given operations at the same time (when possible).
|
263
|
+
# Note that only ui behaviours can be used here (e.g. taps, gestures).
|
264
|
+
#
|
265
|
+
# == arguments
|
266
|
+
# &block
|
267
|
+
# Proc
|
268
|
+
# description: code block containing the operations to perform.
|
269
|
+
# example: {@app.ScribbleArea.tap_object(400,50)
|
270
|
+
# @app.ScribbleArea.gesture(:Right, 1, 50)}
|
271
|
+
# == returns
|
272
|
+
# NilClass
|
273
|
+
# description: -
|
274
|
+
# example: -
|
275
|
+
#
|
276
|
+
#
|
277
|
+
def multi_touch(&block)
|
278
|
+
|
279
|
+
multitouch_operation(&block)
|
280
|
+
|
281
|
+
end
|
282
|
+
|
283
|
+
private
|
284
|
+
|
285
|
+
def multitouch_operation(&block)
|
286
|
+
|
287
|
+
#make sure the situation is ok before freeze
|
288
|
+
self.force_refresh
|
289
|
+
|
290
|
+
@sut.freeze
|
291
|
+
|
292
|
+
#disable sleep to avoid unnecessary sleeping
|
293
|
+
MobyUtil::Parameter[ @sut.id ][ :sleep_disabled] = 'true'
|
294
|
+
|
295
|
+
command = MobyCommand::Group.new(0, self, block )
|
296
|
+
command.set_multitouch(true)
|
297
|
+
ret = @sut.execute_command( command )
|
298
|
+
|
299
|
+
MobyUtil::Parameter[ @sut.id ][ :sleep_disabled] = 'false'
|
300
|
+
|
301
|
+
#sleep the biggest stored value
|
302
|
+
sleep MobyUtil::Parameter[ @sut.id ][ :skipped_sleep_time, 0 ] if MobyUtil::Parameter[ @sut.id ][ :skipped_sleep_time, 0 ] > 0
|
303
|
+
|
304
|
+
#reset to 0
|
305
|
+
MobyUtil::Parameter[ @sut.id ][ :skipped_sleep_time] = 0
|
306
|
+
|
307
|
+
@sut.unfreeze
|
308
|
+
|
309
|
+
end
|
310
|
+
|
311
|
+
# enable hooking for performance measurement & debug logging
|
312
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
313
|
+
|
314
|
+
end # Application
|
315
|
+
|
316
|
+
end # QT
|
317
|
+
|
318
|
+
end # MobyBehaviour
|