ruboto 0.8.0 → 0.8.1

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 (57) hide show
  1. data/Rakefile +35 -11
  2. data/assets/rakelib/ruboto.rake +2 -0
  3. data/assets/samples/sample_activity.rb +1 -0
  4. data/assets/samples/sample_class.rb +2 -0
  5. data/assets/samples/sample_class_test.rb +1 -0
  6. data/assets/src/InheritingActivity.java +1 -1
  7. data/assets/src/InheritingBroadcastReceiver.java +2 -1
  8. data/assets/src/InheritingClass.java +15 -7
  9. data/assets/src/InheritingService.java +1 -2
  10. data/assets/src/RubotoActivity.java +20 -110
  11. data/assets/src/RubotoBroadcastReceiver.java +16 -62
  12. data/assets/src/RubotoService.java +13 -89
  13. data/assets/src/org/ruboto/EntryPointActivity.java +1 -1
  14. data/assets/src/org/ruboto/JRubyAdapter.java +23 -23
  15. data/assets/src/org/ruboto/RubotoComponent.java +8 -0
  16. data/assets/src/org/ruboto/Script.java +10 -5
  17. data/assets/src/org/ruboto/ScriptInfo.java +53 -0
  18. data/assets/src/org/ruboto/ScriptLoader.java +143 -0
  19. data/assets/src/org/ruboto/test/ActivityTest.java +15 -8
  20. data/assets/src/org/ruboto/test/InstrumentationTestRunner.java +11 -6
  21. data/assets/src/ruboto/activity.rb +43 -17
  22. data/assets/src/ruboto/base.rb +7 -1
  23. data/assets/src/ruboto/generate.rb +6 -2
  24. data/assets/src/ruboto/legacy.rb +1 -1
  25. data/assets/src/ruboto/menu.rb +4 -4
  26. data/assets/src/ruboto/widget.rb +4 -11
  27. data/lib/ruboto/commands/base.rb +21 -7
  28. data/lib/ruboto/util/build.rb +6 -3
  29. data/lib/ruboto/util/code_formatting.rb +2 -2
  30. data/lib/ruboto/util/update.rb +58 -58
  31. data/lib/ruboto/util/xml_element.rb +14 -11
  32. data/lib/ruboto/version.rb +2 -1
  33. data/test/activity/generate_activity.rb +35 -0
  34. data/test/activity/generate_activity_test.rb +17 -0
  35. data/test/activity/image_button_activity.rb +1 -0
  36. data/test/activity/image_button_and_button_activity.rb +1 -0
  37. data/test/activity/margins_activity.rb +1 -0
  38. data/test/activity/navigation_activity.rb +20 -5
  39. data/test/activity/navigation_activity_test.rb +43 -4
  40. data/test/activity/option_menu_activity.rb +1 -0
  41. data/test/activity/psych_activity.rb +2 -1
  42. data/test/activity/stack_activity.rb +1 -0
  43. data/test/activity/stack_activity_test.rb +11 -5
  44. data/test/block_def_activity/margins_activity.rb +2 -1
  45. data/test/block_def_activity/psych_activity.rb +1 -1
  46. data/test/block_def_activity/stack_activity_test.rb +1 -1
  47. data/test/handle_activity/psych_activity.rb +1 -1
  48. data/test/handle_activity/stack_activity_test.rb +17 -9
  49. data/test/minimal_app_test.rb +2 -2
  50. data/test/rake_test.rb +1 -1
  51. data/test/ruboto_gen_test.rb +162 -34
  52. data/test/service_test.rb +1 -2
  53. data/test/sqldroid_test.rb +87 -0
  54. data/test/test_helper.rb +19 -12
  55. data/test/update_test_methods.rb +29 -44
  56. data/test/view_constants_test.rb +1 -2
  57. metadata +12 -4
@@ -63,7 +63,7 @@ module Ruboto
63
63
 
64
64
  def all_methods(method_base="all", method_include="", method_exclude="", implements="")
