melomel 0.1.0 → 0.2.0
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/CHANGELOG.md +5 -0
- data/README.md +3 -1
- data/lib/melomel/bridge.rb +1 -1
- data/lib/melomel/ui.rb +36 -38
- data/lib/melomel/version.rb +1 -1
- data/lib/melomel.rb +6 -2
- data/test/test_bridge.rb +1 -1
- data/test/test_ui.rb +17 -17
- metadata +22 -17
- data/LICENSE +0 -20
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -116,8 +116,10 @@ your dependencies:
|
|
116
116
|
[sudo] bundle install
|
117
117
|
|
118
118
|
If you are adding new features, please add test coverage to all code that you
|
119
|
-
write.
|
119
|
+
write. First compile the Flex application and then run the test suite with
|
120
|
+
`rake`:
|
120
121
|
|
122
|
+
ant
|
121
123
|
rake test
|
122
124
|
|
123
125
|
|
data/lib/melomel/bridge.rb
CHANGED
data/lib/melomel/ui.rb
CHANGED
@@ -1,44 +1,42 @@
|
|
1
1
|
# This class provides ease of use utility methods for finding display objects
|
2
2
|
# and interacting with them.
|
3
3
|
module Melomel
|
4
|
-
class
|
5
|
-
class
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
Melomel.bridge.key_press(component, char, properties)
|
41
|
-
end
|
4
|
+
class << self
|
5
|
+
# Finds all display objects matching a class and hash of properties.
|
6
|
+
def find_all(class_name, root={}, properties={})
|
7
|
+
Melomel.bridge.find_all(class_name, root, properties)
|
8
|
+
end
|
9
|
+
|
10
|
+
# Finds a display object by class and properties.
|
11
|
+
def find(class_name, root={}, properties={})
|
12
|
+
Melomel.bridge.find(class_name, root, properties)
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
# Imitates a click on a component
|
17
|
+
def click(component, properties={})
|
18
|
+
Melomel.bridge.click(component, properties)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Imitates a double click on a component
|
22
|
+
def double_click(component, properties={})
|
23
|
+
Melomel.bridge.double_click(component, properties)
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
# Imitates a key down on a component
|
28
|
+
def key_down(component, char, properties={})
|
29
|
+
Melomel.bridge.key_down(component, char, properties)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Imitates a key up on a component
|
33
|
+
def key_up(component, char, properties={})
|
34
|
+
Melomel.bridge.key_up(component, char, properties)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Imitates a key press on a component
|
38
|
+
def key_press(component, char, properties={})
|
39
|
+
Melomel.bridge.key_press(component, char, properties)
|
42
40
|
end
|
43
41
|
end
|
44
42
|
end
|
data/lib/melomel/version.rb
CHANGED
data/lib/melomel.rb
CHANGED
@@ -21,9 +21,13 @@ module Melomel
|
|
21
21
|
@bridge.connect();
|
22
22
|
end
|
23
23
|
|
24
|
+
def method_missing(method, *args)
|
25
|
+
@bridge.send(method.to_sym, *args)
|
26
|
+
end
|
27
|
+
|
24
28
|
# Retrieves a reference to a class
|
25
|
-
def get_class(
|
26
|
-
@bridge.get_class(
|
29
|
+
def get_class(*args)
|
30
|
+
@bridge.get_class(*args)
|
27
31
|
end
|
28
32
|
|
29
33
|
# Creates an object in the virtual machine.
|
data/test/test_bridge.rb
CHANGED
@@ -44,7 +44,7 @@ class BridgeTestCase < MiniTest::Unit::TestCase
|
|
44
44
|
# Mock policy file
|
45
45
|
policy_socket = mock('policy_socket')
|
46
46
|
policy_socket.expects(:gets).returns("<policy-file-request/>\x00")
|
47
|
-
policy_socket.expects(:send).with(policy)
|
47
|
+
policy_socket.expects(:send).with(policy, 0)
|
48
48
|
policy_socket.expects(:flush)
|
49
49
|
policy_socket.expects(:close)
|
50
50
|
|
data/test/test_ui.rb
CHANGED
@@ -11,49 +11,49 @@ class IntegrationTestCase < RunnerTestCase
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def test_should_find_list_of_labels_named_foo
|
14
|
-
labels = Melomel
|
14
|
+
labels = Melomel.find_all('spark.components.Label', :name => 'foo')
|
15
15
|
assert_equal 3, labels.length
|
16
16
|
end
|
17
17
|
|
18
18
|
def should_find_text_input
|
19
|
-
text_input = Melomel
|
19
|
+
text_input = Melomel.find('spark.components.TextInput', :id => 'nameTextInput')
|
20
20
|
assert_equal 'nameTextField', text_input.name
|
21
21
|
end
|
22
22
|
|
23
23
|
|
24
24
|
def test_should_click_button
|
25
|
-
button = Melomel
|
26
|
-
label = Melomel
|
27
|
-
Melomel
|
25
|
+
button = Melomel.find('spark.components.Button', :id => 'clickButton')
|
26
|
+
label = Melomel.find('spark.components.Label', :id => 'clickLabel')
|
27
|
+
Melomel.click(button)
|
28
28
|
assert_equal 'Hello!', label.text
|
29
29
|
end
|
30
30
|
|
31
31
|
def test_should_double_click_the_button
|
32
|
-
button = Melomel
|
33
|
-
label = Melomel
|
34
|
-
Melomel
|
32
|
+
button = Melomel.find('spark.components.Button', :id => 'doubleClickButton')
|
33
|
+
label = Melomel.find('spark.components.Label', :id => 'doubleClickLabel')
|
34
|
+
Melomel.double_click(button)
|
35
35
|
assert_equal 'Hello Hello!', label.text
|
36
36
|
end
|
37
37
|
|
38
38
|
|
39
39
|
def test_should_press_key_down
|
40
|
-
text_input = Melomel
|
41
|
-
label = Melomel
|
42
|
-
Melomel
|
40
|
+
text_input = Melomel.find('spark.components.TextInput', :id => 'keyDownTextInput')
|
41
|
+
label = Melomel.find('spark.components.Label', :id => 'keyDownLabel')
|
42
|
+
Melomel.key_down(text_input, 'a')
|
43
43
|
assert_equal 'a', label.text
|
44
44
|
end
|
45
45
|
|
46
46
|
def test_should_release_key_up
|
47
|
-
text_input = Melomel
|
48
|
-
label = Melomel
|
49
|
-
Melomel
|
47
|
+
text_input = Melomel.find('spark.components.TextInput', :id => 'keyUpTextInput')
|
48
|
+
label = Melomel.find('spark.components.Label', :id => 'keyUpLabel')
|
49
|
+
Melomel.key_up(text_input, 'b')
|
50
50
|
assert_equal 'b', label.text
|
51
51
|
end
|
52
52
|
|
53
53
|
def test_should_press_key
|
54
|
-
text_input = Melomel
|
55
|
-
label = Melomel
|
56
|
-
Melomel
|
54
|
+
text_input = Melomel.find('spark.components.TextInput', :id => 'keyPressTextInput')
|
55
|
+
label = Melomel.find('spark.components.Label', :id => 'keyPressLabel')
|
56
|
+
Melomel.key_press(text_input, 'a')
|
57
57
|
assert_equal 'du', label.text
|
58
58
|
end
|
59
59
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: melomel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
+
- 2
|
8
9
|
- 0
|
9
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Ben Johnson
|
@@ -14,55 +15,58 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-09-03 00:00:00 -06:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
|
-
|
22
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
23
|
none: false
|
24
24
|
requirements:
|
25
25
|
- - ~>
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
+
hash: 1
|
27
28
|
segments:
|
28
29
|
- 1
|
29
30
|
- 4
|
30
31
|
- 3
|
31
32
|
version: 1.4.3
|
32
|
-
|
33
|
+
name: nokogiri
|
34
|
+
requirement: *id001
|
33
35
|
prerelease: false
|
34
|
-
|
36
|
+
type: :runtime
|
35
37
|
- !ruby/object:Gem::Dependency
|
36
|
-
|
37
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
39
|
none: false
|
39
40
|
requirements:
|
40
41
|
- - ~>
|
41
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 11
|
42
44
|
segments:
|
43
45
|
- 1
|
44
46
|
- 7
|
45
47
|
- 0
|
46
48
|
version: 1.7.0
|
47
|
-
|
49
|
+
name: minitest
|
50
|
+
requirement: *id002
|
48
51
|
prerelease: false
|
49
|
-
|
52
|
+
type: :development
|
50
53
|
- !ruby/object:Gem::Dependency
|
51
|
-
|
52
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
53
55
|
none: false
|
54
56
|
requirements:
|
55
57
|
- - ~>
|
56
58
|
- !ruby/object:Gem::Version
|
59
|
+
hash: 43
|
57
60
|
segments:
|
58
61
|
- 0
|
59
62
|
- 9
|
60
63
|
- 8
|
61
64
|
version: 0.9.8
|
62
|
-
|
65
|
+
name: mocha
|
66
|
+
requirement: *id003
|
63
67
|
prerelease: false
|
64
|
-
|
65
|
-
description:
|
68
|
+
type: :development
|
69
|
+
description:
|
66
70
|
email:
|
67
71
|
- benbjohnson@yahoo.com
|
68
72
|
executables: []
|
@@ -79,7 +83,6 @@ files:
|
|
79
83
|
- lib/melomel/ui.rb
|
80
84
|
- lib/melomel/version.rb
|
81
85
|
- lib/melomel.rb
|
82
|
-
- LICENSE
|
83
86
|
- README.md
|
84
87
|
- CHANGELOG.md
|
85
88
|
- test/helper.rb
|
@@ -102,6 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
102
105
|
requirements:
|
103
106
|
- - ">="
|
104
107
|
- !ruby/object:Gem::Version
|
108
|
+
hash: 3
|
105
109
|
segments:
|
106
110
|
- 0
|
107
111
|
version: "0"
|
@@ -110,6 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
114
|
requirements:
|
111
115
|
- - ">="
|
112
116
|
- !ruby/object:Gem::Version
|
117
|
+
hash: 3
|
113
118
|
segments:
|
114
119
|
- 0
|
115
120
|
version: "0"
|
data/LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2010 Ben Johnson
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
5
|
-
in the Software without restriction, including without limitation the rights
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
8
|
-
furnished to do so, subject to the following conditions:
|
9
|
-
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
11
|
-
all copies or substantial portions of the Software.
|
12
|
-
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
THE SOFTWARE.
|
20
|
-
|