panmind-rtf 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +8 -0
- data/LICENSE +20 -0
- data/README +186 -0
- data/Rakefile +48 -0
- data/VERSION.yml +5 -0
- data/examples/example01.rb +51 -0
- data/examples/example02.rb +45 -0
- data/examples/example03.rb +66 -0
- data/examples/example03.rtf +164 -0
- data/examples/example04.rb +50 -0
- data/examples/rubyrtf.bmp +0 -0
- data/examples/rubyrtf.jpg +0 -0
- data/examples/rubyrtf.png +0 -0
- data/lib/rtf.rb +34 -0
- data/lib/rtf/colour.rb +173 -0
- data/lib/rtf/font.rb +173 -0
- data/lib/rtf/information.rb +111 -0
- data/lib/rtf/node.rb +1680 -0
- data/lib/rtf/paper.rb +55 -0
- data/lib/rtf/style.rb +305 -0
- data/test/character_style_test.rb +136 -0
- data/test/colour_table_test.rb +93 -0
- data/test/colour_test.rb +116 -0
- data/test/command_node_test.rb +219 -0
- data/test/container_node_test.rb +64 -0
- data/test/document_style_test.rb +79 -0
- data/test/document_test.rb +106 -0
- data/test/fixtures/bitmap1.bmp +0 -0
- data/test/fixtures/bitmap2.bmp +0 -0
- data/test/fixtures/jpeg1.jpg +0 -0
- data/test/fixtures/jpeg2.jpg +0 -0
- data/test/fixtures/png1.png +0 -0
- data/test/fixtures/png2.png +0 -0
- data/test/font_table_test.rb +91 -0
- data/test/font_test.rb +48 -0
- data/test/footer_node_test.rb +30 -0
- data/test/header_node_test.rb +30 -0
- data/test/image_node_test.rb +125 -0
- data/test/information_test.rb +127 -0
- data/test/node_test.rb +25 -0
- data/test/paragraph_style_test.rb +81 -0
- data/test/style_test.rb +16 -0
- data/test/table_cell_node_test.rb +89 -0
- data/test/table_node_test.rb +83 -0
- data/test/table_row_node_test.rb +59 -0
- data/test/test_helper.rb +13 -0
- data/test/text_node_test.rb +50 -0
- metadata +133 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
|
+
require 'rtf'
|
6
|
+
include RTF
|
7
|
+
|
8
|
+
class Test::Unit::TestCase
|
9
|
+
|
10
|
+
def fixture_file_path(filename)
|
11
|
+
File.join(File.dirname(__FILE__), "fixtures", filename)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
# Information class unit test class.
|
4
|
+
class TextNodeTest < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
@node = Node.new(nil)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test01
|
10
|
+
nodes = []
|
11
|
+
nodes.push(TextNode.new(@node))
|
12
|
+
nodes.push(TextNode.new(@node, 'Node 2'))
|
13
|
+
nodes.push(TextNode.new(@node))
|
14
|
+
nodes.push(TextNode.new(@node, ''))
|
15
|
+
|
16
|
+
assert(nodes[0].text == nil)
|
17
|
+
assert(nodes[1].text == 'Node 2')
|
18
|
+
assert(nodes[2].text == nil)
|
19
|
+
assert(nodes[3].text == '')
|
20
|
+
|
21
|
+
nodes[0].text = 'This is the altered text for node 1.'
|
22
|
+
assert(nodes[0].text == 'This is the altered text for node 1.')
|
23
|
+
|
24
|
+
nodes[1].append('La la la')
|
25
|
+
nodes[2].append('La la la')
|
26
|
+
assert(nodes[1].text == 'Node 2La la la')
|
27
|
+
assert(nodes[2].text == 'La la la')
|
28
|
+
|
29
|
+
nodes[2].text = nil
|
30
|
+
nodes[1].insert(' - ', 6)
|
31
|
+
nodes[2].insert('TEXT', 2)
|
32
|
+
assert(nodes[1].text == 'Node 2 - La la la')
|
33
|
+
assert(nodes[2].text == 'TEXT')
|
34
|
+
|
35
|
+
nodes[2].text = nil
|
36
|
+
nodes[3].text = '{\}'
|
37
|
+
assert(nodes[0].to_rtf == 'This is the altered text for node 1.')
|
38
|
+
assert(nodes[1].to_rtf == 'Node 2 - La la la')
|
39
|
+
assert(nodes[2].to_rtf == '')
|
40
|
+
assert(nodes[3].to_rtf == '\{\\\}')
|
41
|
+
end
|
42
|
+
|
43
|
+
def test02
|
44
|
+
begin
|
45
|
+
TextNode.new(nil)
|
46
|
+
flunk('Successfully created a TextNode with a nil parent.')
|
47
|
+
rescue => error
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: panmind-rtf
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 3
|
8
|
+
- 1
|
9
|
+
version: 0.3.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Peter Wood
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-09-14 00:00:00 +02:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Ruby RTF is a library that can be used to create rich text format (RTF) documents. RTF is a text based standard for laying out document content.
|
22
|
+
email: marcello.barnaba@gmail.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- LICENSE
|
29
|
+
- README
|
30
|
+
files:
|
31
|
+
- CHANGES
|
32
|
+
- LICENSE
|
33
|
+
- README
|
34
|
+
- Rakefile
|
35
|
+
- VERSION.yml
|
36
|
+
- examples/example01.rb
|
37
|
+
- examples/example02.rb
|
38
|
+
- examples/example03.rb
|
39
|
+
- examples/example03.rtf
|
40
|
+
- examples/example04.rb
|
41
|
+
- examples/rubyrtf.bmp
|
42
|
+
- examples/rubyrtf.jpg
|
43
|
+
- examples/rubyrtf.png
|
44
|
+
- lib/rtf.rb
|
45
|
+
- lib/rtf/colour.rb
|
46
|
+
- lib/rtf/font.rb
|
47
|
+
- lib/rtf/information.rb
|
48
|
+
- lib/rtf/node.rb
|
49
|
+
- lib/rtf/paper.rb
|
50
|
+
- lib/rtf/style.rb
|
51
|
+
- test/character_style_test.rb
|
52
|
+
- test/colour_table_test.rb
|
53
|
+
- test/colour_test.rb
|
54
|
+
- test/command_node_test.rb
|
55
|
+
- test/container_node_test.rb
|
56
|
+
- test/document_style_test.rb
|
57
|
+
- test/document_test.rb
|
58
|
+
- test/fixtures/bitmap1.bmp
|
59
|
+
- test/fixtures/bitmap2.bmp
|
60
|
+
- test/fixtures/jpeg1.jpg
|
61
|
+
- test/fixtures/jpeg2.jpg
|
62
|
+
- test/fixtures/png1.png
|
63
|
+
- test/fixtures/png2.png
|
64
|
+
- test/font_table_test.rb
|
65
|
+
- test/font_test.rb
|
66
|
+
- test/footer_node_test.rb
|
67
|
+
- test/header_node_test.rb
|
68
|
+
- test/image_node_test.rb
|
69
|
+
- test/information_test.rb
|
70
|
+
- test/node_test.rb
|
71
|
+
- test/paragraph_style_test.rb
|
72
|
+
- test/style_test.rb
|
73
|
+
- test/table_cell_node_test.rb
|
74
|
+
- test/table_node_test.rb
|
75
|
+
- test/table_row_node_test.rb
|
76
|
+
- test/test_helper.rb
|
77
|
+
- test/text_node_test.rb
|
78
|
+
has_rdoc: true
|
79
|
+
homepage: http://github.com/Panmind/rtf
|
80
|
+
licenses: []
|
81
|
+
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options:
|
84
|
+
- --charset=UTF-8
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
segments:
|
92
|
+
- 0
|
93
|
+
version: "0"
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
segments:
|
99
|
+
- 0
|
100
|
+
version: "0"
|
101
|
+
requirements: []
|
102
|
+
|
103
|
+
rubyforge_project:
|
104
|
+
rubygems_version: 1.3.6
|
105
|
+
signing_key:
|
106
|
+
specification_version: 3
|
107
|
+
summary: Ruby library to create rich text format documents.
|
108
|
+
test_files:
|
109
|
+
- test/character_style_test.rb
|
110
|
+
- test/colour_table_test.rb
|
111
|
+
- test/colour_test.rb
|
112
|
+
- test/command_node_test.rb
|
113
|
+
- test/container_node_test.rb
|
114
|
+
- test/document_style_test.rb
|
115
|
+
- test/document_test.rb
|
116
|
+
- test/font_table_test.rb
|
117
|
+
- test/font_test.rb
|
118
|
+
- test/footer_node_test.rb
|
119
|
+
- test/header_node_test.rb
|
120
|
+
- test/image_node_test.rb
|
121
|
+
- test/information_test.rb
|
122
|
+
- test/node_test.rb
|
123
|
+
- test/paragraph_style_test.rb
|
124
|
+
- test/style_test.rb
|
125
|
+
- test/table_cell_node_test.rb
|
126
|
+
- test/table_node_test.rb
|
127
|
+
- test/table_row_node_test.rb
|
128
|
+
- test/test_helper.rb
|
129
|
+
- test/text_node_test.rb
|
130
|
+
- examples/example01.rb
|
131
|
+
- examples/example02.rb
|
132
|
+
- examples/example03.rb
|
133
|
+
- examples/example04.rb
|