65
65
  # get all the methogs
66
- all_methods = get_elements("method")
66
+ all_methods = get_elements('method').select{|m| m.attribute('static') != 'true'}
67
67
 
68
68
  # establish the base set of methods
69
69
  working_methods = case method_base.to_s
@@ -147,7 +147,7 @@ module Ruboto
147
147
 
148
148
  def super_return
149
149
  rv = super_string
150
- return rv unless attribute("return")
150
+ return "{#{rv} return;}" unless attribute("return")
151
151
  rv ? "return #{rv}" : default_return
152
152
  end
153
153
 
@@ -172,7 +172,7 @@ module Ruboto
172
172
  return_class = attribute("return").capitalize
173
173
  end
174
174
  return_cast = "return (#{return_class.gsub("&lt;", "<").gsub("&gt;", ">")}) " if return_class
175
- convert_return = "#{return_class}.class, "
175
+ convert_return = "#{return_class.sub(/<.*>$/, '')}.class, "
176
176
  end
177
177
 
178
178
  if on_ruby_instance
@@ -183,17 +183,17 @@ module Ruboto
183
183
  "JRubyAdapter.isJRubyPreOneSeven()",
184
184
  params.map{|i| "JRubyAdapter.put(\"$arg_#{i[0]}\", #{i[0]});"} +
185
185
  [
186
- 'JRubyAdapter.put("$ruby_instance", rubyInstance);',
186
+ 'JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());',
187
187
  "#{return_cast}#{'((Number)' if return_int}JRubyAdapter.runScriptlet(\"$ruby_instance.#{method_name}(#{global_args})\")#{').intValue()' if return_int};",
188
188
  ],
189
189
  if_else(
190
190
  "JRubyAdapter.isJRubyOneSeven()",
191
- ["#{return_cast}JRubyAdapter.runRubyMethod(#{convert_return}rubyInstance, \"#{method_name}\"#{args});"],
191
+ ["#{return_cast}JRubyAdapter.runRubyMethod(#{convert_return}scriptInfo.getRubyInstance(), \"#{method_name}\"#{args});"],
192
192
  ['throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));']
193
193
  )
194
194
  )
195
195
  else
196
- ["#{return_cast}JRubyAdapter.runRubyMethod(#{convert_return}callbackProcs[#{constant_string}], \"call\" #{args});"]
196
+ ["#{return_cast}JRubyAdapter.runRubyMethod(#{convert_return}scriptInfo.getCallbackProcs()[#{constant_string}], \"call\" #{args});"]
197
197
  end
198
198
  end
199
199
 
@@ -205,20 +205,22 @@ module Ruboto
205
205
  method_call(
206
206
  (attribute("return") ? attribute("return") : "void"),
207
207
  attribute("name"), parameters,
208
+ get_elements('exception').map{|m| m.attribute('type')},
209
+ ["if (ScriptLoader.isCalledFromJRuby()) #{super_return}",
208
210
  if_else(
209
211
  "JRubyAdapter.isInitialized()",
210
212
  if_else(
211
- "callbackProcs != null && callbackProcs[#{constant_string}] != null",
213
+ "scriptInfo.getCallbackProcs() != null && scriptInfo.getCallbackProcs()[#{constant_string}] != null",
212
214
  [super_string] + ruby_call,
213
- ['String rubyClassName = Script.toCamelCase(scriptName);'] +
215
+ ['String rubyClassName = scriptInfo.getRubyClassName();'] +
214
216
  if_else(
215
217
  # TODO(uwe): Remove defined?(rubyClassName) if we remove non-class-based class definitions
216
218
  "(Boolean)JRubyAdapter.runScriptlet(\"defined?(\" + rubyClassName + \") == 'constant' && \" + rubyClassName + \".instance_methods(false).any?{|m| m.to_sym == :#{snake_case_attribute}}\")",
217
- [super_string] + ruby_call(true),
219
+ ruby_call(true),
218
220
  if_else(
219
221
  # TODO(uwe): Remove defined?(rubyClassName) if we remove non-class-based class definitions
220
222
  "(Boolean)JRubyAdapter.runScriptlet(\"defined?(\" + rubyClassName + \") == 'constant' && \" + rubyClassName + \".instance_methods(false).any?{|m| m.to_sym == :#{attribute('name')}}\")",
221
- [super_string] + ruby_call(true, true),
223
+ ruby_call(true, true),
222
224
  [super_return]
223
225
  )
224
226
  )
@@ -228,11 +230,12 @@ module Ruboto
228
230
  super_return,
229
231
  ]
230
232
  )
233
+ ]
231
234
  ).indent.join("\n")
