ruboto 0.9.0 → 0.10.0.rc.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +13 -13
- data/Rakefile +4 -4
- data/assets/rakelib/ruboto.rake +8 -4
- data/assets/samples/sample_broadcast_receiver.rb +0 -8
- data/assets/src/InheritingBroadcastReceiver.java +0 -19
- data/assets/src/InheritingClass.java +1 -8
- data/assets/src/RubotoActivity.java +1 -20
- data/assets/src/RubotoBroadcastReceiver.java +15 -25
- data/assets/src/RubotoService.java +1 -15
- data/assets/src/org/ruboto/EntryPointActivity.java +0 -1
- data/assets/src/org/ruboto/JRubyAdapter.java +9 -8
- data/assets/src/org/ruboto/RubotoComponent.java +0 -3
- data/assets/src/org/ruboto/Script.java +9 -9
- data/assets/src/org/ruboto/ScriptInfo.java +0 -15
- data/assets/src/org/ruboto/ScriptLoader.java +31 -43
- data/assets/src/ruboto/activity.rb +16 -41
- data/assets/src/ruboto/base.rb +0 -70
- data/assets/src/ruboto/broadcast_receiver.rb +2 -22
- data/assets/src/ruboto/package.rb +0 -1
- data/assets/src/ruboto/preference.rb +7 -3
- data/assets/src/ruboto/service.rb +14 -51
- data/assets/src/ruboto/widget.rb +2 -2
- data/lib/DexClient.java +10 -3
- data/lib/ruboto/util/build.rb +0 -5
- data/lib/ruboto/util/code_formatting.rb +1 -1
- data/lib/ruboto/util/update.rb +69 -50
- data/lib/ruboto/util/verify.rb +6 -5
- data/lib/ruboto/util/xml_element.rb +16 -29
- data/lib/ruboto/version.rb +2 -2
- data/test/activity/mytest_activity.rb +56 -0
- data/test/activity/mytest_activity_test.rb +52 -0
- data/test/activity/mytest_otherfile_activity.rb +12 -0
- data/test/activity/navigation_activity.rb +1 -1
- data/test/activity/subclass_activity.rb +10 -5
- data/test/activity/subclass_activity_test.rb +17 -2
- data/test/activity/view_constants_activity.rb +42 -0
- data/test/activity/view_constants_activity_test.rb +30 -0
- data/test/app_test_methods.rb +31 -26
- data/test/broadcast_receiver_test.rb +3 -1
- data/test/ruboto_gen_test.rb +4 -4
- data/test/test_helper.rb +5 -2
- metadata +18 -38
- data/assets/src/ruboto.rb +0 -25
- data/assets/src/ruboto/legacy.rb +0 -220
- data/assets/src/ruboto/menu.rb +0 -88
- data/lib/java_class_gen/InheritingClass.java.erb +0 -10
- data/test/block_def_activity/image_button_activity.rb +0 -23
- data/test/block_def_activity/image_button_activity_test.rb +0 -21
- data/test/block_def_activity/image_button_and_button_activity.rb +0 -20
- data/test/block_def_activity/image_button_and_button_activity_test.rb +0 -27
- data/test/block_def_activity/margins_activity.rb +0 -18
- data/test/block_def_activity/margins_activity_test.rb +0 -25
- data/test/block_def_activity/option_menu_activity.rb +0 -26
- data/test/block_def_activity/option_menu_activity_test.rb +0 -17
- data/test/block_def_activity/psych_activity.rb +0 -35
- data/test/block_def_activity/psych_activity_test.rb +0 -16
- data/test/block_def_activity/stack_activity.rb +0 -25
- data/test/block_def_activity/stack_activity_test.rb +0 -39
- data/test/handle_activity/image_button_activity.rb +0 -21
- data/test/handle_activity/image_button_activity_test.rb +0 -21
- data/test/handle_activity/image_button_and_button_activity.rb +0 -24
- data/test/handle_activity/image_button_and_button_activity_test.rb +0 -27
- data/test/handle_activity/margins_activity.rb +0 -15
- data/test/handle_activity/margins_activity_test.rb +0 -25
- data/test/handle_activity/option_menu_activity.rb +0 -25
- data/test/handle_activity/option_menu_activity_test.rb +0 -20
- data/test/handle_activity/psych_activity.rb +0 -31
- data/test/handle_activity/psych_activity_test.rb +0 -16
- data/test/handle_activity/stack_activity.rb +0 -24
- data/test/handle_activity/stack_activity_test.rb +0 -47
- data/test/view_constants_test.rb +0 -103
@@ -1,25 +0,0 @@
|
|
1
|
-
activity Java::org.ruboto.test_app.MarginsActivity
|
2
|
-
|
3
|
-
setup do |activity|
|
4
|
-
start = Time.now
|
5
|
-
loop do
|
6
|
-
@text_view_margins = activity.findViewById(42)
|
7
|
-
@text_view_layout = activity.findViewById(43)
|
8
|
-
@text_view_fieldset = activity.findViewById(44)
|
9
|
-
break if @text_view_margins || @text_view_layout || @text_view_fieldset || (Time.now - start > 60)
|
10
|
-
sleep 1
|
11
|
-
end
|
12
|
-
assert @text_view_margins
|
13
|
-
assert @text_view_layout
|
14
|
-
assert @text_view_fieldset
|
15
|
-
end
|
16
|
-
|
17
|
-
def left_margin(view)
|
18
|
-
view.get_layout_params.leftMargin
|
19
|
-
end
|
20
|
-
|
21
|
-
%w(margins layout fieldset).each do |view_type|
|
22
|
-
test("margins are set through #{view_type}") do |activity|
|
23
|
-
assert_equal 100, left_margin(instance_variable_get("@text_view_#{view_type}"))
|
24
|
-
end
|
25
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'ruboto/activity'
|
2
|
-
require 'ruboto/widget'
|
3
|
-
require 'ruboto/util/toast'
|
4
|
-
|
5
|
-
ruboto_import_widgets :LinearLayout, :TextView
|
6
|
-
|
7
|
-
$activity.start_ruboto_activity do
|
8
|
-
setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').map{|s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
|
9
|
-
|
10
|
-
def on_create(bundle)
|
11
|
-
self.content_view =
|
12
|
-
linear_layout :orientation => LinearLayout::VERTICAL do
|
13
|
-
@text_view = text_view :text => 'What hath Matz wrought?', :id => 42
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def on_create_options_menu(menu)
|
18
|
-
mi = menu.add('Test')
|
19
|
-
mi.setIcon($package.R::drawable::get_ruboto_core)
|
20
|
-
mi.set_on_menu_item_click_listener do |menu_item|
|
21
|
-
@text_view.text = 'What hath Matz wrought!'
|
22
|
-
toast 'Flipped a bit via butterfly'
|
23
|
-
end
|
24
|
-
true
|
25
|
-
end
|
26
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
activity Java::org.ruboto.test_app.OptionMenuActivity
|
2
|
-
|
3
|
-
setup do |activity|
|
4
|
-
start = Time.now
|
5
|
-
loop do
|
6
|
-
@text_view = activity.findViewById(42)
|
7
|
-
break if @text_view || (Time.now - start > 60)
|
8
|
-
sleep 1
|
9
|
-
end
|
10
|
-
assert @text_view
|
11
|
-
end
|
12
|
-
|
13
|
-
test('option_menu changes text') do |activity|
|
14
|
-
assert_equal "What hath Matz wrought?", @text_view.text
|
15
|
-
activity.window.performPanelIdentifierAction(android.view.Window::FEATURE_OPTIONS_PANEL, 0, 0)
|
16
|
-
assert_equal("What hath Matz wrought!", @text_view.text)
|
17
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# TODO(uwe): Remove when we stop supporting psych with Ruby 1.8 mode
|
2
|
-
if RUBY_VERSION < '1.9'
|
3
|
-
require 'jruby'
|
4
|
-
require 'rbconfig'
|
5
|
-
org.jruby.ext.psych.PsychLibrary.new.load(JRuby.runtime, false)
|
6
|
-
$LOADED_FEATURES << 'psych.so'
|
7
|
-
$LOAD_PATH << File.join(Config::CONFIG['libdir'], 'ruby/1.9')
|
8
|
-
end
|
9
|
-
# ODOT
|
10
|
-
|
11
|
-
require 'ruboto/activity'
|
12
|
-
require 'ruboto/widget'
|
13
|
-
require 'ruboto/util/stack'
|
14
|
-
require 'ruboto/util/toast'
|
15
|
-
|
16
|
-
with_large_stack { require 'psych.rb' }
|
17
|
-
|
18
|
-
Psych::Parser
|
19
|
-
Psych::Handler
|
20
|
-
|
21
|
-
ruboto_import_widgets :Button, :LinearLayout, :TextView
|
22
|
-
|
23
|
-
$activity.start_ruboto_activity do
|
24
|
-
setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
|
25
|
-
|
26
|
-
def on_create(bundle)
|
27
|
-
self.content_view =
|
28
|
-
linear_layout :orientation => LinearLayout::VERTICAL do
|
29
|
-
@decoded_view = text_view :id => 42, :text => with_large_stack{Psych.load('--- foo')}
|
30
|
-
# TODO(uwe): Simplify when we stop supporting Psych in Ruby 1.8 mode
|
31
|
-
@encoded_view = text_view(:id => 43, :text => with_large_stack{Psych.dump('foo')}) unless RUBY_VERSION < '1.9'
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
activity org.ruboto.test_app.PsychActivity
|
2
|
-
|
3
|
-
setup do |activity|
|
4
|
-
start = Time.now
|
5
|
-
loop do
|
6
|
-
@text_view = activity.findViewById(42)
|
7
|
-
break if @text_view || (Time.now - start > 60)
|
8
|
-
sleep 1
|
9
|
-
end
|
10
|
-
assert @text_view
|
11
|
-
end
|
12
|
-
|
13
|
-
test('psych_encode_decode') do |activity|
|
14
|
-
assert_equal 'foo', activity.find_view_by_id(42).text.to_s
|
15
|
-
#assert_equal "--- foo\n...\n", activity.find_view_by_id(43).text.to_s
|
16
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
STACK_DEPTH_SCRIPT = java.lang.Thread.current_thread.stack_trace.length.to_s
|
2
|
-
require 'ruboto/activity'
|
3
|
-
require 'ruboto/widget'
|
4
|
-
require 'ruboto/util/toast'
|
5
|
-
|
6
|
-
ruboto_import_widgets :Button, :LinearLayout, :TextView
|
7
|
-
|
8
|
-
$activity.start_ruboto_activity do
|
9
|
-
STACK_DEPTH_START_RUBOTO_ACTIVITY = java.lang.Thread.current_thread.stack_trace.length.to_s
|
10
|
-
|
11
|
-
def on_create(bundle)
|
12
|
-
stack_depth_on_create = java.lang.Thread.current_thread.stack_trace.length.to_s
|
13
|
-
setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
|
14
|
-
|
15
|
-
self.content_view =
|
16
|
-
linear_layout :orientation => LinearLayout::VERTICAL do
|
17
|
-
stack_depth_linear_layout = java.lang.Thread.current_thread.stack_trace.length.to_s
|
18
|
-
text_view :id => 42, :text => STACK_DEPTH_SCRIPT
|
19
|
-
text_view :id => 43, :text => STACK_DEPTH_START_RUBOTO_ACTIVITY
|
20
|
-
text_view :id => 44, :text => stack_depth_on_create
|
21
|
-
text_view :id => 45, :text => stack_depth_linear_layout
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
activity org.ruboto.test_app.StackActivity
|
2
|
-
|
3
|
-
setup do |activity|
|
4
|
-
start = Time.now
|
5
|
-
loop do
|
6
|
-
@text_view = activity.findViewById(42)
|
7
|
-
break if @text_view || (Time.now - start > 60)
|
8
|
-
sleep 1
|
9
|
-
end
|
10
|
-
assert @text_view
|
11
|
-
end
|
12
|
-
|
13
|
-
# ANDROID: 15, PLATFORM: STANDALONE, JRuby: 1.7.0 '[44, 72, 62, 79]' expected, but got '[44, 71, 62, 79]'
|
14
|
-
test('stack depth') do |activity|
|
15
|
-
os_offset = {13 => 1, 15 => 1, 16 => 1}[android.os.Build::VERSION::SDK_INT].to_i
|
16
|
-
if org.ruboto.JRubyAdapter.uses_platform_apk?
|
17
|
-
jruby_offset = {
|
18
|
-
'0.4.7' => [0, 0, 0, 0],
|
19
|
-
'0.4.8.dev' => [0, -1, 0, 0],
|
20
|
-
'0.4.8' => [0, -1, 0, 0],
|
21
|
-
'0.4.9' => [0, -1, 0, 0],
|
22
|
-
}[org.ruboto.JRubyAdapter.platform_version_name] || [0, 0, 0, 0]
|
23
|
-
else # STANDALONE
|
24
|
-
jruby_offset = {
|
25
|
-
'1.7.0.preview1' => [0, -1, -1, -1],
|
26
|
-
'1.7.0.preview2' => [0, -1, 0, 0],
|
27
|
-
'1.7.0' => [0, -1, 0, 0],
|
28
|
-
'1.7.1.dev' => [0, -1, 0, 0],
|
29
|
-
}[org.jruby.runtime.Constants::VERSION] || [0, 0, 0, 0]
|
30
|
-
end
|
31
|
-
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}"
|
32
|
-
assert_equal [43 + os_offset + jruby_offset[0],
|
33
|
-
71 + os_offset + jruby_offset[1],
|
34
|
-
61 + os_offset + jruby_offset[2],
|
35
|
-
78 + os_offset + jruby_offset[3]], [activity.find_view_by_id(42).text.to_i,
|
36
|
-
activity.find_view_by_id(43).text.to_i,
|
37
|
-
activity.find_view_by_id(44).text.to_i,
|
38
|
-
activity.find_view_by_id(45).text.to_i], version_message
|
39
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'ruboto'
|
2
|
-
|
3
|
-
ruboto_import_widgets :ImageButton, :LinearLayout, :TextView
|
4
|
-
|
5
|
-
$activity.handle_create do |bundle|
|
6
|
-
setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').map{|s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
|
7
|
-
|
8
|
-
setup_content do
|
9
|
-
linear_layout :orientation => LinearLayout::VERTICAL do
|
10
|
-
@text_view = text_view :text => 'What hath Matz wrought?', :id => 42
|
11
|
-
image_button :image_resource => $package.R::drawable::get_ruboto_core, :width => :wrap_content, :id => 43
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
handle_click do |view|
|
16
|
-
if view.id == 43
|
17
|
-
@text_view.setText 'What hath Matz wrought!'
|
18
|
-
toast 'Flipped a bit via butterfly'
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
activity Java::org.ruboto.test_app.ImageButtonActivity
|
2
|
-
|
3
|
-
setup do |activity|
|
4
|
-
start = Time.now
|
5
|
-
loop do
|
6
|
-
@text_view = activity.findViewById(42)
|
7
|
-
break if @text_view || (Time.now - start > 60)
|
8
|
-
sleep 1
|
9
|
-
end
|
10
|
-
assert @text_view
|
11
|
-
end
|
12
|
-
|
13
|
-
test('initial setup') do |activity|
|
14
|
-
assert_equal "What hath Matz wrought?", @text_view.text
|
15
|
-
end
|
16
|
-
|
17
|
-
test('button changes text') do |activity|
|
18
|
-
button = activity.findViewById(43)
|
19
|
-
button.performClick
|
20
|
-
assert_equal "What hath Matz wrought!", @text_view.text
|
21
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'ruboto'
|
2
|
-
|
3
|
-
ruboto_import_widgets :Button, :ImageButton, :LinearLayout, :TextView
|
4
|
-
|
5
|
-
$activity.handle_create do |bundle|
|
6
|
-
setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').map{|s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
|
7
|
-
|
8
|
-
setup_content do
|
9
|
-
linear_layout :orientation => LinearLayout::VERTICAL do
|
10
|
-
@text_view = text_view :text => 'What hath Matz wrought?', :id => 42
|
11
|
-
button :text => 'Button', :width => :wrap_content, :id => 44
|
12
|
-
image_button :image_resource => $package.R::drawable::get_ruboto_core, :width => :wrap_content, :id => 43
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
handle_click do |view|
|
17
|
-
if view.id == 43
|
18
|
-
@text_view.text = 'Image button pressed'
|
19
|
-
elsif view.id == 44
|
20
|
-
@text_view.text = 'Button pressed'
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
activity Java::org.ruboto.test_app.ImageButtonAndButtonActivity
|
2
|
-
|
3
|
-
setup do |activity|
|
4
|
-
start = Time.now
|
5
|
-
loop do
|
6
|
-
@text_view = activity.find_view_by_id 42
|
7
|
-
break if @text_view || (Time.now - start > 60)
|
8
|
-
sleep 1
|
9
|
-
end
|
10
|
-
assert @text_view
|
11
|
-
end
|
12
|
-
|
13
|
-
test('initial setup') do |activity|
|
14
|
-
assert_equal "What hath Matz wrought?", @text_view.text
|
15
|
-
end
|
16
|
-
|
17
|
-
test('button changes text') do |activity|
|
18
|
-
button = activity.find_view_by_id 44
|
19
|
-
button.perform_click
|
20
|
-
assert_equal 'Button pressed', @text_view.text
|
21
|
-
end
|
22
|
-
|
23
|
-
test('image button changes text') do |activity|
|
24
|
-
image_button = activity.find_view_by_id 43
|
25
|
-
image_button.perform_click
|
26
|
-
assert_equal 'Image button pressed', @text_view.text
|
27
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'ruboto'
|
2
|
-
|
3
|
-
ruboto_import_widgets :LinearLayout, :TextView
|
4
|
-
|
5
|
-
$activity.handle_create do |bundle|
|
6
|
-
setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').map{|s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
|
7
|
-
|
8
|
-
setup_content do
|
9
|
-
linear_layout :orientation => LinearLayout::VERTICAL do
|
10
|
-
@text_view_margins = text_view :text => 'What hath Matz wrought?', :id => 42, :margins => [100,0,0,0]
|
11
|
-
@text_view_layout = text_view :text => 'What hath Matz wrought?', :id => 43, :layout => {:set_margins => [100,0,0,0]}
|
12
|
-
@text_view_fieldset = text_view :text => 'What hath Matz wrought?', :id => 44, :layout => {:left_margin= => 100}
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
activity Java::org.ruboto.test_app.MarginsActivity
|
2
|
-
|
3
|
-
setup do |activity|
|
4
|
-
start = Time.now
|
5
|
-
loop do
|
6
|
-
@text_view_margins = activity.findViewById(42)
|
7
|
-
@text_view_layout = activity.findViewById(43)
|
8
|
-
@text_view_fieldset = activity.findViewById(44)
|
9
|
-
break if @text_view_margins || @text_view_layout || @text_view_fieldset || (Time.now - start > 60)
|
10
|
-
sleep 1
|
11
|
-
end
|
12
|
-
assert @text_view_margins
|
13
|
-
assert @text_view_layout
|
14
|
-
assert @text_view_fieldset
|
15
|
-
end
|
16
|
-
|
17
|
-
def left_margin(view)
|
18
|
-
view.get_layout_params.leftMargin
|
19
|
-
end
|
20
|
-
|
21
|
-
%w(margins layout fieldset).each do |view_type|
|
22
|
-
test("margins are set through #{view_type}") do |activity|
|
23
|
-
assert_equal 100, left_margin(instance_variable_get("@text_view_#{view_type}"))
|
24
|
-
end
|
25
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
STACK_DEPTH_SCRIPT = java.lang.Thread.current_thread.stack_trace.length.to_s
|
2
|
-
|
3
|
-
raise "Stack level: #{STACK_DEPTH_SCRIPT}" rescue puts $!.message + "\n" + $!.backtrace.join("\n")
|
4
|
-
|
5
|
-
require 'ruboto'
|
6
|
-
|
7
|
-
ruboto_import_widgets :ImageButton, :LinearLayout, :TextView
|
8
|
-
|
9
|
-
$activity.handle_create do |bundle|
|
10
|
-
setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').map{|s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
|
11
|
-
|
12
|
-
setup_content do
|
13
|
-
linear_layout :orientation => LinearLayout::VERTICAL do
|
14
|
-
@text_view = text_view :text => 'What hath Matz wrought?', :id => 42
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
handle_create_options_menu do |menu|
|
19
|
-
add_menu('Test') do
|
20
|
-
@text_view.setText 'What hath Matz wrought!'
|
21
|
-
toast 'Flipped a bit via butterfly'
|
22
|
-
end
|
23
|
-
true
|
24
|
-
end
|
25
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
activity Java::org.ruboto.test_app.OptionMenuActivity
|
2
|
-
|
3
|
-
setup do |activity|
|
4
|
-
start = Time.now
|
5
|
-
loop do
|
6
|
-
@text_view = activity.findViewById(42)
|
7
|
-
break if @text_view || (Time.now - start > 60)
|
8
|
-
sleep 1
|
9
|
-
end
|
10
|
-
assert @text_view
|
11
|
-
end
|
12
|
-
|
13
|
-
test('initial setup') do |activity|
|
14
|
-
assert_equal "What hath Matz wrought?", @text_view.text
|
15
|
-
end
|
16
|
-
|
17
|
-
test('option_menu changes text') do |activity|
|
18
|
-
activity.window.performPanelIdentifierAction(android.view.Window::FEATURE_OPTIONS_PANEL, 0, 0)
|
19
|
-
assert_equal "What hath Matz wrought!", @text_view.text
|
20
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# TODO(uwe): Remove when we stop supporting psych with Ruby 1.8 mode
|
2
|
-
if RUBY_VERSION < '1.9'
|
3
|
-
require 'jruby'
|
4
|
-
require 'rbconfig'
|
5
|
-
org.jruby.ext.psych.PsychLibrary.new.load(JRuby.runtime, false)
|
6
|
-
$LOADED_FEATURES << 'psych.so'
|
7
|
-
$LOAD_PATH << File.join(Config::CONFIG['libdir'], 'ruby/1.9')
|
8
|
-
end
|
9
|
-
# ODOT
|
10
|
-
|
11
|
-
with_large_stack { require 'psych.rb' }
|
12
|
-
|
13
|
-
Psych::Parser
|
14
|
-
Psych::Handler
|
15
|
-
|
16
|
-
require 'ruboto'
|
17
|
-
|
18
|
-
ruboto_import_widgets :Button, :LinearLayout, :TextView
|
19
|
-
|
20
|
-
$activity.handle_create do |bundle|
|
21
|
-
setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
|
22
|
-
|
23
|
-
setup_content do
|
24
|
-
linear_layout :orientation => LinearLayout::VERTICAL do
|
25
|
-
@decoded_view = text_view :id => 42, :text => with_large_stack { Psych.load('--- foo') }
|
26
|
-
# TODO(uwe): Simplify when we stop supporting Psych in Ruby 1.8 mode
|
27
|
-
@encoded_view = text_view(:id => 43, :text => with_large_stack { Psych.dump('foo') }) unless RUBY_VERSION < '1.9'
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
activity org.ruboto.test_app.PsychActivity
|
2
|
-
|
3
|
-
setup do |activity|
|
4
|
-
start = Time.now
|
5
|
-
loop do
|
6
|
-
@text_view = activity.findViewById(42)
|
7
|
-
break if @text_view || (Time.now - start > 60)
|
8
|
-
sleep 1
|
9
|
-
end
|
10
|
-
assert @text_view
|
11
|
-
end
|
12
|
-
|
13
|
-
test('psych_encode_decode') do |activity|
|
14
|
-
assert_equal 'foo', activity.find_view_by_id(42).text.to_s
|
15
|
-
#assert_equal "--- foo\n...\n", activity.find_view_by_id(43).text.to_s
|
16
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
STACK_DEPTH_SCRIPT = java.lang.Thread.current_thread.stack_trace.length.to_s
|
2
|
-
|
3
|
-
raise "Stack level: #{STACK_DEPTH_SCRIPT}" rescue puts $!.message + "\n" + $!.backtrace.join("\n")
|
4
|
-
|
5
|
-
require 'ruboto'
|
6
|
-
|
7
|
-
ruboto_import_widgets :Button, :LinearLayout, :TextView
|
8
|
-
|
9
|
-
$activity.handle_create do |bundle|
|
10
|
-
STACK_DEPTH_HANDLE_CREATE = java.lang.Thread.current_thread.stack_trace.length.to_s
|
11
|
-
setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').map{|s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
|
12
|
-
|
13
|
-
setup_content do
|
14
|
-
STACK_DEPTH_SETUP_CONTENT = java.lang.Thread.current_thread.stack_trace.length.to_s
|
15
|
-
linear_layout :orientation => LinearLayout::VERTICAL do
|
16
|
-
STACK_DEPTH_LINEAR_LAYOUT = java.lang.Thread.current_thread.stack_trace.length.to_s
|
17
|
-
@script_view = text_view :id => 42, :text => STACK_DEPTH_SCRIPT
|
18
|
-
@handle_create_view = text_view :id => 43, :text => STACK_DEPTH_HANDLE_CREATE
|
19
|
-
@setup_content_view = text_view :id => 44, :text => STACK_DEPTH_SETUP_CONTENT
|
20
|
-
@linear_layout_view = text_view :id => 45, :text => STACK_DEPTH_LINEAR_LAYOUT
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|