leapmotion 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79e51d859e2f82cf7444cbcfbf66f038a74a78b7
4
- data.tar.gz: 63dac725779db7eaffc962c52e281118fc8c6c0c
3
+ metadata.gz: 39ac485633350248a4fd6087ea118b759e1ea766
4
+ data.tar.gz: fbb24a71d7537c9280ff2e5d62ffb0d7595e2c47
5
5
  SHA512:
6
- metadata.gz: 34ddaca73386d47b6948830c35a252bdbc93407aa8016914f30e7806a3002411e805cbe91ba45a4d3b7704bd7325f48f460871cb15dd4138f409d74bbf7d093e
7
- data.tar.gz: 7e6524d24311386bf804b16deb50ea504b595883d79dbb834fee304b6efb8410a921e7c1a71574500f257ff1f6cef2d7543b3d48bdeb8d65ad41fcea997972a8
6
+ metadata.gz: 4b6724fca4078e3adacc550dbeb02301663c5d65cb059e268b2c7c079fa9e747a8270b702a13be8c12bf07fbebcd64ca0b997bbec8d4120a15cb73339d01baa3
7
+ data.tar.gz: 3b5c1e716aa86bc75e0465df410a283f5ab860a2b9e926a3a0579cbacf9e2aa9076a4a1a5b9258175d56155c8ab224fd7b978bc7c2f01ad8a5e6ddb3d843a2b2
data/.gitignore CHANGED
@@ -1,3 +1,6 @@
1
+ *~
2
+ *#*
3
+ .DS_Store
1
4
  *.gem
2
5
  *.rbc
3
6
  .bundle
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- leapmotion (0.0.3)
4
+ leapmotion (0.0.4)
5
5
  event_emitter
6
6
  hashie
7
7
  json
@@ -13,6 +13,7 @@ GEM
13
13
  event_emitter (0.2.5)
14
14
  hashie (2.0.5)
15
15
  json (1.8.0)
16
+ minitest (5.0.6)
16
17
  rake (10.1.0)
17
18
  websocket (1.1.1)
18
19
  websocket-client-simple (0.0.5)
@@ -26,4 +27,5 @@ PLATFORMS
26
27
  DEPENDENCIES
27
28
  bundler (~> 1.3)
28
29
  leapmotion!
30
+ minitest
29
31
  rake
@@ -1,3 +1,7 @@
1
+ === 0.0.4 2013-08-03
2
+
3
+ * add tests
4
+
1
5
  === 0.0.3 2013-08-03
2
6
 
3
7
  * change github URL
data/README.md CHANGED
@@ -81,6 +81,15 @@ end
81
81
  leap.wait
82
82
  ```
83
83
 
84
+
85
+ Test
86
+ ----
87
+
88
+ % gem install bundler
89
+ % bundle install
90
+ % bundle exec rake test
91
+
92
+
84
93
  Contributing
85
94
  ------------
86
95
  1. Fork it
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.pattern = "test/test_*.rb"
6
+ end
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 1.3"
27
27
  spec.add_development_dependency "rake"
28
+ spec.add_development_dependency "minitest"
28
29
  end
@@ -44,6 +44,10 @@ module LeapMotion
44
44
  end
45
45
  end
46
46
 
47
+ def close
48
+ @ws.close
49
+ end
50
+
47
51
  def wait
48
52
  loop do
49
53
  sleep 1
@@ -1,3 +1,3 @@
1
1
  module LeapMotion
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -0,0 +1,36 @@
1
+ require File.expand_path "test_helper", File.dirname(__FILE__)
2
+
3
+ class TestGestures < MiniTest::Test
4
+
5
+ def setup
6
+ @leap = LeapMotion.connect :gestures => true
7
+ end
8
+
9
+ def teardown
10
+ @leap.close
11
+ sleep 1
12
+ end
13
+
14
+ def test_gestures
15
+ _gs = nil
16
+ STDERR.puts "plese move your hands."
17
+ @leap.on :gestures do |gestures|
18
+ _gs = gestures
19
+ end
20
+ while !_gs
21
+ sleep 1
22
+ end
23
+ g = _gs[0]
24
+ assert_equal g.class, LeapMotion::Data
25
+ assert_equal g.direction.class, Array
26
+ assert_equal g.duration.class, Fixnum
27
+ assert_equal g.handIds.class, Array
28
+ assert_equal g.pointableIds.class, Array
29
+ assert_equal g.position.class, Array
30
+ assert_equal g.speed.class, Float
31
+ assert_equal g.startPosition.class, Array
32
+ assert_equal g.state.class, String
33
+ assert ["swipe", "screenTap", "keyTap", "circle"].include? g.type
34
+ end
35
+
36
+ end
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'minitest/autorun'
4
+
5
+ $:.unshift File.expand_path '../lib', File.dirname(__FILE__)
6
+ require 'leapmotion'
@@ -0,0 +1,47 @@
1
+ require File.expand_path "test_helper", File.dirname(__FILE__)
2
+
3
+ class TestLeapMotion < MiniTest::Test
4
+
5
+ def setup
6
+ @leap = LeapMotion.connect
7
+ end
8
+
9
+ def teardown
10
+ @leap.close
11
+ sleep 1
12
+ end
13
+
14
+ def test_version
15
+ _connected = false
16
+ @leap.on :connect do
17
+ _connected = true
18
+ end
19
+ while !_connected
20
+ sleep 1
21
+ end
22
+ assert @leap.version > 0
23
+ end
24
+
25
+ def test_data
26
+ _data = nil
27
+ @leap.on :data do |data|
28
+ _data = data
29
+ end
30
+ while !_data
31
+ sleep 1
32
+ end
33
+ assert_equal _data.class, LeapMotion::Data
34
+ assert_equal _data.id.class, Fixnum
35
+ assert_equal _data.currentFrameRate.class, Float
36
+ assert_equal _data.timestamp.class, Fixnum
37
+ assert_equal _data.hands.class, Array
38
+ assert_equal _data.pointables.class, Array
39
+ assert_equal _data.gestures.class, Array
40
+ assert_equal _data.interactionBox.center.class, Array
41
+ assert_equal _data.interactionBox["size"].class, Array
42
+ assert_equal _data.r.class, Array
43
+ assert_equal _data.t.class, Array
44
+ assert_equal _data.s.class, Float
45
+ end
46
+
47
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leapmotion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Hashimoto
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: minitest
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description: LeapMotion WebSocket wrapper for Ruby
98
112
  email:
99
113
  - hashimoto@shokai.org
@@ -115,6 +129,9 @@ files:
115
129
  - lib/leapmotion/version.rb
116
130
  - samples/dump.rb
117
131
  - samples/gesture.rb
132
+ - test/test_gestures.rb
133
+ - test/test_helper.rb
134
+ - test/test_leapmotion.rb
118
135
  homepage: https://github.com/shokai/leapmotion-ruby
119
136
  licenses:
120
137
  - MIT
@@ -139,4 +156,7 @@ rubygems_version: 2.0.5
139
156
  signing_key:
140
157
  specification_version: 4
141
158
  summary: LeapMotion WebSocket wrapper for Ruby
142
- test_files: []
159
+ test_files:
160
+ - test/test_gestures.rb
161
+ - test/test_helper.rb
162
+ - test/test_leapmotion.rb