232
235
  end
233
236
 
234
237
  def constructor_definition(class_name)
235
- method_call(nil, class_name, parameters, [super_string]).indent.join("\n")
238
+ method_call(nil, class_name, parameters, nil, [super_string]).indent.join("\n")
236
239
  end
237
240
  end
238
241
  end
@@ -1,3 +1,4 @@
1
1
  module Ruboto
2
- VERSION = '0.8.0'
2
+ VERSION = '0.8.1'
3
+ UPDATE_VERSION_LIMIT = '0.5.2'
3
4
  end
@@ -0,0 +1,35 @@
1
+ require 'ruboto/activity'
2
+ require 'ruboto/widget'
3
+ require 'ruboto/generate'
4
+
5
+ ruboto_import_widgets :LinearLayout, :ListView, :TextView
6
+
7
+ ruboto_generate("android.widget.ArrayAdapter" => $package_name + ".MyArrayAdapter")
8
+
9
+ class GenerateActivity
10
+ def on_create(bundle)
11
+ super
12
+ setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
13
+
14
+ adapter = MyArrayAdapter.new(self, android.R.layout.simple_list_item_1 , AndroidIds::text1, ['Record one', 'Record two'])
15
+ adapter.initialize_ruboto_callbacks do
16
+ def get_view(position, convert_view, parent)
17
+ puts "IN get_view!!!"
18
+ @inflater ||= context.getSystemService(Context::LAYOUT_INFLATER_SERVICE)
19
+ row = convert_view ? convert_view : @inflater.inflate(mResource, nil)
20
+ row.findViewById(mFieldId).text = get_item(position)
21
+ row
22
+ rescue Exception
23
+ puts "Exception getting list item view: #$!"
24
+ puts $!.backtrace.join("\n")
25
+ convert_view
26
+ end
27
+ end
28
+
29
+ self.content_view =
30
+ linear_layout :orientation => LinearLayout::VERTICAL do
31
+ @text_view_margins = text_view :text => 'What hath Matz wrought?', :id => 42
32
+ @list_view = list_view :adapter => adapter, :id => 43
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,17 @@
1
+ activity Java::org.ruboto.test_app.GenerateActivity
2
+
3
+ setup do |activity|
4
+ start = Time.now
5
+ loop do
6
+ @text_view = activity.findViewById(42)
7
+ @list_view = activity.findViewById(43)
8
+ break if (@text_view && @list_view) || (Time.now - start > 60)
9
+ sleep 1
10
+ end
11
+ assert @text_view
12
+ assert @list_view
13
+ end
14
+
15
+ test("activity starts") do |activity|
16
+ assert true
17
+ end
@@ -5,6 +5,7 @@ ruboto_import_widgets :ImageButton, :LinearLayout, :TextView
5
5
 
6
6
  class ImageButtonActivity
7
7
  def on_create(bundle)
8
+ super
8
9
  set_title File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
9
10
 
10
11
  click_handler = proc do |view|
@@ -5,6 +5,7 @@ ruboto_import_widgets :Button, :ImageButton, :LinearLayout, :TextView
5
5
 
6
6
  class ImageButtonAndButtonActivity
7
7
  def on_create(bundle)
