jrubyconf-button 2-java → 4-java
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.
- data/bin/jrubyconf-button +2 -20
- data/features/button.feature +4 -2
- data/features/step_definitions/button_steps.rb +20 -4
- data/features/support/env.rb +7 -7
- metadata +2 -2
data/bin/jrubyconf-button
CHANGED
@@ -1,25 +1,7 @@
|
|
1
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
|
2
2
|
|
3
|
-
|
4
|
-
require '
|
5
|
-
require 'swt'
|
6
|
-
|
7
|
-
class ButtonApp
|
8
|
-
attr_reader :shell
|
9
|
-
|
10
|
-
LABELS = ["Drink Me", "Eat Me"]
|
11
|
-
|
12
|
-
def initialize
|
13
|
-
display = Swt::Widgets::Display.get_current
|
14
|
-
@shell = Swt::Widgets::Shell.new
|
15
|
-
@shell.setLayout(Swt::Layout::FillLayout.new)
|
16
|
-
button = Swt::Widgets::Button.new(@shell, Swt::SWT::PUSH)
|
17
|
-
button.set_text(LABELS[0])
|
18
|
-
button.add_selection_listener { button.text = LABELS[(LABELS.index(button.text) - 1).abs] }
|
19
|
-
@shell.pack
|
20
|
-
@shell.open
|
21
|
-
end
|
22
|
-
end
|
3
|
+
$:.unshift(File.expand_path("../../lib", __FILE__))
|
4
|
+
require 'jrubyconf-button'
|
23
5
|
|
24
6
|
app = ButtonApp.new
|
25
7
|
|
data/features/button.feature
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
Feature: The button
|
2
2
|
|
3
3
|
Scenario: Button exists
|
4
|
+
Given the window is open
|
4
5
|
Then the button should show the text "Drink Me"
|
5
6
|
|
6
7
|
Scenario: Button changes text
|
7
|
-
|
8
|
+
Given the window is open
|
9
|
+
When I press the button "Drink Me"
|
8
10
|
Then the button should show the text "Eat Me"
|
9
|
-
When I press the button
|
11
|
+
When I press the button "Eat Me"
|
10
12
|
Then the button should show the text "Drink Me"
|
@@ -1,8 +1,24 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
Swt.
|
2
|
+
def open_window
|
3
|
+
Swt.sync_exec { @win = ButtonApp.new }
|
4
4
|
end
|
5
5
|
|
6
|
-
|
7
|
-
Swt.bot.button.
|
6
|
+
def button_text
|
7
|
+
Swt.bot.button.text
|
8
|
+
end
|
9
|
+
|
10
|
+
def click_button(text)
|
11
|
+
Swt.bot.button(text).click
|
12
|
+
end
|
13
|
+
|
14
|
+
Given /^the window is open$/ do
|
15
|
+
open_window
|
16
|
+
end
|
17
|
+
|
18
|
+
When /^I press the button "([^"]*)"$/ do |text|
|
19
|
+
click_button(text)
|
20
|
+
end
|
21
|
+
|
22
|
+
Then /^the button should show the text "([^"]*)"$/ do |text|
|
23
|
+
button_text.should == text
|
8
24
|
end
|
data/features/support/env.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
$:.unshift(File.expand_path("../../../
|
1
|
+
$:.unshift(File.expand_path("../../../lib", __FILE__))
|
2
2
|
|
3
|
-
|
4
|
-
require fn unless fn =~ /source/
|
5
|
-
end
|
3
|
+
require 'jrubyconf-button'
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
After do
|
6
|
+
if @win
|
7
|
+
Swt.sync_exec { @win.close }
|
8
|
+
end
|
9
|
+
end
|
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: "4"
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Daniel Lucraft
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
requirements:
|
22
22
|
- - ">="
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: "0.
|
24
|
+
version: "0.8"
|
25
25
|
type: :runtime
|
26
26
|
version_requirements: *id001
|
27
27
|
description: A JRubyConf button!
|