testability-driver 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,44 +51,84 @@ module MobyUtil
51
51
  mouse_status = 0
52
52
  previous_time = nil
53
53
  event = nil
54
+
55
+ # mouse_status:
56
+ # 0 = no press or release
57
+ # 1 = press, no release [ will only happen if recording stoped before mouse release]
58
+ # 2 = release, no press [ will only happen if recording started after mouse press]
59
+ # 3 = press and release
60
+
61
+ # COLLECT ALL MOUSE EVENTS
62
+ mouse_moves = []
63
+ mouse_press_events = []
64
+ mouse_release_events = []
65
+
66
+ begin
67
+ mouse_moves = xml_as_object.children(:type =>'event', :name=>'MouseMove')
68
+ rescue MobyBase::TestObjectNotFoundError
69
+ end
70
+
71
+ begin
72
+ mouse_press_events = xml_as_object.children(:type =>'event', :name=>'MouseButtonPress')
73
+ rescue MobyBase::TestObjectNotFoundError
74
+ end
75
+
76
+ begin
77
+ mouse_release_events = xml_as_object.children(:type =>'event', :name=>'MouseButtonRelease')
78
+ rescue MobyBase::TestObjectNotFoundError
79
+ end
80
+
81
+ # STORE MOVE POINTS
82
+ move_points = []
83
+ mouse_moves.each do |point|
84
+ timestamp = point.attribute('timeStamp').to_i
85
+ previous_timestamp = ( move_points[-1].nil? ) ? timestamp : move_points[-1]['timestamp'].to_i
86
+ interval = get_duration(previous_timestamp, timestamp)
87
+ move_points.push({'x' => point.attribute('windowX'), 'y' => point.attribute('windowY'), 'interval' => interval, 'timestamp' => timestamp, 'id' => point.id} )
88
+ end
89
+
90
+ # STORE RELEASE EVENTS
91
+ release_events = []
92
+ mouse_release_events.each do |event|
93
+ release_events.push({'id' => event.id})
94
+ end
54
95
 
55
- for i in 0...event_count
56
-
57
- event = event_list.event(:id => i.to_s)
58
- type = event.name
59
-
60
- previous_time = event.attribute('timeStamp').to_i unless previous_time
61
-
62
- if type == 'MouseButtonPress'
63
- active_target = get_target_details(event.child(:id => i.to_s))
64
- scripting = true
65
- mouse_status = 1
96
+ # FOREACH MouseButtonPress
97
+ mouse_press_events.each_index do |index|
98
+ active_target = get_target_details( mouse_press_events[index].child(:id => mouse_press_events[index].id) )
99
+
100
+ # COLLECT MouseMove points until MouseButtonRelease
101
+ # If no more MouseButtonRelease or MouseButtonPress then last MoveMouse point id
102
+ first_point_index = mouse_press_events[index].id.to_i
103
+ if ( !move_points.empty? )
104
+ next_mouse_press_index = ( mouse_press_events[ index + 1 ].nil? ) ? move_points.last['id'].to_i : mouse_press_events[ index + 1 ].id.to_i
105
+ next_mouse_release = release_events.select{ |event| event['id'].to_i < next_mouse_press_index }
106
+ next_mouse_release_index = next_mouse_release.first['id'].to_i unless next_mouse_release.empty?
107
+ last_point_index = ( next_mouse_release_index.nil? ) ? next_mouse_press_index : next_mouse_release_index
108
+ else
109
+ if ( !release_events.empty? )
110
+ next_mouse_press_index = ( mouse_press_events[ index + 1 ].nil? ) ? 0 : mouse_press_events[ index + 1 ].id.to_i
111
+ next_mouse_release = ( next_mouse_press_index == 0 ) ? [ release_events.last ] : release_events.select{ |event| event['id'].to_i < next_mouse_press_index }
112
+ last_point_index = next_mouse_release.first['id'].to_i unless ( next_mouse_release.nil? or next_mouse_release.empty? )
113
+ else
114
+ last_point_index = 0
115
+ end
66
116
  end