8
+ super
8
9
  setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
9
10
 
10
11
  self.content_view =
@@ -5,6 +5,7 @@ ruboto_import_widgets :LinearLayout, :TextView
5
5
 
6
6
  class MarginsActivity
7
7
  def on_create(bundle)
8
+ super
8
9
  setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
9
10
 
10
11
  self.content_view =
@@ -3,8 +3,9 @@ require 'ruboto/widget'
3
3
 
4
4
  ruboto_import_widgets :Button, :LinearLayout, :TextView
5
5
 
6
- class NavigationActivity
6
+ class NavigationActivity < Java::OrgRuboto::EntryPointActivity
7
7
  def on_create(bundle)
8
+ super
8
9
  set_title File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
9
10
 
10
11
  self.content_view =
@@ -15,7 +16,8 @@ class NavigationActivity
15
16
  button :text => 'Next by Ruby class', :width => :match_parent, :id => 44, :on_click_listener => proc { start_next_ruby_activity }
16
17
  button :text => 'Next by script name', :width => :match_parent, :id => 45, :on_click_listener => proc { start_activity_by_script_name }
17
18
  button :text => 'Inline block', :width => :match_parent, :id => 46, :on_click_listener => proc { start_inline_activity }
18
- button :text => 'Infile class', :width => :match_parent, :id => 47, :on_click_listener => proc { start_infile_activity }
19
+ button :text => 'Inline block with options', :width => :match_parent, :id => 47, :on_click_listener => proc { start_inline_activity_with_options }
20
+ button :text => 'Infile class', :width => :match_parent, :id => 48, :on_click_listener => proc { start_infile_activity }
19
21
  end
20
22
  end
21
23
 
@@ -46,10 +48,24 @@ class NavigationActivity
46
48
  end
47
49
 
48
50
  def start_inline_activity
49
- start_ruboto_activity('$inline_activity') do
51
+ start_ruboto_activity do
50
52
  def on_create(bundle)
53
+ super
51
54
  set_title 'Inline Activity'
55
+ self.content_view =
56
+ linear_layout :orientation => :vertical, :gravity => :center_horizontal do
57
+ text_view :text => 'This is an inline activity.', :id => 42, :width => :match_parent,
58
+ :gravity => :center, :text_size => 48.0
59
+ end
60
+ end
61
+ end
62
+ end
52
63
 
64
+ def start_inline_activity_with_options
65
+ start_ruboto_activity(:class_name => 'InlineActivity') do
66
+ def on_create(bundle)
67
+ super
68
+ set_title 'Inline Activity'
53
69
  self.content_view =
54
70
  linear_layout :orientation => :vertical, :gravity => :center_horizontal do
55
71
  text_view :text => 'This is an inline activity.', :id => 42, :width => :match_parent,
@@ -71,9 +87,8 @@ class NavigationActivity
71
87
  end
72
88
 
73
89
  class InfileActivity
74
- include Ruboto::Activity
75
-
76
90
  def on_create(bundle)
91
+ super
77
92
  set_title 'Infile Activity'
78
93
 
79
94
  self.content_view =
@@ -60,10 +60,22 @@ end
60
60
 
61
61
  test('button starts inline activity', :ui => false) do |activity|
62
62
  assert_equal "What hath Matz wrought?", @text_view.text
63
- activity.run_on_ui_thread { activity.find_view_by_id(46).perform_click }
63
+ monitor = add_monitor('org.ruboto.RubotoActivity', nil, false)
64
+ begin
65
+ activity.run_on_ui_thread { activity.find_view_by_id(46).perform_click }
66
+ current_activity = wait_for_monitor_with_timeout(monitor, 5000)
67
+ assert current_activity
68
+ current_activity.run_on_ui_thread { current_activity.finish }
69
+ # FIXME(uwe): Replace sleep with proper monitor
70
+ sleep 3
71
+ ensure
72
+ puts "Removing monitor"
73
+ removeMonitor(monitor)
74
+ end
75
+
64
76
  start = Time.now
