testability-driver-qt-sut-plugin 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/installer/extconf.rb +1 -1
  2. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/action.rb +4 -4
  3. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb +5 -2
  4. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/attribute.rb +130 -91
  5. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb +3 -3
  6. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb +5 -0
  7. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/file_transfer.rb +40 -26
  8. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb +1 -1
  9. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fps.rb +88 -71
  10. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/gesture.rb +10 -10
  11. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb +5 -5
  12. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/key_press.rb +3 -3
  13. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/method.rb +2 -2
  14. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/multitouch.rb +2 -2
  15. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/os.rb +4 -4
  16. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/qt_api_method.rb +5 -5
  17. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/record.rb +3 -3
  18. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/screen_capture.rb +11 -11
  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 +12 -12
  21. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb +7 -7
  22. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/treewidgetitemcolumn.rb +1 -1
  23. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/type_text.rb +1 -1
  24. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/view_item.rb +1 -1
  25. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/webkit.rb +126 -126
  26. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/widget.rb +49 -29
  27. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/group.rb +17 -21
  28. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb +4 -3
  29. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb +59 -86
  30. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/application.rb +19 -17
  31. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/group.rb +13 -10
  32. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/widget.rb +38 -25
  33. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/plugin.rb +6 -7
  34. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/fixture_parameter.rb +1 -1
  35. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/widget.rb +1 -4
  36. data/xml/template/qt.xml +1 -0
  37. metadata +28 -9
@@ -91,10 +91,12 @@ module MobyBehaviour
91
91
 
92
92
  execute_behavior(move_params, command)
93
93
 
94
- rescue Exception => e
94
+ rescue Exception
95
95
 
96
96
  $logger.behaviour "FAIL;Failed to mouse_move"
97
- Kernel::raise e
97
+
98
+ raise
99
+
98
100
  end
99
101
 
100
102
  $logger.behaviour "PASS;Operation mouse_move executed successfully"
@@ -216,7 +218,7 @@ module MobyBehaviour
216
218
  #params['obj_x'] = (center_x.to_i - 1).to_s
217
219
  #params['obj_y'] = (center_y.to_i - 1).to_s
218
220
  params['x'] = (center_x.to_i - 1).to_s
219
- params['y'] = (center_y.to_i - 1).to_s
221
+ params['y'] = (center_y.to_i - 5).to_s #make sure we do not tap between two line links
220
222
  params['useCoordinates'] = 'true'
221
223
  end
222
224
 
@@ -247,10 +249,10 @@ module MobyBehaviour
247
249
  )
248
250
  )
249
251
  #puts "web element scroll"
250
- self.scroll(0,0,1) # enable tap centralization
252
+ scroll(0,0,1) # enable tap centralization
251
253
  #puts "web element force refresh in tap"
252
- self.force_refresh({:id => get_application_id})
253
- self.tap(tap_params, interval, button)
254
+ force_refresh({:id => get_application_id})
255
+ tap(tap_params, interval, button)
254
256
  return
255
257
  end
256
258
  end
@@ -266,10 +268,11 @@ module MobyBehaviour
266
268
  sleep interval * tap_count
267
269
  end
268
270
 
269
- rescue Exception => e
271
+ rescue Exception
270
272
 
271
273
  $logger.behaviour "FAIL;Failed tap with tap_count \"#{tap_count}\", button \"#{button.to_s}\".;#{identity};tap;"
272
- Kernel::raise e
274
+
275
+ raise
273
276
 
274
277
  end
275
278
 
@@ -364,10 +367,11 @@ module MobyBehaviour
364
367
 
365
368
  execute_behavior(tap_params, command)
366
369
 
367
- rescue # Exception => e
370
+ rescue Exception
368
371
 
369
372
  $logger.behaviour "FAIL;Failed #{behavior_name} with x \"#{x}\", y \"#{y}\", button \"#{button.to_s}\".;#{identity};#{behavior_name};"
