jrubyconf-button 1-java → 2-java
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/jrubyconf-button +5 -3
- data/features/button.feature +7 -1
- data/features/step_definitions/button_steps.rb +4 -8
- data/features/support/env.rb +5 -1
- metadata +14 -4
data/bin/jrubyconf-button
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
#!/usr/bin/env jruby -J-d32 -J-client -J-Dfile.encoding=UTF8 -J-Xmx320m -J-Xss1024k -J-Djruby.memory.max=320m -J-Djruby.stack.max=1024k
|
1
2
|
|
2
3
|
require 'java'
|
3
4
|
require 'rubygems'
|
@@ -6,13 +7,15 @@ require 'swt'
|
|
6
7
|
class ButtonApp
|
7
8
|
attr_reader :shell
|
8
9
|
|
10
|
+
LABELS = ["Drink Me", "Eat Me"]
|
11
|
+
|
9
12
|
def initialize
|
10
13
|
display = Swt::Widgets::Display.get_current
|
11
14
|
@shell = Swt::Widgets::Shell.new
|
12
15
|
@shell.setLayout(Swt::Layout::FillLayout.new)
|
13
16
|
button = Swt::Widgets::Button.new(@shell, Swt::SWT::PUSH)
|
14
|
-
button.set_text(
|
15
|
-
button.add_selection_listener {
|
17
|
+
button.set_text(LABELS[0])
|
18
|
+
button.add_selection_listener { button.text = LABELS[(LABELS.index(button.text) - 1).abs] }
|
16
19
|
@shell.pack
|
17
20
|
@shell.open
|
18
21
|
end
|
@@ -21,4 +24,3 @@ end
|
|
21
24
|
app = ButtonApp.new
|
22
25
|
|
23
26
|
Swt.event_loop { app.shell.disposed? }
|
24
|
-
|
data/features/button.feature
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
Feature: The button
|
2
2
|
|
3
3
|
Scenario: Button exists
|
4
|
-
Then the button should show the text "
|
4
|
+
Then the button should show the text "Drink Me"
|
5
|
+
|
6
|
+
Scenario: Button changes text
|
7
|
+
When I press the button
|
8
|
+
Then the button should show the text "Eat Me"
|
9
|
+
When I press the button
|
10
|
+
Then the button should show the text "Drink Me"
|
@@ -1,12 +1,8 @@
|
|
1
|
-
def shell
|
2
|
-
display = Swt::Widgets::Display.get_current
|
3
|
-
shell = display.get_shells.to_a.first
|
4
|
-
end
|
5
1
|
|
6
|
-
|
7
|
-
|
2
|
+
Then /^the button should show the text "([^"]*)"$/ do |arg1|
|
3
|
+
Swt.bot.button.text.should == arg1
|
8
4
|
end
|
9
5
|
|
10
|
-
|
11
|
-
button.
|
6
|
+
When /^I press the button$/ do
|
7
|
+
Swt.bot.button.click
|
12
8
|
end
|
data/features/support/env.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: jrubyconf-button
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: "
|
5
|
+
version: "2"
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Daniel Lucraft
|
@@ -10,10 +10,20 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-08-
|
13
|
+
date: 2011-08-04 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
|
-
dependencies:
|
16
|
-
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: swt
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0.7"
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
17
27
|
description: A JRubyConf button!
|
18
28
|
email:
|
19
29
|
- dan@fluentradical.com
|