65
77
  loop do
66
- @text_view = activity.find_view_by_id(42)
78
+ @text_view = current_activity.find_view_by_id(42)
67
79
  break if (@text_view && @text_view.text == 'This is an inline activity.') || (Time.now - start > 10)
68
80
  puts 'wait for text'
69
81
  sleep 0.5
@@ -72,17 +84,44 @@ test('button starts inline activity', :ui => false) do |activity|
72
84
  assert_equal 'This is an inline activity.', @text_view.text
73
85
  end
74
86
 
75
- test('button starts infile class activity', :ui => false) do |activity|
87
+ test('button starts inline activity with options', :ui => false) do |activity|
76
88
  assert_equal "What hath Matz wrought?", @text_view.text
77
89
  monitor = add_monitor('org.ruboto.RubotoActivity', nil, false)
78
90
  begin
79
91
  activity.run_on_ui_thread { activity.find_view_by_id(47).perform_click }
80
92
  current_activity = wait_for_monitor_with_timeout(monitor, 5000)
93
+ assert current_activity
94
+ current_activity.run_on_ui_thread { current_activity.finish }
95
+ # FIXME(uwe): Replace sleep with proper monitor
96
+ sleep 3
97
+ ensure
98
+ puts "Removing monitor"
99
+ removeMonitor(monitor)
100
+ end
101
+
102
+ start = Time.now
103
+ loop do
104
+ @text_view = current_activity.find_view_by_id(42)
105
+ break if (@text_view && @text_view.text == 'This is an inline activity.') || (Time.now - start > 10)
106
+ puts 'wait for text'
107
+ sleep 0.5
108
+ end
109
+ assert @text_view
110
+ assert_equal 'This is an inline activity.', @text_view.text
111
+ end
112
+
113
+ test('button starts infile class activity', :ui => false) do |activity|
114
+ assert_equal "What hath Matz wrought?", @text_view.text
115
+ monitor = add_monitor('org.ruboto.RubotoActivity', nil, false)
116
+ begin
117
+ activity.run_on_ui_thread { activity.find_view_by_id(48).perform_click }
118
+ current_activity = wait_for_monitor_with_timeout(monitor, 5000)
81
119
  ensure
82
120
  removeMonitor(monitor)
83
121
  end
122
+ puts "new activity: #{current_activity.inspect}"
84
123
  assert current_activity
85
- puts "new activity: #{current_activity}"
124
+ assert current_activity.is_a? Java::OrgRuboto::RubotoActivity
86
125
  start = Time.now
87
126
  loop do
88
127
  @text_view = current_activity.find_view_by_id(42)
@@ -6,6 +6,7 @@ ruboto_import_widgets :LinearLayout, :TextView
6
6
 
7
7
  class OptionMenuActivity
8
8
  def on_create(bundle)
9
+ super
9
10
  set_title File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
10
11
 
11
12
  self.content_view =
@@ -6,7 +6,7 @@ if RUBY_VERSION < '1.9'
6
6
  $LOADED_FEATURES << 'psych.so'
7
7
  $LOAD_PATH << File.join(Config::CONFIG['libdir'], 'ruby/1.9')
8
8
  end
9
- # TODO end
9
+ # ODOT
10
10
 
11
11
  require 'ruboto/util/stack'
12
12
  with_large_stack { require 'psych.rb' }
@@ -20,6 +20,7 @@ ruboto_import_widgets :Button, :LinearLayout, :TextView
20
20
 
21
21
  class PsychActivity
22
22
  def on_create(bundle)
23
+ super
23
24
  set_title File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
24
25
  self.content_view =
25
26
  linear_layout :orientation => LinearLayout::VERTICAL, :gravity => android.view.Gravity::CENTER do
@@ -11,6 +11,7 @@ class StackActivity
11
11
  STACK_DEPTH_CLASS = java.lang.Thread.current_thread.stack_trace.length.to_s
