obj 0.0.1 → 0.0.2
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/README.md +4 -2
- data/Rakefile +9 -1
- data/bin/obj-parse +1 -1
- data/lib/obj.rb +31 -27
- data/lib/obj/version.rb +1 -1
- data/obj.gemspec +1 -1
- data/test/good.obj +1832 -0
- data/test/good.simple.obj +1083 -0
- data/test/sphere.obj +1834 -0
- data/test/test_helper.rb +1 -0
- data/test/test_mesh_initialization.rb +27 -0
- data/test/test_mesh_parsing.rb +56 -0
- metadata +16 -4
data/test/test_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + '/../lib')
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
require 'obj'
|
5
|
+
|
6
|
+
class TestMeshInitialization < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@good_file = File.expand_path(File.dirname(__FILE__) + '/good.obj')
|
10
|
+
@non_existent_file = File.expand_path(File.dirname(__FILE__) + '/non_existent.obj')
|
11
|
+
end
|
12
|
+
|
13
|
+
def teardown
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_good_file
|
17
|
+
assert_nothing_raised do
|
18
|
+
OBJ::Mesh.new(@good_file)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_non_existent_file
|
23
|
+
assert_raise Errno::ENOENT do
|
24
|
+
OBJ::Mesh.new(@non_existent_file)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
require 'obj'
|
5
|
+
|
6
|
+
class TestMeshParsing < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@file = File.expand_path(File.dirname(__FILE__) + '/good.obj')
|
10
|
+
@mesh = OBJ::Mesh.new(@file)
|
11
|
+
@vertices_size = 362
|
12
|
+
@normals_size = 362
|
13
|
+
@text_coords_size = 387
|
14
|
+
@faces_size = 720
|
15
|
+
|
16
|
+
@simple_file = File.expand_path(File.dirname(__FILE__) + '/good.simple.obj')
|
17
|
+
@simple_mesh = OBJ::Mesh.new(@simple_file)
|
18
|
+
@simple_vertices_size = 362
|
19
|
+
@simple_normals_size = 0
|
20
|
+
@simple_text_coords_size = 0
|
21
|
+
@simple_faces_size = 720
|
22
|
+
end
|
23
|
+
|
24
|
+
def teardown
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_vertices_size
|
28
|
+
assert_equal @vertices_size, @mesh.vertices.size
|
29
|
+
assert_equal @simple_vertices_size, @simple_mesh.vertices.size
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_normals_size
|
33
|
+
assert_equal @normals_size, @mesh.normals.size
|
34
|
+
assert_equal @simple_normals_size, @simple_mesh.normals.size
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_text_coords_size
|
38
|
+
assert_equal @text_coords_size, @mesh.text_coords.size
|
39
|
+
assert_equal @simple_text_coords_size, @simple_mesh.text_coords.size
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_faces_size
|
43
|
+
assert_equal @faces_size, @mesh.faces.size
|
44
|
+
assert_equal @simple_faces_size, @simple_mesh.faces.size
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_normals?
|
48
|
+
assert_equal true, @mesh.normals?
|
49
|
+
assert_equal false, @simple_mesh.normals?
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_text_coords?
|
53
|
+
assert_equal true, @mesh.text_coords?
|
54
|
+
assert_equal false, @simple_mesh.text_coords?
|
55
|
+
end
|
56
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: obj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ignacio Contreras Pinilla
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -55,6 +55,12 @@ files:
|
|
55
55
|
- lib/obj.rb
|
56
56
|
- lib/obj/version.rb
|
57
57
|
- obj.gemspec
|
58
|
+
- test/good.obj
|
59
|
+
- test/good.simple.obj
|
60
|
+
- test/sphere.obj
|
61
|
+
- test/test_helper.rb
|
62
|
+
- test/test_mesh_initialization.rb
|
63
|
+
- test/test_mesh_parsing.rb
|
58
64
|
homepage: https://github.com/iconpin/obj
|
59
65
|
licenses:
|
60
66
|
- MIT
|
@@ -78,5 +84,11 @@ rubyforge_project:
|
|
78
84
|
rubygems_version: 2.2.2
|
79
85
|
signing_key:
|
80
86
|
specification_version: 4
|
81
|
-
summary: Simple OBJ (wavefront) file utils
|
82
|
-
test_files:
|
87
|
+
summary: Simple OBJ (wavefront model format) file utils
|
88
|
+
test_files:
|
89
|
+
- test/good.obj
|
90
|
+
- test/good.simple.obj
|
91
|
+
- test/sphere.obj
|
92
|
+
- test/test_helper.rb
|
93
|
+
- test/test_mesh_initialization.rb
|
94
|
+
- test/test_mesh_parsing.rb
|