370
- Kernel::raise $!
373
+
374
+ raise
371
375
 
372
376
  end
373
377
 
@@ -490,7 +494,7 @@ module MobyBehaviour
490
494
  ens = param_set_configured?(tap_params, :ensure_event)
491
495
  tap_params[:ensure_event] = false
492
496
  if ens
493
- self.ensure_event(:retry_timeout => 5, :retry_interval => 0.5) {
497
+ ensure_event(:retry_timeout => 5, :retry_interval => 0.5) {
494
498
  tap_down(button, false, tap_params)
495
499
  sleep time
496
500
  tap_up(button, false, tap_params)
@@ -502,10 +506,13 @@ module MobyBehaviour
502
506
  end
503
507
 
504
508
 
505
- rescue Exception => e
509
+ rescue Exception
510
+
506
511
  $logger.enabled = logging_enabled
512
+
507
513
  $logger.behaviour "FAIL;Failed long_tap with time \"#{time.to_s}\", button \"#{button.to_s}\".;#{identity};long_tap;"
508
- Kernel::raise e
514
+
515
+ raise
509
516
 
510
517
  end
511
518
  $logger.enabled = logging_enabled
@@ -556,13 +563,16 @@ module MobyBehaviour
556
563
  def long_tap_object( x, y, time = 1, button = :Left, tap_params = {} )
557
564
 
558
565
  begin
566
+
559
567
  tap_down_object(x, y, button, tap_params)
560
568
  sleep time
561
569
  tap_up_object(x, y, button, tap_params)
562
- rescue Exception => e
570
+
571
+ rescue Exception
563
572
 
564
573
  $logger.behaviour "FAIL;Failed long_tap_object with time \"#{time.to_s}\", button \"#{button.to_s}\".;#{identity};long_tap_object;"
565
- Kernel::raise e
574
+
575
+ raise
566
576
 
567
577
  end
568
578
 
@@ -628,12 +638,13 @@ module MobyBehaviour
628
638
  command.command_params(params)
629
639
  execute_behavior(tap_params, command)
630
640
 
631
- self.force_refresh( :id => get_application_id ) if refresh
641
+ force_refresh( :id => get_application_id ) if refresh
632
642
 
633
- rescue Exception => e
643
+ rescue Exception
634
644
 
635
645
  $logger.behaviour "FAIL;Failed tap_down with button \"#{button.to_s}\", refresh \"#{refresh.to_s}\".;#{identity};tap_down;"
636
- Kernel::raise e
646
+
647
+ raise
637
648
 
638
649
  end
639
650
 
@@ -696,12 +707,13 @@ module MobyBehaviour
696
707
  command.command_params(params)
697
708
 
698
709
  execute_behavior(tap_params, command)
699
- self.force_refresh({:id => get_application_id}) if refresh
710
+ force_refresh({:id => get_application_id}) if refresh
700
711
 
701
- rescue Exception => e
712
+ rescue Exception
702
713
 
703
714
  $logger.behaviour "FAIL;Failed tap_up with button \"#{button.to_s}\", refresh \"#{refresh.to_s}\".;#{identity};tap_up;"
704
- Kernel::raise e
715
+
716
+ raise
705
717
 
706
718
  end
707
719
 
@@ -741,10 +753,11 @@ module MobyBehaviour
741
753
 
742
754
  @sut.execute_command(command)
743
755
 
744
- rescue Exception => e
756
+ rescue Exception
745
757
 
746
758
  $logger.behaviour "FAIL;Failed press with tap_count \"#{tap_count}\", button \"#{button.to_s}\".;#{identity};press;"
747
- Kernel::raise e
759
+
760
+ raise
748
761
 
749
762
  end
750
763
 
@@ -764,10 +777,15 @@ module MobyBehaviour
764
777
  $stderr.puts "#{ caller(0).last.to_s } warning: TestObject#long_press is deprecated; use TestObject#long_tap"
765
778
 
766
779
  begin
780
+
767
781
  long_tap(time, button)
768
- rescue Exception => e
782
+
783
+ rescue Exception
784
+
769
785
  $logger.behaviour "FAIL;Failed long_press with time \"#{time.to_s}\", button \"#{button.to_s}\".;#{identity};long_press;"
770
- Kernel::raise e
786
+
787
+ raise
788
+
771
789
  end
772
790
 
773
791
  $logger.behaviour "PASS;Operation long_press executed successfully with time \"#{time.to_s}\", button \"#{button.to_s}\".;#{identity};long_press;"
@@ -789,10 +807,11 @@ module MobyBehaviour
789
807
 
790
808
  tap_down(button, refresh)
791
809
 
792
- rescue Exception => e
810
+ rescue Exception
793
811
 
794
812
  $logger.behaviour "FAIL;Failed hold with button \"#{button.to_s}\", refresh \"#{refresh.to_s}\".;#{identity};hold;"
795
- Kernel::raise e
813
+
814
+ raise
796
815
 
797
816
  end
798
817
 
@@ -815,10 +834,11 @@ module MobyBehaviour
815
834
 
816
835
  tap_up(button, refresh)
817
836
 
818
- rescue Exception => e
837
+ rescue Exception
819
838
 
820
839
  $logger.behaviour "FAIL;Failed release with button \"#{button.to_s}\", refresh \"#{refresh.to_s}\".;#{identity};release;"
821
- Kernel::raise e
840
+
841
+ raise
822
842
 
823
843
  end
824
844
 
@@ -17,32 +17,28 @@
17
17
  ##
18
18
  ############################################################################
19
19
 
20
-
21
-
22
- #require File.expand_path( File.join( File.dirname( __FILE__ ), 'command_data' ) )
23
-
24
20
  module MobyCommand
25
21
 
26
22
  class Group < MobyCommand::CommandData
27
23
 
28
- attr_reader :interval, :application, :block, :multitouch
24
+ attr_reader :interval, :application, :block, :multitouch
29
25
 
30
- # Constructor to Group
31
- # == params
32
- # interval: interval between commands
33
- # application: target application
34
- # block: block of commands to group
35
- def initialize( interval, application, block )
36
- @interval = interval
37
- @application = application
38
- @block = block
39
- @multitouch = false
40
- end
26
+ # Constructor to Group
27
+ # == params
28
+ # interval: interval between commands
29
+ # application: target application
30
+ # block: block of commands to group
31
+ def initialize( interval, application, block )
32
+ @interval = interval
33
+ @application = application
34
+ @block = block
35
+ @multitouch = false
36
+ end
41
37
 
42
- def set_multitouch(multitouch = true)
43
- @multitouch = multitouch
44
- end
38
+ def set_multitouch(multitouch = true)
39
+ @multitouch = multitouch
40
+ end
45
41
 
46
- end
42
+ end # Group
47
43
 
48
- end #module
44
+ end # MobyCommand
@@ -47,9 +47,10 @@ module MobyCommand
47
47
  @@_valid_directions = [nil, :Up, :Down, :Left,:Right]
48
48
  @@_valid_orientations = [nil,:Vertical, :Horizontal]
49
49
 
50
- self.command(command_type)
51
- self.id(btn_id)
52
- self
50
+ command(command_type)
51
+ id(btn_id)
52
+
53
+ self
53
54
 
54
55
  end
55
56
 
@@ -17,12 +17,13 @@
17
17
  ##
18
18
  ############################################################################
19
19
 
20
-
21
-
22
20
  module MobyCommand
23
21
 
24
22
  class WidgetCommand < MobyCommand::CommandData
25
23
 
24
+ # class variable
25
+ VALID_OBJECT_TYPES = [ nil, :Standard, :Graphics, :Application, :Action, :Web ] unless defined?( VALID_OBJECT_TYPES )
26
+
26
27
  # Constructs a new CommandParams object. CommandParams stores the details for the commands send
27
28
  # to suts that operate using the tasCommand xml format. The controller creates an xml formatted
28
29
  # operation request that will be forwarded to the sut being tested.
@@ -37,65 +38,67 @@ module MobyCommand
37
38
  # CommandParams:: New CommandParams object
38
39
  # == raises
39
40
  # ArgumentError:: When the supplied params are invalid type (initially can be nil)
40
- def initialize(application_id = nil, object_id = nil, object_type = nil, command_name = nil, params = nil, value=nil, service = nil)
41
+ def initialize( application_id = nil, object_id = nil, object_type = nil, command_name = nil, params = nil, value=nil, service = nil )
42
+
43
+ application_id(application_id )
44
+
45
+ set_object_id( object_id )
46
+
47
+ object_type( object_type )
48
+
49
+ command_name( command_name )
41
50
 
42
- @@_valid_types = [ nil, :Standard, :Graphics, :Application, :Action, :Web ]
51
+ command_params( params )
43
52
 
44
- self.application_id(application_id )
45
- self.set_object_id( object_id )
46
- self.object_type( object_type )
47
- self.command_name( command_name )
48
- self.command_params( params )
49
- self.command_value( value )
50
- self.service( service )
53
+ command_value( value )
54
+
55
+ service( service )
51
56
 
52
- @_transitions = true
57
+ transitions_on
53
58
 
54
- return self
59
+ self
55
60
 
56
61
  end
57
62
 
58
- def service(service)
63
+ def service( service )
64
+
59
65
  @_service = service
60
- end
61
66
 
62
- def get_service
63
- @_service
64
67
  end
65
68
 
66
69
  # Set transition flag on
67
70
  # Will cause the events to be
68
71
  # done on a delayed mode.
69
72
  def transitions_on
73
+
70
74
  @_transitions = true
75
+
71
76
  end
72
77
 
73
78
  # Set transition flag off
74
79
  # Will cause the events to be
75
80
  # done on immediately
76
81
  def transitions_off
82
+
77
83
  @_transitions = false
78
- end
79
84
 
80
- # Return the transition value
81
- # ==returns
82
- # bool: true of false
83
- def get_transitions
84
- @_transitions
85
85
  end
86
86
 
87
-
88
87
  # Set true if response is expected from device side after command
89
88
  # Has been completed.
90
89
  # ==params
91
90
  # bool: True if response needed
92
- def set_require_response(response_required)
91
+ def set_require_response( response_required )
92
+
93
93
  @_response_required = response_required
94
+
94
95
  end
95
96
 
96
97
  # Returns true if response required after command.
97
98
  def require_response?
99
+
98
100
  @_response_required
101
+
99
102
  end
100
103
 
101
104
  # Application id of the currently tested application
@@ -104,17 +107,12 @@ module MobyCommand
104
107
  # == returns
105
108
  # == raises
106
109
  # ArgumentError:: When the supplied id is not of type String
107
- def application_id(id)
108
- raise ArgumentError.new( "Application id must be a string." ) unless id == nil or id.kind_of?( String )
110
+ def application_id( id )
111
+
112
+ id.check_type [ NilClass, String ], 'wrong argument type $1 for application id (expected $2)'
113
+
109
114
  @_application_id = id
110
- end
111
115
 
112
- # Return application id
113
- # == params
114
- # == returns
115
- # String:: Application id of the command
116
- def get_application_id
117
- @_application_id
118
116
  end
119
117
 
120
118
  # Object id of the target object
@@ -123,17 +121,12 @@ module MobyCommand
123
121
  # == returns
124
122
  # == raises
125
123
  # ArgumentError:: When the supplied id is not of type String
126
- def set_object_id(id)
127
- raise ArgumentError.new( "Object id must be a string." ) unless id == nil or id.kind_of?( String )
124
+ def set_object_id( id )
125
+
126
+ id.check_type [ NilClass, String ], 'wrong argument type $1 for object id (expected $2)'
127
+
128
128
  @_object_id = id
129
- end
130
129
 
131
- # Return object id
132
- # == params
133
- # == returns
134
- # String:: Object id of the command
135
- def get_object_id
136
- @_object_id
137
130
  end
138
131
 
139
132
  # Object type of the target object
@@ -142,18 +135,13 @@ module MobyCommand
142
135
  # == returns
143
136
  # == raises
144
137
  # ArgumentError:: When the supplied type is not :Graphics or :Standard
145
- def object_type(type)
146
- raise ArgumentError.new("Given object type '#{type.to_s}' is not valid.") unless @@_valid_types.include?(type)
138
+ def object_type( type )
139
+
140
+ raise TypeError.new("Given object type #{ type.inspect } is not valid.") unless VALID_OBJECT_TYPES.include?( type )
141
+
147
142
  @_object_type = type
148
- end
149
143
 
150
- # Return object type
151
- # == params
152
- # == returns
153
- # String:: Object type of the command
154
- def get_object_type
155
- @_object_type
156
- end
144
+ end
157
145
 
158
146
  # Name of the command
159
147
  # == params
@@ -161,17 +149,12 @@ module MobyCommand
161
149
  # == returns
162
150
  # == raises
163
151
  # ArgumentError:: When the supplied command_name is not of type String
164
- def command_name(name)
165
- raise ArgumentError.new( "Command name must be a String." ) unless name == nil or name.kind_of?( String )
152
+ def command_name( name )
153
+
154
+ name.check_type [ NilClass, String ], 'wrong argument type $1 for command name (expected $2)'
155
+
166
156
  @_command_name = name
167
- end
168
157
 
169
- # Return name of the command
170
- # == params
171
- # == returns
172
- # String:: Name of the command
173
- def get_command_name
174
- @_command_name
175
158
  end
176
159
 
177
160
  # Command parameters
@@ -180,17 +163,12 @@ module MobyCommand
180
163
  # == returns
181
164
  # == raises
182
165
  # ArgumentError:: When the supplied params is of type Hash
183
- def command_params(params)
184
- raise ArgumentError.new( "The given params must be in a hash (name => value)." ) unless params == nil or params.kind_of?( Hash )
166
+ def command_params( params )
167
+
168
+ params.check_type [ NilClass, Hash ], 'wrong argument type $1 for command parameters (expected $2)'
169
+
185
170
  @_command_params = params
186
- end
187
171
 
188
- # Return params of the command
189
- # == params
190
- # == returns
191
- # Hash:: Command parameter hash
192
- def get_command_params
193
- @_command_params
194
172
  end
195
173
 
196
174
  # Command value which is passed on to the device as the value of the command.
@@ -201,26 +179,21 @@ module MobyCommand
201
179
  # == returns
202
180
  # == raises
203
181
  # ArgumentError:: When the supplied params not of type String or Array or nil
204
- def command_value(value)
205
- raise ArgumentError.new( "Command value must be a string." ) unless value == nil or value.kind_of?( String ) or value.kind_of? Array
182
+ def command_value( value )
183
+
184
+ value.check_type [ NilClass, String, Array ], 'wrong argument type $1 for command value (expected $2)'
185
+
206
186
  @_command_value = value
207
- end
208
187
 
209
- # Return command value
210
- # == params
211
- # == returns
212
- # tring or Array:: Command value
213
- def get_command_value
214
- @_command_value
215
188
  end
216
189
 
217
- def set_event_type(event_type)
190
+ def set_event_type( event_type )
191
+
192
+ #event_type.check_type [ NilClass, String ], 'wrong argument type $1 for event type (expected $2)'
193
+
218
194
  @_event_type = event_type
195
+
219
196
  end
220
-
221
- def get_event_type
222
- Kernel::raise "Assert: event_type must be set!" unless @_event_type
223
- @_event_type
224
- end
197
+
225
198
  end
226
199
  end