12
12
  def on_create(bundle)
13
13
  stack_depth_on_create = java.lang.Thread.current_thread.stack_trace.length.to_s
14
+ super
14
15
  setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
15
16
 
16
17
  self.content_view =
@@ -10,8 +10,14 @@ setup do |activity|
10
10
  assert @text_view
11
11
  end
12
12
 
13
+ # ANDROID: 10, PLATFORM: 0.4.7, JRuby: 1.7.0.dev '28334966' expected, but got '28335067'
14
+
13
15
  test('stack depth') do |activity|
14
- os_offset = {13 => 1, 15 => 1, 16 => 1}[android.os.Build::VERSION::SDK_INT].to_i
16
+ os_offset = {
17
+ 13 => [1]*4,
18
+ 15 => [0, 0, 1, 1],
19
+ 16 => [1]*4,
20
+ }[android.os.Build::VERSION::SDK_INT] || [0, 0, 0, 0]
15
21
  if org.ruboto.JRubyAdapter.uses_platform_apk?
16
22
  jruby_offset = {
17
23
  '0.4.7' => [0, 0, 0, 0],
@@ -24,10 +30,10 @@ test('stack depth') do |activity|
24
30
  }[org.jruby.runtime.Constants::VERSION] || [0, 0, 0, 0]
25
31
  end
26
32
  version_message ="ANDROID: #{android.os.Build::VERSION::SDK_INT}, PLATFORM: #{org.ruboto.JRubyAdapter.uses_platform_apk ? org.ruboto.JRubyAdapter.platform_version_name : 'STANDALONE'}, JRuby: #{org.jruby.runtime.Constants::VERSION}"
