propane 2.3.0-java → 2.3.1-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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -3
- data/README.md +5 -5
- data/Rakefile +2 -1
- data/lib/propane.rb +1 -0
- data/lib/propane/creators/sketch_class.rb +2 -1
- data/lib/propane/helper_methods.rb +6 -3
- data/lib/propane/version.rb +1 -1
- data/pom.rb +4 -4
- data/pom.xml +4 -4
- data/propane.gemspec +2 -2
- data/test/create_test.rb +6 -30
- data/test/deglut_spec_test.rb +1 -6
- data/test/helper_methods_test.rb +58 -0
- data/test/math_tool_test.rb +1 -5
- data/test/respond_to_test.rb +8 -10
- data/test/test_helper.rb +2 -4
- data/test/vecmath_spec_test.rb +1 -4
- data/vendors/Rakefile +1 -1
- metadata +7 -13
- data/test/test_create.rb +0 -91
- data/test/test_deglut_spec.rb +0 -25
- data/test/test_math_tool.rb +0 -89
- data/test/test_respond_to.rb +0 -213
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d725a63b42635bff188a63809d845500b3d4827
|
4
|
+
data.tar.gz: 1da37fcd8930186d6824153fa80b85b91360cec8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edb41b6d1e2f885412901f3156b8f32000eadfbf5cbf3752a154bbd6b2dcaabdf5d395262f11c7edfad5c55aea99cb90654855e5c36cffac40d001d2bf906c45
|
7
|
+
data.tar.gz: 02263c502b43aa18190da5e63d14605810edbc80c28610dd72cc57d68825f357db51683def11736d09d0b433b1ffa1155323f9855794dfcef221f98332a297ee
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,14 @@
|
|
1
|
-
**v2.3.
|
1
|
+
**v2.3.1** Update to processing-3.3.1, Update samples which now include `#!/usr/bin/env jruby` to assist running sketches from atom, add Rakefile for automatic sketch running for many samples, expected upgrade to final jruby-9.1.x.x
|
2
2
|
|
3
|
-
**v2.
|
3
|
+
**v2.3.0** Update to core processing-3.3 `grid` method now implemented in java, bump examples to include WOVNS
|
4
|
+
|
5
|
+
**v2.1.1** Update to core processing-3.2.4 and JRuby-9.1.7.0
|
4
6
|
|
5
7
|
**v2.1.0** Add missing method to ColorUtil.java, `include HelperMethods, PConstants, Math, MathTool` in `Propane::Proxy`, it is just simpler that way. Mixin Renderer for AppRender and ShapeRender. Changes to `Propane::Proxy` are significant enough to warrant versioning bump, samples making use of new code will not be runable by earlier versions.
|
6
8
|
|
7
9
|
**v2.0.6** Update to core processing-3.2.3
|
8
10
|
|
9
|
-
**v2.0.5** Update to processing-3.2.2, fix local library load, add proxy_library expand samples
|
11
|
+
**v2.0.5** Update to processing-3.2.2, fix local library load, add `proxy_library` expand samples
|
10
12
|
|
11
13
|
**v2.0.4** Correct `norm_strict`, add `math_tool_test` add `simplex_noise` expand samples
|
12
14
|
|
data/README.md
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# Propane
|
2
2
|
[](https://badge.fury.io/rb/propane)
|
3
3
|
|
4
|
-
A slim layer to communicate with Processing from JRuby, features a polyglot maven build. We have created a configuration free version of ruby processing, for processing-3.3, where we include processing core (from a local maven repository and opengl etc from maven central). These jars are small enough to include in a gem distribution, and hence we do not require configuration. This has created a scriptable version, ie files get run direct from jruby, but you could use jruby-complete if you used the propane script (avoids need to give the absolute data path for the data folder, but would also be needed for a watch mode). See guide to [building ruby-processing projects][building].
|
4
|
+
A slim layer to communicate with Processing from JRuby, features a polyglot maven build. We have created a configuration free version of ruby processing, for processing-3.3.1, where we include processing core (from a local maven repository and opengl etc from maven central). These jars are small enough to include in a gem distribution, and hence we do not require configuration. This has created a scriptable version, ie files get run direct from jruby, but you could use jruby-complete if you used the propane script (avoids need to give the absolute data path for the data folder, but would also be needed for a watch mode). See guide to [building ruby-processing projects][building].
|
5
5
|
|
6
6
|
## Requirements
|
7
7
|
|
8
8
|
- jdk8+
|
9
|
-
- jruby-9.1.
|
9
|
+
- jruby-9.1.8.0+
|
10
10
|
- mvn-3.3.1+ (development only)
|
11
|
-
- core.jar processing-3.3.
|
11
|
+
- core.jar processing-3.3.1 (development only until processing.org is available at maven central)
|
12
12
|
|
13
13
|
## Building and testing
|
14
14
|
|
@@ -20,8 +20,8 @@ rake javadoc
|
|
20
20
|
|
21
21
|
## Installation
|
22
22
|
```bash
|
23
|
-
jgem install propane # from rubygems
|
24
|
-
jgem install propane-2.3.
|
23
|
+
jgem install propane # from rubygems
|
24
|
+
jgem install propane-2.3.1-java.gem # for local install
|
25
25
|
```
|
26
26
|
|
27
27
|
## Usage
|
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ def create_manifest
|
|
7
7
|
File.open('MANIFEST.MF', 'w') do |f|
|
8
8
|
f.puts(title)
|
9
9
|
f.puts(version)
|
10
|
-
f.puts('Class-Path: core-3.
|
10
|
+
f.puts('Class-Path: core-3.3.1.jar gluegen-rt-2.3.2.jar jog-all-2.3.2.jar')
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -46,6 +46,7 @@ end
|
|
46
46
|
|
47
47
|
desc 'Test'
|
48
48
|
task :test do
|
49
|
+
sh 'jruby test/helper_methods_test.rb'
|
49
50
|
sh 'jruby test/respond_to_test.rb'
|
50
51
|
sh 'jruby test/create_test.rb'
|
51
52
|
sh 'jruby test/math_tool_test.rb'
|
data/lib/propane.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
#frozen_string_literal: false
|
2
2
|
# the sketch class
|
3
3
|
class SketchClass
|
4
4
|
attr_reader :name, :width, :height, :mode
|
@@ -40,6 +40,7 @@ class SketchClass
|
|
40
40
|
|
41
41
|
def lines
|
42
42
|
lines = [
|
43
|
+
'#!/usr/bin/env jruby',
|
43
44
|
'# frozen_string_literal: false',
|
44
45
|
"require 'propane'",
|
45
46
|
'',
|
@@ -75,16 +75,19 @@ module Propane
|
|
75
75
|
|
76
76
|
# explicitly provide 'processing.org' min instance method
|
77
77
|
# to return a float:- a, b and c need to be floats
|
78
|
+
# you might choose to use ruby method directly and then
|
79
|
+
# provide a block to alter comparator eg
|
80
|
+
# args.min(&block) # { |a, b| a.value <=> b.value }
|
78
81
|
|
79
82
|
def min(*args)
|
80
|
-
args.min
|
83
|
+
args.min
|
81
84
|
end
|
82
85
|
|
83
86
|
# explicitly provide 'processing.org' max instance method
|
84
|
-
# to return a float:- a, b and c need to be floats
|
87
|
+
# to return a float:- a, b and c need to be floats see above
|
85
88
|
|
86
89
|
def max(*args)
|
87
|
-
args.max
|
90
|
+
args.max
|
88
91
|
end
|
89
92
|
|
90
93
|
# explicitly provide 'processing.org' dist instance method
|
data/lib/propane/version.rb
CHANGED
data/pom.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
project 'rp5extras', 'https://github.com/monkstone/propane' do
|
3
3
|
model_version '4.0.0'
|
4
|
-
id 'propane:propane', '2.3.
|
4
|
+
id 'propane:propane', '2.3.1'
|
5
5
|
packaging 'jar'
|
6
6
|
description 'rp5extras for propane'
|
7
7
|
organization 'ruby-processing', 'https://ruby-processing.github.io'
|
@@ -32,8 +32,8 @@ project 'rp5extras', 'https://github.com/monkstone/propane' do
|
|
32
32
|
'jogl.version' => '2.3.2'
|
33
33
|
)
|
34
34
|
|
35
|
-
pom 'org.jruby:jruby:9.1.
|
36
|
-
jar 'org.processing:core:3.3.
|
35
|
+
pom 'org.jruby:jruby:9.1.8.0'
|
36
|
+
jar 'org.processing:core:3.3.1'
|
37
37
|
jar 'org.processing:video:3.0.2'
|
38
38
|
jar('org.jogamp.jogl:jogl-all:${jogl.version}')
|
39
39
|
jar('org.jogamp.gluegen:gluegen-rt-main:${jogl.version}')
|
@@ -44,7 +44,7 @@ project 'rp5extras', 'https://github.com/monkstone/propane' do
|
|
44
44
|
execute_goals( id: 'default-cli',
|
45
45
|
artifactItems: [ { groupId: 'org.processing',
|
46
46
|
artifactId: 'core',
|
47
|
-
version: '3.3.
|
47
|
+
version: '3.3.1',
|
48
48
|
type: 'jar',
|
49
49
|
outputDirectory: '${propane.basedir}/lib'
|
50
50
|
},
|
data/pom.xml
CHANGED
@@ -11,7 +11,7 @@ DO NOT MODIFIY - GENERATED CODE
|
|
11
11
|
<modelVersion>4.0.0</modelVersion>
|
12
12
|
<groupId>propane</groupId>
|
13
13
|
<artifactId>propane</artifactId>
|
14
|
-
<version>2.3.
|
14
|
+
<version>2.3.1</version>
|
15
15
|
<name>rp5extras</name>
|
16
16
|
<description>rp5extras for propane</description>
|
17
17
|
<url>https://github.com/monkstone/propane</url>
|
@@ -58,13 +58,13 @@ DO NOT MODIFIY - GENERATED CODE
|
|
58
58
|
<dependency>
|
59
59
|
<groupId>org.jruby</groupId>
|
60
60
|
<artifactId>jruby</artifactId>
|
61
|
-
<version>9.1.
|
61
|
+
<version>9.1.8.0</version>
|
62
62
|
<type>pom</type>
|
63
63
|
</dependency>
|
64
64
|
<dependency>
|
65
65
|
<groupId>org.processing</groupId>
|
66
66
|
<artifactId>core</artifactId>
|
67
|
-
<version>3.3.
|
67
|
+
<version>3.3.1</version>
|
68
68
|
</dependency>
|
69
69
|
<dependency>
|
70
70
|
<groupId>org.processing</groupId>
|
@@ -103,7 +103,7 @@ DO NOT MODIFIY - GENERATED CODE
|
|
103
103
|
<artifactItem>
|
104
104
|
<groupId>org.processing</groupId>
|
105
105
|
<artifactId>core</artifactId>
|
106
|
-
<version>3.3.
|
106
|
+
<version>3.3.1</version>
|
107
107
|
<type>jar</type>
|
108
108
|
<outputDirectory>${propane.basedir}/lib</outputDirectory>
|
109
109
|
</artifactItem>
|
data/propane.gemspec
CHANGED
@@ -10,11 +10,11 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.email = ['mamba2928@yahoo.co.uk']
|
11
11
|
gem.licenses = %w(GPL-3.0 LGPL-2.0)
|
12
12
|
gem.description = %q{A batteries included version of processing in ruby, MacOS and linux64}
|
13
|
-
gem.summary = %q{ruby wrapper for processing-3.3 on MacOS and linux64 bit only for opengl}
|
13
|
+
gem.summary = %q{ruby wrapper for processing-3.3.1 on MacOS and linux64 bit only for opengl}
|
14
14
|
gem.homepage = 'https://ruby-processing.github.io/propane/'
|
15
15
|
gem.files = `git ls-files`.split($/)
|
16
16
|
gem.files << 'lib/propane.jar'
|
17
|
-
gem.files << 'lib/core-3.3.
|
17
|
+
gem.files << 'lib/core-3.3.1.jar'
|
18
18
|
gem.files << 'lib/gluegen-rt-2.3.2.jar'
|
19
19
|
gem.files << 'lib/jogl-all-2.3.2.jar'
|
20
20
|
gem.files << 'lib/gluegen-rt-2.3.2-natives-linux-amd64.jar'
|
data/test/create_test.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
-
|
2
|
-
require 'minitest/autorun'
|
3
|
-
require 'minitest/pride'
|
4
|
-
|
5
|
-
|
1
|
+
require_relative 'test_helper'
|
6
2
|
require_relative '../lib/propane/creators/sketch_class'
|
3
|
+
require_relative '../lib/propane/creators/sketch_writer'
|
7
4
|
|
8
5
|
CLASS_SKETCH = <<~CODE
|
6
|
+
|
7
|
+
#!/usr/bin/env jruby
|
9
8
|
# frozen_string_literal: false
|
10
9
|
require 'propane'
|
11
10
|
|
@@ -27,28 +26,13 @@ FredSketch.new
|
|
27
26
|
|
28
27
|
CODE
|
29
28
|
|
30
|
-
BARE_SKETCH = <<~CODE
|
31
|
-
def settings
|
32
|
-
size 200, 200, P2D
|
33
|
-
end
|
34
|
-
|
35
|
-
def setup
|
36
|
-
sketch_title 'Fred Sketch'
|
37
|
-
end
|
38
|
-
|
39
|
-
def draw
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
CODE
|
44
|
-
|
45
29
|
class SketchClassTest < Minitest::Test
|
46
|
-
|
30
|
+
|
47
31
|
def setup
|
48
32
|
@basic = SketchClass.new(name: 'fred_sketch', width: 200, height: 200)
|
49
33
|
@sketch = SketchClass.new(name: 'fred_sketch', width: 200, height: 200, mode: 'p2d')
|
50
34
|
end
|
51
|
-
|
35
|
+
|
52
36
|
def test_class
|
53
37
|
result = CLASS_SKETCH.split(/\n/, -1)
|
54
38
|
class_lines = @sketch.lines
|
@@ -78,14 +62,6 @@ class SketchClassTest < Minitest::Test
|
|
78
62
|
assert_equal "FredSketch.new", @sketch.sketch_new
|
79
63
|
end
|
80
64
|
|
81
|
-
def test_method_lines
|
82
|
-
result = CLASS_SKETCH.split(/\n/, -1)
|
83
|
-
@basic.method_lines('settings', @basic.size).each_with_index do |line, i|
|
84
|
-
assert_equal result[i + 4], line
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
|
89
65
|
def test_sketch_class
|
90
66
|
assert_equal "class FredSketch < Propane::App", @basic.class_sketch
|
91
67
|
end
|
data/test/deglut_spec_test.rb
CHANGED
@@ -1,12 +1,7 @@
|
|
1
|
-
|
1
|
+
require_relative 'test_helper'
|
2
2
|
require 'java'
|
3
|
-
require 'minitest/autorun'
|
4
|
-
require 'minitest/pride'
|
5
|
-
|
6
3
|
require_relative '../lib/propane'
|
7
4
|
|
8
|
-
Java::Monkstone::PropaneLibrary.load(JRuby.runtime)
|
9
|
-
|
10
5
|
Dir.chdir(File.dirname(__FILE__))
|
11
6
|
|
12
7
|
class DeglutTest < Minitest::Test
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative 'test_helper'
|
3
|
+
require 'java'
|
4
|
+
require_relative '../lib/propane'
|
5
|
+
|
6
|
+
Java::Monkstone::PropaneLibrary.new.load(JRuby.runtime, false)
|
7
|
+
|
8
|
+
include Propane::HelperMethods
|
9
|
+
include MathTool
|
10
|
+
|
11
|
+
Dir.chdir(File.dirname(__FILE__))
|
12
|
+
|
13
|
+
class HelperMethodsTest < Minitest::Test
|
14
|
+
|
15
|
+
ARRAY = %w(albatross dog horse)
|
16
|
+
def test_hex_color
|
17
|
+
col_double = 0.5
|
18
|
+
hexcolor = 0xFFCC6600
|
19
|
+
dodgy_hexstring = '*56666'
|
20
|
+
hexstring = '#CC6600'
|
21
|
+
assert hex_color(col_double) == 0.5, 'double as a color'
|
22
|
+
assert hex_color(hexcolor) == -3381760, 'hexadecimal fixnum color'
|
23
|
+
assert hex_color(hexstring) == -3381760, 'hexadecimal string color'
|
24
|
+
assert_raises(StandardError, 'Dodgy Hexstring') do
|
25
|
+
hex_color(dodgy_hexstring)
|
26
|
+
end
|
27
|
+
assert_raises(StandardError, 'Dodgy Color Conversion') do
|
28
|
+
hex_color([])
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_dist
|
33
|
+
ax, ay, bx, by = 0, 0, 1.0, 1.0
|
34
|
+
assert_in_epsilon(dist(ax, ay, bx, by), Math.sqrt(2), epsilon = 0.0001, msg = '2D distance')
|
35
|
+
by = 0.0
|
36
|
+
assert_in_epsilon(dist(ax, ay, bx, by), 1.0, epsilon = 0.0001, msg = 'when y dimension is zero')
|
37
|
+
ax, ay, bx, by = 0, 0, 0.0, 0.0
|
38
|
+
assert_in_epsilon(dist(ax, ay, bx, by), 0.0, epsilon = 0.0001, msg = 'when x and y dimension are zero')
|
39
|
+
ax, ay, bx, by = 1, 1, -2.0, -3.0
|
40
|
+
assert_in_epsilon(dist(ax, ay, bx, by), 5.0, epsilon = 0.0001, msg = 'classic triangle dimensions')
|
41
|
+
ax, ay, bx, by, cx, cy = -1, -1, 100, 2.0, 3.0, 100
|
42
|
+
assert_in_epsilon(dist(ax, ay, bx, by, cx, cy), 5.0, epsilon = 0.0001, msg = 'classic triangle dimensions')
|
43
|
+
ax, ay, bx, by, cx, cy = 0, 0, -1.0, -1.0, 0, 0
|
44
|
+
assert_in_epsilon(dist(ax, ay, bx, by, cx, cy), Math.sqrt(2), epsilon = 0.0001, msg = '2D distance')
|
45
|
+
ax, ay, bx, by, cx, cy = 0, 0, 0.0, 0.0, 0, 0
|
46
|
+
assert_in_epsilon(dist(ax, ay, bx, by, cx, cy), 0.0)
|
47
|
+
ax, ay, bx, by, cx, cy = 0, 0, 1.0, 0.0, 0, 0
|
48
|
+
assert_in_epsilon(dist(ax, ay, bx, by, cx, cy), 1.0, epsilon = 0.0001, msg = 'when x and z dimension are zero')
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_min
|
52
|
+
assert_equal(min(*ARRAY), 'albatross')
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_max
|
56
|
+
assert_equal(max(*ARRAY), 'horse')
|
57
|
+
end
|
58
|
+
end
|
data/test/math_tool_test.rb
CHANGED
@@ -1,10 +1,6 @@
|
|
1
|
-
|
1
|
+
require_relative 'test_helper'
|
2
2
|
require 'java'
|
3
|
-
require 'minitest/autorun'
|
4
|
-
require 'minitest/pride'
|
5
|
-
|
6
3
|
require_relative '../lib/propane'
|
7
|
-
# require_relative '../lib/jruby_art/helper_methods'
|
8
4
|
|
9
5
|
Java::Monkstone::PropaneLibrary.new.load(JRuby.runtime, false)
|
10
6
|
|
data/test/respond_to_test.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
require 'java'
|
3
|
-
|
4
|
-
require 'minitest/pride'
|
5
|
-
|
3
|
+
require_relative 'test_helper'
|
6
4
|
require_relative '../lib/propane'
|
7
5
|
|
8
6
|
METHODS = %i(
|
@@ -200,18 +198,18 @@ class TestSketch < Propane::App
|
|
200
198
|
end
|
201
199
|
end
|
202
200
|
|
203
|
-
class SpecTest < Minitest::Test
|
201
|
+
class SpecTest < Minitest::Test
|
204
202
|
def setup
|
205
|
-
@
|
203
|
+
@propane_sketch = TestSketch.new
|
206
204
|
end
|
207
|
-
|
205
|
+
|
208
206
|
def test_respond
|
209
207
|
METHODS.each do |method_string|
|
210
|
-
assert_respond_to @
|
208
|
+
assert_respond_to @propane_sketch, method_string
|
211
209
|
end
|
212
210
|
end
|
213
|
-
|
211
|
+
|
214
212
|
def tear_down
|
215
|
-
@
|
213
|
+
@propane_sketch = nil?
|
216
214
|
end
|
217
215
|
end
|
data/test/test_helper.rb
CHANGED
data/test/vecmath_spec_test.rb
CHANGED
data/vendors/Rakefile
CHANGED
@@ -9,7 +9,7 @@ SOUND = 'sound.zip'.freeze
|
|
9
9
|
SOUND_VERSION = 'v1.3.2' # version 1.3.2
|
10
10
|
VIDEO = 'video-2.zip'
|
11
11
|
VIDEO_VERSION = '2' # version 1.0.1
|
12
|
-
EXAMPLES = '1.
|
12
|
+
EXAMPLES = '1.2'.freeze
|
13
13
|
HOME_DIR = ENV['HOME']
|
14
14
|
MAC_OR_LINUX = /linux|mac|darwin/ =~ RbConfig::CONFIG['host_os']
|
15
15
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: propane
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- monkstone
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: arcball
|
@@ -45,7 +45,7 @@ files:
|
|
45
45
|
- Rakefile
|
46
46
|
- bin/propane
|
47
47
|
- lib/PROCESSING_LICENSE.txt
|
48
|
-
- lib/core-3.3.
|
48
|
+
- lib/core-3.3.1.jar
|
49
49
|
- lib/export.txt
|
50
50
|
- lib/gluegen-rt-2.3.2-natives-linux-amd64.jar
|
51
51
|
- lib/gluegen-rt-2.3.2-natives-macosx-universal.jar
|
@@ -104,13 +104,10 @@ files:
|
|
104
104
|
- src/monkstone/videoevent/package-info.java
|
105
105
|
- test/create_test.rb
|
106
106
|
- test/deglut_spec_test.rb
|
107
|
+
- test/helper_methods_test.rb
|
107
108
|
- test/math_tool_test.rb
|
108
109
|
- test/respond_to_test.rb
|
109
|
-
- test/test_create.rb
|
110
|
-
- test/test_deglut_spec.rb
|
111
110
|
- test/test_helper.rb
|
112
|
-
- test/test_math_tool.rb
|
113
|
-
- test/test_respond_to.rb
|
114
111
|
- test/vecmath_spec_test.rb
|
115
112
|
- vendors/Rakefile
|
116
113
|
homepage: https://ruby-processing.github.io/propane/
|
@@ -134,18 +131,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
131
|
version: '0'
|
135
132
|
requirements: []
|
136
133
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.6.
|
134
|
+
rubygems_version: 2.6.11
|
138
135
|
signing_key:
|
139
136
|
specification_version: 4
|
140
|
-
summary: ruby wrapper for processing-3.3 on MacOS and linux64 bit only for opengl
|
137
|
+
summary: ruby wrapper for processing-3.3.1 on MacOS and linux64 bit only for opengl
|
141
138
|
test_files:
|
142
139
|
- test/create_test.rb
|
143
140
|
- test/deglut_spec_test.rb
|
141
|
+
- test/helper_methods_test.rb
|
144
142
|
- test/math_tool_test.rb
|
145
143
|
- test/respond_to_test.rb
|
146
|
-
- test/test_create.rb
|
147
|
-
- test/test_deglut_spec.rb
|
148
144
|
- test/test_helper.rb
|
149
|
-
- test/test_math_tool.rb
|
150
|
-
- test/test_respond_to.rb
|
151
145
|
- test/vecmath_spec_test.rb
|
data/test/test_create.rb
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require_relative 'test_helper'
|
3
|
-
|
4
|
-
|
5
|
-
require_relative '../lib/propane/creators/sketch_class'
|
6
|
-
|
7
|
-
CLASS_SKETCH = <<~CODE
|
8
|
-
# frozen_string_literal: false
|
9
|
-
require 'propane'
|
10
|
-
|
11
|
-
class FredSketch < Propane::App
|
12
|
-
def settings
|
13
|
-
size 200, 200
|
14
|
-
end
|
15
|
-
|
16
|
-
def setup
|
17
|
-
sketch_title 'Fred Sketch'
|
18
|
-
end
|
19
|
-
|
20
|
-
def draw
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
FredSketch.new
|
26
|
-
|
27
|
-
CODE
|
28
|
-
|
29
|
-
BARE_SKETCH = <<~CODE
|
30
|
-
def settings
|
31
|
-
size 200, 200, P2D
|
32
|
-
end
|
33
|
-
|
34
|
-
def setup
|
35
|
-
sketch_title 'Fred Sketch'
|
36
|
-
end
|
37
|
-
|
38
|
-
def draw
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
CODE
|
43
|
-
|
44
|
-
class SketchClassTest < Minitest::Test
|
45
|
-
|
46
|
-
def setup
|
47
|
-
@basic = SketchClass.new(name: 'fred_sketch', width: 200, height: 200)
|
48
|
-
@sketch = SketchClass.new(name: 'fred_sketch', width: 200, height: 200, mode: 'p2d')
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_class
|
52
|
-
result = CLASS_SKETCH.split(/\n/, -1)
|
53
|
-
class_lines = @sketch.lines
|
54
|
-
class_lines.each_with_index do |line, i|
|
55
|
-
assert_equal result[i], line
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_indent
|
60
|
-
assert_equal ' indent', @sketch.indent('indent')
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_size
|
64
|
-
assert_equal ' size 200, 200, P2D', @sketch.size
|
65
|
-
assert_equal ' size 200, 200', @basic.size
|
66
|
-
end
|
67
|
-
|
68
|
-
def test_sketch_title
|
69
|
-
assert_equal " sketch_title 'Fred Sketch'", @sketch.sketch_title
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_class
|
73
|
-
assert_equal "FredSketch", @sketch.sketch_class
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_class_new
|
77
|
-
assert_equal "FredSketch.new", @sketch.sketch_new
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_method_lines
|
81
|
-
result = CLASS_SKETCH.split(/\n/, -1)
|
82
|
-
@basic.method_lines('settings', @basic.size).each_with_index do |line, i|
|
83
|
-
assert_equal result[i + 4], line
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
|
88
|
-
def test_sketch_class
|
89
|
-
assert_equal "class FredSketch < Propane::App", @basic.class_sketch
|
90
|
-
end
|
91
|
-
end
|
data/test/test_deglut_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require_relative 'test_helper'
|
3
|
-
|
4
|
-
Java::Monkstone::PropaneLibrary.load(JRuby.runtime)
|
5
|
-
|
6
|
-
Dir.chdir(File.dirname(__FILE__))
|
7
|
-
|
8
|
-
class DeglutTest < Minitest::Test
|
9
|
-
attr_reader :to_radian
|
10
|
-
|
11
|
-
def setup
|
12
|
-
@to_radian = Math::PI / 180
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_cos_sin
|
16
|
-
(-720..720).step(1) do |deg|
|
17
|
-
sine = DegLut.sin(deg)
|
18
|
-
deg_sin = Math.sin(deg * to_radian)
|
19
|
-
assert_in_delta(sine, deg_sin, delta = 0.000001)
|
20
|
-
cosine = DegLut.cos(deg)
|
21
|
-
deg_cos = Math.cos(deg * to_radian)
|
22
|
-
assert_in_delta(cosine, deg_cos, delta = 0.000001)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/test/test_math_tool.rb
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require_relative 'test_helper'
|
3
|
-
|
4
|
-
Java::Monkstone::PropaneLibrary.new.load(JRuby.runtime, false)
|
5
|
-
|
6
|
-
Dir.chdir(File.dirname(__FILE__))
|
7
|
-
|
8
|
-
class MathToolTest < Minitest::Test
|
9
|
-
include MathTool
|
10
|
-
def test_map1d
|
11
|
-
x = [0, 5, 7.5, 10]
|
12
|
-
range1 = (0..10)
|
13
|
-
range2 = (100..1)
|
14
|
-
range3 = (0..10)
|
15
|
-
range4 = (5..105)
|
16
|
-
assert_in_delta(map1d(x[0], range1, range2), 100, delta = 0.00001, msg = 'map to first')
|
17
|
-
assert_in_delta(map1d(x[1], range1, range2), 50.5, delta = 0.00001, msg = 'map to reversed intermediate')
|
18
|
-
assert_in_delta(map1d(x[2], range3, range4), 80.0, delta = 0.00001, msg = 'map to intermediate')
|
19
|
-
assert_in_delta(map1d(x[3], range1, range2), 1, delta = 0.00001, msg = 'map to last')
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_p5map # as map1d except not using range input
|
23
|
-
x = [0, 5, 7.5, 10]
|
24
|
-
range1 = (0..10)
|
25
|
-
range2 = (100..1)
|
26
|
-
range3 = (0..10)
|
27
|
-
range4 = (5..105)
|
28
|
-
assert_in_delta(p5map(x[0], range1.first, range1.last, range2.first, range2.last), 100, delta = 0.00001)
|
29
|
-
assert_in_delta(p5map(x[1], range1.first, range1.last, range2.first, range2.last), 50.5, delta = 0.00001)
|
30
|
-
assert_in_delta(p5map(x[2], range3.first, range3.last, range4.first, range4.last), 80.0, delta = 0.00001)
|
31
|
-
assert_in_delta(p5map(x[3], range1.first, range1.last, range2.first, range2.last), 1, delta = 0.00001)
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_norm
|
35
|
-
x = [10, 140, 210]
|
36
|
-
start0, last0 = 30, 200
|
37
|
-
start_int, last_int = 0, 200
|
38
|
-
assert_in_delta(norm(x[0], start0, last0), -0.11764705882352941, delta = 0.00001, msg = 'unclamped map')
|
39
|
-
assert_in_delta(norm(x[1], start_int, last_int), 0.7, delta = 0.00001, msg = 'map to intermediate')
|
40
|
-
assert_in_delta(norm(x[2], start_int, last_int), 1.05, delta = 0.00001, msg = 'unclamped map')
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_norm_strict
|
44
|
-
x = [10, 140, 210]
|
45
|
-
assert_in_delta(norm_strict(x[2], x[0], x[1]), 1.0, delta = 0.00001, msg = 'clamped map to 0..1.0')
|
46
|
-
assert_in_delta(norm_strict(x[2], x[1], x[0]), 0.0, delta = 0.00001, msg = 'clamped map to 0..1.0')
|
47
|
-
assert_in_delta(norm_strict(x[1], x[0], x[2]), 0.65, delta = 0.00001, msg = 'clamped map to 0..1.0')
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_lerp # behaviour is deliberately different to processing which is unclamped
|
51
|
-
x = [0.5, 0.8, 2.0]
|
52
|
-
start0, last0 = 300, 200
|
53
|
-
start_int, last_int = 0, 200
|
54
|
-
assert_in_delta(lerp(start0, last0, x[0]), 250, delta = 0.00001, msg = 'produces a intermediate value of a reversed range')
|
55
|
-
assert_in_delta(lerp(start_int, last_int, x[1]), 160, delta = 0.00001, msg = 'lerps to an intermediate value')
|
56
|
-
assert_in_delta(lerp(start_int, last_int, x[2]), 200, delta = 0.00001, msg = 'lerps to the last value of a range')
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_constrain
|
60
|
-
x_int = [15, 2_500, -2_500]
|
61
|
-
start_int, last_int = 0, 200
|
62
|
-
assert_in_delta(constrain(x_int[0], start_int, last_int), 15, delta = 0.00001)
|
63
|
-
assert_in_delta(constrain(x_int[1], start_int, last_int), 200, delta = 0.00001)
|
64
|
-
assert_in_delta(constrain(x_int[2], start_int, last_int), 0, delta = 0.00001)
|
65
|
-
xf = [15.0, 2_500.0, -2_500.0]
|
66
|
-
startf, lastf = 0, 200.0
|
67
|
-
assert_in_delta(constrain(xf[0], startf, lastf), 15.0, delta = 0.00001, msg = 'constrain to 0..200')
|
68
|
-
assert_in_delta(constrain(xf[1], startf, lastf), 200.0, delta = 0.00001, msg = 'constrain to 0..200')
|
69
|
-
assert_in_delta(constrain(xf[2], startf, lastf), 0.0, delta = 0.00001, msg = 'constrain to 0..200')
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_grid_one
|
73
|
-
array = []
|
74
|
-
grid(100, 100) { |x, y| array << [x, y] }
|
75
|
-
assert array[0].include?(0)
|
76
|
-
assert array[98].include?(0)
|
77
|
-
assert_equal array.length, 10_000
|
78
|
-
assert array[50].include?(50)
|
79
|
-
end
|
80
|
-
|
81
|
-
def test_grid_ten
|
82
|
-
array = []
|
83
|
-
grid(100, 100, 10, 10) { |x, y| array << [x, y] }
|
84
|
-
assert array[0].include?(0)
|
85
|
-
assert array[9].include?(90)
|
86
|
-
assert_equal array.length, 100
|
87
|
-
assert array[5].include?(50)
|
88
|
-
end
|
89
|
-
end
|
data/test/test_respond_to.rb
DELETED
@@ -1,213 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require_relative 'test_helper'
|
3
|
-
|
4
|
-
METHODS = %i(
|
5
|
-
alpha
|
6
|
-
ambient
|
7
|
-
ambient_light
|
8
|
-
apply_matrix
|
9
|
-
arc
|
10
|
-
background
|
11
|
-
begin_camera
|
12
|
-
begin_contour
|
13
|
-
begin_raw
|
14
|
-
begin_record
|
15
|
-
begin_shape
|
16
|
-
bezier
|
17
|
-
bezier_detail
|
18
|
-
bezier_point
|
19
|
-
bezier_tangent
|
20
|
-
bezier_vertex
|
21
|
-
blend
|
22
|
-
blend_mode
|
23
|
-
blue
|
24
|
-
box
|
25
|
-
brightness
|
26
|
-
camera
|
27
|
-
color
|
28
|
-
color_mode
|
29
|
-
copy
|
30
|
-
create_font
|
31
|
-
create_graphics
|
32
|
-
create_image
|
33
|
-
create_input
|
34
|
-
create_output
|
35
|
-
create_reader
|
36
|
-
create_shape
|
37
|
-
create_writer
|
38
|
-
cursor
|
39
|
-
curve
|
40
|
-
curve_detail
|
41
|
-
curve_point
|
42
|
-
curve_tangent
|
43
|
-
curve_tightness
|
44
|
-
curve_vertex
|
45
|
-
directional_light
|
46
|
-
ellipse
|
47
|
-
ellipse_mode
|
48
|
-
emissive
|
49
|
-
end_camera
|
50
|
-
end_contour
|
51
|
-
end_raw
|
52
|
-
end_record
|
53
|
-
end_shape
|
54
|
-
fill
|
55
|
-
filter
|
56
|
-
focused
|
57
|
-
frame_count
|
58
|
-
frame_rate
|
59
|
-
frame_rate
|
60
|
-
frustum
|
61
|
-
get
|
62
|
-
green
|
63
|
-
height
|
64
|
-
hue
|
65
|
-
image
|
66
|
-
image_mode
|
67
|
-
key
|
68
|
-
key_code
|
69
|
-
key_pressed
|
70
|
-
key_pressed?
|
71
|
-
key_released
|
72
|
-
key_typed
|
73
|
-
lerp_color
|
74
|
-
light_falloff
|
75
|
-
light_specular
|
76
|
-
lights
|
77
|
-
line
|
78
|
-
load_bytes
|
79
|
-
load_font
|
80
|
-
load_image
|
81
|
-
load_pixels
|
82
|
-
load_shader
|
83
|
-
load_shape
|
84
|
-
load_strings
|
85
|
-
load_table
|
86
|
-
load_xml
|
87
|
-
model_x
|
88
|
-
model_y
|
89
|
-
model_z
|
90
|
-
mouse_button
|
91
|
-
mouse_clicked
|
92
|
-
mouse_dragged
|
93
|
-
mouse_moved
|
94
|
-
mouse_pressed
|
95
|
-
mouse_pressed?
|
96
|
-
mouse_released
|
97
|
-
mouse_x
|
98
|
-
mouse_y
|
99
|
-
no_cursor
|
100
|
-
no_fill
|
101
|
-
no_lights
|
102
|
-
no_smooth
|
103
|
-
no_stroke
|
104
|
-
no_tint
|
105
|
-
noise
|
106
|
-
noise_detail
|
107
|
-
noise_seed
|
108
|
-
normal
|
109
|
-
ortho
|
110
|
-
perspective
|
111
|
-
pixels
|
112
|
-
pmouse_x
|
113
|
-
pmouse_y
|
114
|
-
point
|
115
|
-
point_light
|
116
|
-
pop_matrix
|
117
|
-
print_camera
|
118
|
-
print_matrix
|
119
|
-
print_projection
|
120
|
-
push_matrix
|
121
|
-
quad
|
122
|
-
quadratic_vertex
|
123
|
-
random
|
124
|
-
random_seed
|
125
|
-
rect
|
126
|
-
rect_mode
|
127
|
-
red
|
128
|
-
request_image
|
129
|
-
reset_matrix
|
130
|
-
reset_shader
|
131
|
-
rotate
|
132
|
-
rotate_x
|
133
|
-
rotate_y
|
134
|
-
rotate_z
|
135
|
-
saturation
|
136
|
-
save
|
137
|
-
save_bytes
|
138
|
-
save_frame
|
139
|
-
save_stream
|
140
|
-
save_strings
|
141
|
-
scale
|
142
|
-
screen_x
|
143
|
-
screen_y
|
144
|
-
screen_z
|
145
|
-
select_folder
|
146
|
-
select_input
|
147
|
-
select_output
|
148
|
-
set
|
149
|
-
shader
|
150
|
-
shape
|
151
|
-
shape_mode
|
152
|
-
shear_x
|
153
|
-
shear_y
|
154
|
-
shininess
|
155
|
-
sketch_title
|
156
|
-
size
|
157
|
-
smooth
|
158
|
-
specular
|
159
|
-
sphere
|
160
|
-
sphere_detail
|
161
|
-
spot_light
|
162
|
-
stroke
|
163
|
-
stroke_cap
|
164
|
-
stroke_join
|
165
|
-
stroke_weight
|
166
|
-
text_align
|
167
|
-
text_ascent
|
168
|
-
text_descent
|
169
|
-
text_font
|
170
|
-
text_leading
|
171
|
-
text_mode
|
172
|
-
text_size
|
173
|
-
text_width
|
174
|
-
texture
|
175
|
-
texture_mode
|
176
|
-
texture_wrap
|
177
|
-
tint
|
178
|
-
translate
|
179
|
-
triangle
|
180
|
-
update_pixels
|
181
|
-
vertex
|
182
|
-
width
|
183
|
-
)
|
184
|
-
|
185
|
-
class TestSketch < Propane::App
|
186
|
-
def settings
|
187
|
-
size 100, 100
|
188
|
-
end
|
189
|
-
|
190
|
-
def setup
|
191
|
-
sketch_title 'Sketch Test'
|
192
|
-
end
|
193
|
-
|
194
|
-
def draw
|
195
|
-
exit if frame_count > 30
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
class SpecTest < Minitest::Test
|
200
|
-
def setup
|
201
|
-
@processing_sketch = TestSketch.new
|
202
|
-
end
|
203
|
-
|
204
|
-
def test_respond
|
205
|
-
METHODS.each do |method_string|
|
206
|
-
assert_respond_to @processing_sketch, method_string
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
def tear_down
|
211
|
-
@processing_sketch = nil?
|
212
|
-
end
|
213
|
-
end
|