qrencoder 1.0.0 → 1.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.
@@ -1,7 +0,0 @@
1
- History.txt
2
- Manifest.txt
3
- README.txt
4
- Rakefile
5
- bin/qrencoder
6
- lib/qrencoder.rb
7
- test/test_qrencoder.rb
data/Rakefile DELETED
@@ -1,19 +0,0 @@
1
- # -*- ruby -*-
2
-
3
- require 'rubygems'
4
- require 'hoe'
5
- require './lib/qrencoder.rb'
6
-
7
- Hoe.new('qrencoder', QRCode::GEM_VERSION) do |p|
8
- p.rubyforge_name = 'nycrb'
9
- p.author = 'Jacob Harris'
10
- p.email = 'harrisj@schizopolis.net'
11
- p.summary = 'A gem for creating 2-dimensional barcodes following the QR Code specification.'
12
- # p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
13
- p.url = 'http://nycrb.rubyforge.org/qrencoder'
14
- p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
15
- p.extra_deps << ['RubyInline', '>=3.6.2']
16
- p.extra_deps << ['png', '>=1.0.0']
17
- end
18
-
19
- # vim: syntax=Ruby
File without changes
@@ -1,99 +0,0 @@
1
- require 'rubygems'
2
- require 'inline'
3
- require 'enumerator'
4
- require 'test/unit' unless defined? $ZENTEST and $ZENTEST
5
- require './lib/qrencoder.rb'
6
-
7
- class TestQRCode < Test::Unit::TestCase
8
- inline do |builder|
9
- builder.add_link_flags "-lqrencode"
10
- builder.include '"qrencode.h"'
11
-
12
- builder.c <<-"END"
13
- VALUE test_img_data(const char *string, int version) {
14
- QRcode *code;
15
- VALUE out;
16
- int i, width;
17
- unsigned char *p;
18
-
19
- code = QRcode_encodeString(string, version, QR_ECLEVEL_L, QR_MODE_8);
20
-
21
- p = code->data;
22
- width = code->width;
23
- out = rb_ary_new2(width*width);
24
-
25
- for (i=0; i < width*width; i++) {
26
- unsigned char bit;
27
- bit = *p;
28
- rb_ary_push(out, INT2FIX(bit));
29
- p++;
30
- }
31
-
32
- return out;
33
- }
34
- END
35
- end
36
-
37
- def setup
38
- @q = QRCode.encode_string("hi", 1)
39
- end
40
-
41
- def test_class_encode_string
42
- assert_equal 1, @q.version
43
- assert_equal 21, @q.width
44
- end
45
-
46
- def test_class_encode_string_ex
47
- #raise NotImplementedError, 'Need to write test_class_encode_string_ex'
48
- end
49
-
50
- def test_data
51
- assert_equal test_img_data("hi", 1), @q.data
52
- end
53
-
54
- def test_height
55
- assert_equal @q.width, @q.height
56
- end
57
-
58
- def test_pixels
59
- arr = []
60
- test_img_data("hi", 1).each_slice(@q.width) do |a|
61
- arr << a.map { |p| p & 0x1 }
62
- end
63
-
64
- assert_equal arr, @q.pixels
65
- end
66
-
67
- def test_points
68
- arr = []
69
- y = 0
70
-
71
- test_img_data("hi", 1).each_slice(@q.width) do |r|
72
- x = 0;
73
-
74
- r.each do |p|
75
- if (p & 0x1) == 1
76
- arr << [x, y]
77
- end
78
-
79
- x += 1
80
- end
81
-
82
- y += 1
83
- end
84
-
85
- assert_equal arr, @q.points
86
- end
87
-
88
- # def test_save_png
89
- # raise NotImplementedError, 'Need to write test_save_png'
90
- # end
91
-
92
- def test_version
93
- assert_equal 1, @q.version
94
- end
95
-
96
- def test_width
97
- assert_equal 21, @q.width
98
- end
99
- end