27
- assert_equal [43 + os_offset + jruby_offset[0],
28
- 48 + os_offset + jruby_offset[1],
29
- 49 + os_offset + jruby_offset[2],
30
- 66 + os_offset + jruby_offset[3]], [activity.find_view_by_id(42).text.to_i,
33
+ assert_equal [28 + os_offset[0] + jruby_offset[0],
34
+ 33 + os_offset[1] + jruby_offset[1],
35
+ 50 + os_offset[2] + jruby_offset[2],
36
+ 67 + os_offset[3] + jruby_offset[3]], [activity.find_view_by_id(42).text.to_i,
31
37
  activity.find_view_by_id(43).text.to_i,
32
38
  activity.find_view_by_id(44).text.to_i,
33
39
  activity.find_view_by_id(45).text.to_i], version_message
@@ -1,4 +1,5 @@
1
- require 'ruboto'
1
+ require 'ruboto/activity'
2
+ require 'ruboto/widget'
2
3
 
3
4
  ruboto_import_widgets :LinearLayout, :TextView
4
5
 
@@ -6,7 +6,7 @@ if RUBY_VERSION < '1.9'
6
6
  $LOADED_FEATURES << 'psych.so'
7
7
  $LOAD_PATH << File.join(Config::CONFIG['libdir'], 'ruby/1.9')
8
8
  end
9
- # TODO end
9
+ # ODOT
10
10
 
11
11
  require 'ruboto/activity'
12
12
  require 'ruboto/widget'
@@ -25,7 +25,7 @@ test('stack depth') do |activity|
25
25
  end
26
26
  version_message ="ANDROID: #{android.os.Build::VERSION::SDK_INT}, PLATFORM: #{org.ruboto.JRubyAdapter.uses_platform_apk ? org.ruboto.JRubyAdapter.platform_version_name : 'STANDALONE'}, JRuby: #{org.jruby.runtime.Constants::VERSION}"
27
27
  assert_equal [43 + os_offset + jruby_offset[0],
28
- 78 + os_offset + jruby_offset[1],
28
+ 71 + os_offset + jruby_offset[1],
29
29
  61 + os_offset + jruby_offset[2],
30
30
  78 + os_offset + jruby_offset[3]], [activity.find_view_by_id(42).text.to_i,
31
31
  activity.find_view_by_id(43).text.to_i,
@@ -6,7 +6,7 @@ if RUBY_VERSION < '1.9'
6
6
  $LOADED_FEATURES << 'psych.so'
7
7
  $LOAD_PATH << File.join(Config::CONFIG['libdir'], 'ruby/1.9')
8
8
  end
9
- # TODO end
9
+ # ODOT
10
10
 
11
11
  with_large_stack { require 'psych.rb' }
12
12
 
@@ -10,26 +10,34 @@ setup do |activity|
10
10
  assert @text_view
11
11
  end
12
12
 
13
+ # ANDROID: 15, PLATFORM: STANDALONE, JRuby: 1.6.7 '44697894' expected, but got '44687793'
14
+ # ANDROID: 15, PLATFORM: 0.4.8.dev, JRuby: 1.7.0.preview2 '[44, 68, 77, 93]' expected, but got '[44, 67, 76, 92]'
15
+ # ANDROID: 10, PLATFORM: STANDALONE, JRuby: 1.7.0.preview2 '[43, 67, 76, 92]' expected, but got '[43, 66, 75, 91]'
16
+ # ANDROID: 15, PLATFORM: STANDALONE, JRuby: 1.7.0.preview2 '[44, 68, 77, 93]' expected, but got '[44, 67, 76, 92]'
17
+
13
18
  test('stack depth') do |activity|
14
19
  os_offset = {13 => 1, 15 => 1, 16 => 1}[android.os.Build::VERSION::SDK_INT].to_i
15
20
  if org.ruboto.JRubyAdapter.uses_platform_apk?
16
21
  jruby_offset = {
17
- '0.4.7' => [0, 0, 0, 0],
22
+ '0.4.7' => [0, 0, 0, 0],
18
23
  '0.4.8.dev' => [0, -1, -1, -1],
19
24
  }[org.ruboto.JRubyAdapter.platform_version_name] || [0, 0, 0, 0]
20
25
  else # STANDALONE
21
26
  jruby_offset = {
22
- '1.7.0.dev' => [1, 1, 1, 1],
27
+ '1.7.0.dev' => [1, 0, 0, 0],
23
28
  '1.7.0.preview1' => [0, -1, -1, -1],
24
29
  '1.7.0.preview2' => [0, -1, -1, -1],
25
30
  }[org.jruby.runtime.Constants::VERSION] || [0, 0, 0, 0]
26
31
  end
27
32
  version_message ="ANDROID: #{android.os.Build::VERSION::SDK_INT}, PLATFORM: #{org.ruboto.JRubyAdapter.uses_platform_apk ? org.ruboto.JRubyAdapter.platform_version_name : 'STANDALONE'}, JRuby: #{org.jruby.runtime.Constants::VERSION}"
28
- assert_equal [43 + os_offset + jruby_offset[0],
29
- 67 + os_offset + jruby_offset[1],
30
- 76 + os_offset + jruby_offset[2],
31
- 92 + os_offset + jruby_offset[3]], [activity.find_view_by_id(42).text.to_i,
32
- activity.find_view_by_id(43).text.to_i,
33
- activity.find_view_by_id(44).text.to_i,
34
- activity.find_view_by_id(45).text.to_i], version_message
33
+ expected = [43 + os_offset + jruby_offset[0],
34
+ 67 + os_offset + jruby_offset[1],
35
+ 76 + os_offset + jruby_offset[2],
36
+ 92 + os_offset + jruby_offset[3]]
37
+ actual = [activity.find_view_by_id(42).text.to_i,
38
+ activity.find_view_by_id(43).text.to_i,
39
+ activity.find_view_by_id(44).text.to_i,
40
+ activity.find_view_by_id(45).text.to_i]
41
+ assert_equal expected, actual, version_message
42
+ puts "handle stack: #{version_message} #{actual.inspect}"
35
43
  end