67
-
68
- duration = get_duration(previous_time, event.attribute('timeStamp').to_i)
69
-
70
- point = {'x' => event.attribute('windowX'), 'y' => event.attribute('windowY'), 'interval' => duration}
71
- points.push(point) if scripting
72
-
73
- previous_time = event.attribute('timeStamp').to_i
74
-
75
- if type == 'MouseButtonRelease' and scripting
76
-
77
- #mouse status based on the previous (if target changed no press)
78
- mouse_status = 3 if mouse_status == 1
79
- mouse_status = 2 if mouse_status == 0
80
- script << generate_command(active_target, points, mouse_status) << "\n"
81
- points.clear
82
- active_target = nil
83
- scripting = false
84
-
117
+
118
+
119
+ points = move_points.select{ |point| point['id'].to_i > first_point_index and point['id'].to_i <= last_point_index }
120
+ points.first['interval'] = 0.to_f unless points.empty? # set first interval to 0
121
+
122
+ # PROCESS gesture at MouseButtonRelease unless we hit last point and there is no release
123
+ last_processed_event_id = ( move_points.empty? ) ? 0 : move_points.last['id'].to_i
124
+ if ( last_point_index != last_processed_event_id )
125
+ script << generate_command(active_target, points, mouse_status = 3 ) << "\n"
126
+
127
+ # END EVENTS, MouseButtonRelease truncated or second press without release witch would not make sense
128
+ else
129
+ script << generate_command(active_target, points, mouse_status = 1 ) << "\n"
85
130
  end
86
- end
87
-
88
- if scripting and event
89
-
90
- script << generate_command(active_target, points, mouse_status) << "\n"
91
-
131
+
92
132
  end
93
133
 
94
134
  script << "\n"
@@ -151,11 +191,7 @@ module MobyUtil
151
191
  target
152
192
  end
153
193
 
154
- # mouse_status:
155
- # 0 = no press or release
156
- # 1 = press, no release
157
- # 2 = release, no press
158
- # 3 = press and release
194
+
159
195
  def generate_command(target_details, points, mouse_status)
160
196
 
161
197
  command = "@app."
@@ -18,4 +18,4 @@
18
18
  ############################################################################
19
19
 
20
20
 
21
- ENV['TDRIVER_VERSION'] = '1.1.0'
21
+ ENV['TDRIVER_VERSION'] = '1.1.1'
@@ -150,14 +150,19 @@
150
150
 
151
151
  <!-- default parameters for reporting settings -->
152
152
  <template name="reporting" inherits="error_recovery">
153
-
153
+ <!-- parameter for reporter modules enable disable enabled by default -->
154
+ <parameter name="enable_reporter" value="true" />
155
+ <parameter name="report_short_folders" value="false" />
156
+
154
157
  <!-- Parameters for report crash file monitoring -->
155
158
  <parameter name="report_crash_file_monitor" value="false" />
159
+ <parameter name="report_crash_file_monitor_crash_file_cleanup" value="false" />
156
160
  <parameter name="report_crash_file_monitored_sut_ids" value="s60,qt_sut" />
157
161
  <parameter name="report_crash_file_locations" value="C:,c:\data,E:,F:" /> <!-- posix="..." -->
158
162
  <parameter name="report_crash_file_names" value="MobileCrash" />
159
163
  <parameter name="report_disconnect_connected_devices" value="false" />
160
164
 
165
+
161
166
  <!-- Parameters for report details -->
162
167
  <parameter name="report_outputter_path" value="tdriver_reports/" />
163
168
  <parameter name="behaviour_logging" value="true" />
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testability-driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Testability Driver team
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin/
10
10
  cert_chain: []
11
11
 
12
- date: 2011-03-11 00:00:00 +02:00
12
+ date: 2011-04-12 00:00:00 +03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency