kaka 1.0.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.
- checksums.yaml +7 -0
- data/README.md +66 -0
- data/ext/caca/caca-canvas.c +806 -0
- data/ext/caca/caca-canvas.h +22 -0
- data/ext/caca/caca-display.c +307 -0
- data/ext/caca/caca-display.h +21 -0
- data/ext/caca/caca-dither.c +209 -0
- data/ext/caca/caca-dither.h +21 -0
- data/ext/caca/caca-event.c +73 -0
- data/ext/caca/caca-event.h +29 -0
- data/ext/caca/caca-font.c +99 -0
- data/ext/caca/caca-font.h +21 -0
- data/ext/caca/caca.c +62 -0
- data/ext/caca/common.h +60 -0
- data/ext/caca/extconf.rb +43 -0
- data/lib/caca.rb +43 -0
- data/lib/caca/version.rb +3 -0
- data/test/canvas_test.rb +61 -0
- data/test/display_test.rb +35 -0
- data/test/dither_test.rb +41 -0
- data/test/font_test.rb +22 -0
- data/test/frame_test.rb +20 -0
- metadata +74 -0
data/lib/caca/version.rb
ADDED
data/test/canvas_test.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'caca'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
|
4
|
+
class CanvasTest < MiniTest::Test
|
5
|
+
def setup
|
6
|
+
@c = Caca::Canvas.new(3, 3)
|
7
|
+
end
|
8
|
+
def test_create
|
9
|
+
c = Caca::Canvas.new(3, 3)
|
10
|
+
refute_nil(c, 'Canvas creation failed')
|
11
|
+
assert(c.width == 3 && c.height == 3, 'Wrong size for new canvas')
|
12
|
+
end
|
13
|
+
def test_width
|
14
|
+
@c.width = 42
|
15
|
+
assert_equal(42, @c.width, 'Failed to set width with =')
|
16
|
+
@c.set_width(24)
|
17
|
+
assert_equal(24, @c.width, 'Failed to set width')
|
18
|
+
end
|
19
|
+
def test_height
|
20
|
+
@c.height = 42
|
21
|
+
assert_equal(42, @c.height, 'Failed to set height with =')
|
22
|
+
@c.set_height(24)
|
23
|
+
assert_equal(24, @c.height, 'Failed to set height')
|
24
|
+
end
|
25
|
+
def test_size
|
26
|
+
@c.set_size(100,100)
|
27
|
+
assert(@c.width == 100 && @c.height == 100, 'Failed to set size')
|
28
|
+
end
|
29
|
+
def test_import
|
30
|
+
@c.import_from_memory("foo", "")
|
31
|
+
assert_equal("foo\r\n", @c.export_to_memory("irc"), "Import/Export failed")
|
32
|
+
@c.import_area_from_memory(0, 0, "p", "")
|
33
|
+
assert_equal("poo\r\n", @c.export_area_to_memory(0, 0, 3, 1, "irc"), "Import/Export of area failed")
|
34
|
+
end
|
35
|
+
def test_cursor
|
36
|
+
@c.gotoxy(1,1)
|
37
|
+
assert_equal(1, @c.wherex)
|
38
|
+
assert_equal(1, @c.wherey)
|
39
|
+
end
|
40
|
+
def test_clear
|
41
|
+
@c.put_char(1, 1, 64)
|
42
|
+
@c.clear
|
43
|
+
assert_equal("", @c.export_to_memory("irc").strip, "Failed to clear canvas")
|
44
|
+
end
|
45
|
+
def test_char
|
46
|
+
@c.put_char(1, 1, 42)
|
47
|
+
assert_equal(42, @c.get_char(1,1))
|
48
|
+
end
|
49
|
+
def test_render
|
50
|
+
c = Caca::Canvas.new(4,4)
|
51
|
+
c.put_str(0,0,"plop")
|
52
|
+
f = Caca::Font.new(Caca::Font.list[0])
|
53
|
+
refute_nil(c.render(f, c.width*f.width, c.height*f.height, c.width*f.width*4))
|
54
|
+
end
|
55
|
+
def test_fail_render
|
56
|
+
c = Caca::Canvas.new(4,4)
|
57
|
+
assert_raises(ArgumentError) {
|
58
|
+
c.render(nil, c.width, c.height, c.width*4)
|
59
|
+
}
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'caca'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
|
4
|
+
class DisplayTest < MiniTest::Test
|
5
|
+
def test_create
|
6
|
+
d = Caca::Display.new()
|
7
|
+
refute_nil(d, 'Display creation failed')
|
8
|
+
end
|
9
|
+
def test_create_with_driver
|
10
|
+
d = Caca::Display.new(Caca::Display.driver_list[0])
|
11
|
+
refute_nil(d, 'Display creation failed')
|
12
|
+
end
|
13
|
+
def test_create_wrong_args
|
14
|
+
c = Caca::Canvas.new(3, 3)
|
15
|
+
assert_raises(RuntimeError){Caca::Display.new("plop")}
|
16
|
+
assert_raises(RuntimeError){Caca::Display.new(c, "plop")}
|
17
|
+
assert_raises(ArgumentError){Caca::Display.new("plop", "plop")}
|
18
|
+
assert_raises(ArgumentError){Caca::Display.new(c, c)}
|
19
|
+
end
|
20
|
+
def test_create_from_canvas
|
21
|
+
c = Caca::Canvas.new(3, 3)
|
22
|
+
d = Caca::Display.new(c)
|
23
|
+
refute_nil(d, 'Display creation failed')
|
24
|
+
assert_equal(d.canvas, c, 'Wrong canvas')
|
25
|
+
end
|
26
|
+
def test_set_title
|
27
|
+
c = Caca::Canvas.new(3, 3)
|
28
|
+
d = Caca::Display.new(c)
|
29
|
+
d.title = "Test !"
|
30
|
+
end
|
31
|
+
def test_set_cursor
|
32
|
+
d = Caca::Display.new()
|
33
|
+
d.cursor = 1
|
34
|
+
end
|
35
|
+
end
|
data/test/dither_test.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'caca'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
|
4
|
+
class DitherTest < MiniTest::Test
|
5
|
+
def test_create
|
6
|
+
d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
|
7
|
+
end
|
8
|
+
def test_fail_create
|
9
|
+
assert_raises(RuntimeError) {
|
10
|
+
d = Caca::Dither.new(-1, 32, 32, 32, 0, 0, 0, 0)
|
11
|
+
}
|
12
|
+
end
|
13
|
+
def test_set_palette
|
14
|
+
d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
|
15
|
+
d.palette=[[0xfff, 0xfff, 0xfff, 0xfff]]*256
|
16
|
+
end
|
17
|
+
def test_fail_set_palette
|
18
|
+
assert_raises(ArgumentError) {
|
19
|
+
d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
|
20
|
+
d.palette=[]
|
21
|
+
}
|
22
|
+
end
|
23
|
+
def test_fail_set_palette2
|
24
|
+
assert_raises(RuntimeError) {
|
25
|
+
d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
|
26
|
+
d.palette=[[0xffff, 0, 0, 0]]*256
|
27
|
+
}
|
28
|
+
end
|
29
|
+
def test_set_brightness
|
30
|
+
d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
|
31
|
+
d.brightness=0.5
|
32
|
+
end
|
33
|
+
def test_set_gamma
|
34
|
+
d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
|
35
|
+
d.gamma=0.5
|
36
|
+
end
|
37
|
+
def test_set_contrast
|
38
|
+
d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
|
39
|
+
d.contrast=0.5
|
40
|
+
end
|
41
|
+
end
|
data/test/font_test.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'caca'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
|
4
|
+
class FontTest < MiniTest::Test
|
5
|
+
def test_list
|
6
|
+
refute_nil(Caca::Font.list)
|
7
|
+
end
|
8
|
+
def test_load
|
9
|
+
Caca::Font.list.each{|f|
|
10
|
+
font = Caca::Font.new(f)
|
11
|
+
refute_nil(font)
|
12
|
+
refute_nil(font.width)
|
13
|
+
refute_nil(font.height)
|
14
|
+
refute_nil(font.blocks)
|
15
|
+
}
|
16
|
+
end
|
17
|
+
def test_fail_load
|
18
|
+
assert_raises(RuntimeError) {
|
19
|
+
Caca::Font.new("This font should not exist")
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|
data/test/frame_test.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'caca'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
|
4
|
+
class FrameTest < MiniTest::Test
|
5
|
+
def setup
|
6
|
+
@c = Caca::Canvas.new(3, 3)
|
7
|
+
end
|
8
|
+
def test_create
|
9
|
+
f = @c.create_frame(1)
|
10
|
+
assert(f, 'Frame creation failed')
|
11
|
+
@c.free_frame(1)
|
12
|
+
end
|
13
|
+
def test_name
|
14
|
+
f = @c.create_frame(1)
|
15
|
+
assert(@c.frame_name, 'Failed to get frame name')
|
16
|
+
@c.frame_name="test"
|
17
|
+
assert(@c.frame_name == "test", 'Failed to set frame name')
|
18
|
+
@c.free_frame(1)
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kaka
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tony Miller
|
8
|
+
- Pascal Terjan
|
9
|
+
- Sam Hocevar
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2013-06-16 00:00:00.000000000 Z
|
14
|
+
dependencies: []
|
15
|
+
description: libcaca is a graphics library that outputs text instead of pixels.
|
16
|
+
email:
|
17
|
+
- mcfiredrill@gmail.com
|
18
|
+
executables: []
|
19
|
+
extensions:
|
20
|
+
- ext/caca/extconf.rb
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- lib/caca.rb
|
24
|
+
- lib/caca/version.rb
|
25
|
+
- ext/caca/caca-event.c
|
26
|
+
- ext/caca/caca-display.c
|
27
|
+
- ext/caca/caca-font.c
|
28
|
+
- ext/caca/caca-canvas.c
|
29
|
+
- ext/caca/caca.c
|
30
|
+
- ext/caca/caca-dither.c
|
31
|
+
- ext/caca/caca-event.h
|
32
|
+
- ext/caca/caca-dither.h
|
33
|
+
- ext/caca/common.h
|
34
|
+
- ext/caca/caca-font.h
|
35
|
+
- ext/caca/caca-display.h
|
36
|
+
- ext/caca/caca-canvas.h
|
37
|
+
- ext/caca/extconf.rb
|
38
|
+
- README.md
|
39
|
+
- test/dither_test.rb
|
40
|
+
- test/canvas_test.rb
|
41
|
+
- test/frame_test.rb
|
42
|
+
- test/font_test.rb
|
43
|
+
- test/display_test.rb
|
44
|
+
homepage: http://caca.zoy.org/
|
45
|
+
licenses:
|
46
|
+
- WTFPL
|
47
|
+
metadata: {}
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options: []
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
requirements: []
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 2.0.3
|
65
|
+
signing_key:
|
66
|
+
specification_version: 4
|
67
|
+
summary: ruby bindings for libcaca
|
68
|
+
test_files:
|
69
|
+
- test/dither_test.rb
|
70
|
+
- test/canvas_test.rb
|
71
|
+
- test/frame_test.rb
|
72
|
+
- test/font_test.rb
|
73
|
+
- test/display_test.rb
|
74
|
+
has_rdoc:
|