thechrisoshow-ruby-rtf 0.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.
- data/VERSION.yml +4 -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 +112 -0
- data/lib/rtf/node.rb +1659 -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 +214 -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 +124 -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 +90 -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,90 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: thechrisoshow-ruby-rtf
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.2.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Peter Wood
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
|
|
12
|
+
date: 2009-02-23 00:00:00 -08:00
|
|
13
|
+
default_executable:
|
|
14
|
+
dependencies: []
|
|
15
|
+
|
|
16
|
+
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.
|
|
17
|
+
email: paw220470@yahoo.ie
|
|
18
|
+
executables: []
|
|
19
|
+
|
|
20
|
+
extensions: []
|
|
21
|
+
|
|
22
|
+
extra_rdoc_files: []
|
|
23
|
+
|
|
24
|
+
files:
|
|
25
|
+
- VERSION.yml
|
|
26
|
+
- lib/rtf
|
|
27
|
+
- lib/rtf/colour.rb
|
|
28
|
+
- lib/rtf/font.rb
|
|
29
|
+
- lib/rtf/information.rb
|
|
30
|
+
- lib/rtf/node.rb
|
|
31
|
+
- lib/rtf/paper.rb
|
|
32
|
+
- lib/rtf/style.rb
|
|
33
|
+
- lib/rtf.rb
|
|
34
|
+
- test/character_style_test.rb
|
|
35
|
+
- test/colour_table_test.rb
|
|
36
|
+
- test/colour_test.rb
|
|
37
|
+
- test/command_node_test.rb
|
|
38
|
+
- test/container_node_test.rb
|
|
39
|
+
- test/document_style_test.rb
|
|
40
|
+
- test/document_test.rb
|
|
41
|
+
- test/fixtures
|
|
42
|
+
- test/fixtures/bitmap1.bmp
|
|
43
|
+
- test/fixtures/bitmap2.bmp
|
|
44
|
+
- test/fixtures/jpeg1.jpg
|
|
45
|
+
- test/fixtures/jpeg2.jpg
|
|
46
|
+
- test/fixtures/png1.png
|
|
47
|
+
- test/fixtures/png2.png
|
|
48
|
+
- test/font_table_test.rb
|
|
49
|
+
- test/font_test.rb
|
|
50
|
+
- test/footer_node_test.rb
|
|
51
|
+
- test/header_node_test.rb
|
|
52
|
+
- test/image_node_test.rb
|
|
53
|
+
- test/information_test.rb
|
|
54
|
+
- test/node_test.rb
|
|
55
|
+
- test/paragraph_style_test.rb
|
|
56
|
+
- test/style_test.rb
|
|
57
|
+
- test/table_cell_node_test.rb
|
|
58
|
+
- test/table_node_test.rb
|
|
59
|
+
- test/table_row_node_test.rb
|
|
60
|
+
- test/test_helper.rb
|
|
61
|
+
- test/text_node_test.rb
|
|
62
|
+
has_rdoc: true
|
|
63
|
+
homepage: http://github.com/thechrisoshow/ruby-rtf
|
|
64
|
+
post_install_message:
|
|
65
|
+
rdoc_options:
|
|
66
|
+
- --inline-source
|
|
67
|
+
- --charset=UTF-8
|
|
68
|
+
require_paths:
|
|
69
|
+
- lib
|
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: "0"
|
|
75
|
+
version:
|
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
|
+
requirements:
|
|
78
|
+
- - ">="
|
|
79
|
+
- !ruby/object:Gem::Version
|
|
80
|
+
version: "0"
|
|
81
|
+
version:
|
|
82
|
+
requirements: []
|
|
83
|
+
|
|
84
|
+
rubyforge_project:
|
|
85
|
+
rubygems_version: 1.2.0
|
|
86
|
+
signing_key:
|
|
87
|
+
specification_version: 2
|
|
88
|
+
summary: Ruby library to create rich text format documents.
|
|
89
|
+
test_files: []
|
|
90
|
+
|