clbustos-rtf 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/.gitignore +3 -0
  2. data/LICENSE +20 -0
  3. data/README +187 -0
  4. data/Rakefile +47 -0
  5. data/VERSION.yml +4 -0
  6. data/examples/example01.rb +51 -0
  7. data/examples/example02.rb +45 -0
  8. data/examples/example03.rb +66 -0
  9. data/examples/example03.rtf +164 -0
  10. data/examples/example04.rb +50 -0
  11. data/examples/rubyrtf.bmp +0 -0
  12. data/examples/rubyrtf.jpg +0 -0
  13. data/examples/rubyrtf.png +0 -0
  14. data/lib/rtf.rb +34 -0
  15. data/lib/rtf/colour.rb +173 -0
  16. data/lib/rtf/font.rb +173 -0
  17. data/lib/rtf/information.rb +112 -0
  18. data/lib/rtf/node.rb +1661 -0
  19. data/lib/rtf/paper.rb +55 -0
  20. data/lib/rtf/style.rb +305 -0
  21. data/ruby-rtf.gemspec +29 -0
  22. data/test/character_style_test.rb +136 -0
  23. data/test/colour_table_test.rb +93 -0
  24. data/test/colour_test.rb +116 -0
  25. data/test/command_node_test.rb +214 -0
  26. data/test/container_node_test.rb +64 -0
  27. data/test/document_style_test.rb +79 -0
  28. data/test/document_test.rb +106 -0
  29. data/test/fixtures/bitmap1.bmp +0 -0
  30. data/test/fixtures/bitmap2.bmp +0 -0
  31. data/test/fixtures/jpeg1.jpg +0 -0
  32. data/test/fixtures/jpeg2.jpg +0 -0
  33. data/test/fixtures/png1.png +0 -0
  34. data/test/fixtures/png2.png +0 -0
  35. data/test/font_table_test.rb +91 -0
  36. data/test/font_test.rb +48 -0
  37. data/test/footer_node_test.rb +30 -0
  38. data/test/header_node_test.rb +30 -0
  39. data/test/image_node_test.rb +125 -0
  40. data/test/information_test.rb +127 -0
  41. data/test/node_test.rb +25 -0
  42. data/test/paragraph_style_test.rb +81 -0
  43. data/test/style_test.rb +16 -0
  44. data/test/table_cell_node_test.rb +89 -0
  45. data/test/table_node_test.rb +83 -0
  46. data/test/table_row_node_test.rb +59 -0
  47. data/test/test_helper.rb +13 -0
  48. data/test/text_node_test.rb +50 -0
  49. metadata +135 -0
@@ -0,0 +1,79 @@
1
+ require 'test_helper'
2
+
3
+ # Information class unit test class.
4
+ class DocumentStyleTest < Test::Unit::TestCase
5
+ def test_basics
6
+ style = DocumentStyle.new
7
+
8
+ assert(style.is_character_style? == false)
9
+ assert(style.is_document_style? == true)
10
+ assert(style.is_paragraph_style? == false)
11
+ assert(style.is_table_style? == false)
12
+
13
+ assert(style.prefix(nil, nil) == '\paperw11907\paperh16840\margl1800'\
14
+ '\margr1800\margt1440\margb1440')
15
+ assert(style.suffix(nil, nil) == nil)
16
+
17
+ assert(style.bottom_margin == DocumentStyle::DEFAULT_BOTTOM_MARGIN)
18
+ assert(style.gutter == nil)
19
+ assert(style.left_margin == DocumentStyle::DEFAULT_LEFT_MARGIN)
20
+ assert(style.orientation == DocumentStyle::PORTRAIT)
21
+ assert(style.paper == Paper::A4)
22
+ assert(style.right_margin == DocumentStyle::DEFAULT_RIGHT_MARGIN)
23
+ assert(style.top_margin == DocumentStyle::DEFAULT_TOP_MARGIN)
24
+ end
25
+
26
+ def test_mutators
27
+ style = DocumentStyle.new
28
+
29
+ style.bottom_margin = 200
30
+ assert(style.bottom_margin == 200)
31
+
32
+ style.gutter = 1000
33
+ assert(style.gutter == 1000)
34
+
35
+ style.left_margin = 34
36
+ assert(style.left_margin == 34)
37
+
38
+ style.orientation = DocumentStyle::LANDSCAPE
39
+ assert(style.orientation == DocumentStyle::LANDSCAPE)
40
+
41
+ style.paper = Paper::LETTER
42
+ assert(style.paper == Paper::LETTER)
43
+
44
+ style.right_margin = 345
45
+ assert(style.right_margin == 345)
46
+
47
+ style.top_margin = 819
48
+ assert(style.top_margin == 819)
49
+ end
50
+
51
+ def test_prefix
52
+ style = DocumentStyle.new
53
+
54
+ style.left_margin = style.right_margin = 200
55
+ style.top_margin = style.bottom_margin = 100
56
+ style.gutter = 300
57
+ style.orientation = DocumentStyle::LANDSCAPE
58
+ style.paper = Paper::A5
59
+
60
+ assert(style.prefix(nil, nil) == '\paperw11907\paperh8392\margl200'\
61
+ '\margr200\margt100\margb100\gutter300'\
62
+ '\sectd\lndscpsxn')
63
+ end
64
+
65
+ def test_body_method
66
+ style = DocumentStyle.new
67
+
68
+ lr_margin = style.left_margin + style.right_margin
69
+ tb_margin = style.top_margin + style.bottom_margin
70
+
71
+ assert(style.body_width == Paper::A4.width - lr_margin)
72
+ assert(style.body_height == Paper::A4.height - tb_margin)
73
+
74
+ style.orientation = DocumentStyle::LANDSCAPE
75
+
76
+ assert(style.body_width == Paper::A4.height - lr_margin)
77
+ assert(style.body_height == Paper::A4.width - tb_margin)
78
+ end
79
+ end
@@ -0,0 +1,106 @@
1
+ require 'test_helper'
2
+
3
+ # Information class unit test class.
4
+ class DocumentTest < Test::Unit::TestCase
5
+ def setup
6
+ @fonts = FontTable.new
7
+
8
+ @fonts << Font.new(Font::ROMAN, 'Arial')
9
+ @fonts << Font.new(Font::MODERN, 'Courier')
10
+ end
11
+
12
+ def test_basics
13
+ documents = []
14
+ style = DocumentStyle.new
15
+
16
+ documents << Document.new(@fonts[0])
17
+ documents << Document.new(@fonts[1], style)
18
+ documents << Document.new(@fonts[0], nil, Document::CS_MAC)
19
+ documents << Document.new(@fonts[1], style, Document::CS_PC,
20
+ Document::LC_ENGLISH_US)
21
+
22
+ lr_margin = DocumentStyle::DEFAULT_LEFT_MARGIN +
23
+ DocumentStyle::DEFAULT_RIGHT_MARGIN
24
+ tb_margin = DocumentStyle::DEFAULT_TOP_MARGIN +
25
+ DocumentStyle::DEFAULT_BOTTOM_MARGIN
26
+
27
+ fonts = []
28
+ fonts << FontTable.new(@fonts[0])
29
+ fonts << FontTable.new(@fonts[1])
30
+
31
+ assert(documents[0].character_set == Document::CS_ANSI)
32
+ assert(documents[1].character_set == Document::CS_ANSI)
33
+ assert(documents[2].character_set == Document::CS_MAC)
34
+ assert(documents[3].character_set == Document::CS_PC)
35
+
36
+ assert(documents[0].fonts.size == 1)
37
+ assert(documents[1].fonts.size == 1)
38
+ assert(documents[2].fonts.size == 1)
39
+ assert(documents[3].fonts.size == 1)
40
+
41
+ assert(documents[0].fonts[0] == @fonts[0])
42
+ assert(documents[1].fonts[0] == @fonts[1])
43
+ assert(documents[2].fonts[0] == @fonts[0])
44
+ assert(documents[3].fonts[0] == @fonts[1])
45
+
46
+ assert(documents[0].colours.size == 0)
47
+ assert(documents[1].colours.size == 0)
48
+ assert(documents[2].colours.size == 0)
49
+ assert(documents[3].colours.size == 0)
50
+
51
+ assert(documents[0].language == Document::LC_ENGLISH_UK)
52
+ assert(documents[1].language == Document::LC_ENGLISH_UK)
53
+ assert(documents[2].language == Document::LC_ENGLISH_UK)
54
+ assert(documents[3].language == Document::LC_ENGLISH_US)
55
+
56
+ assert(documents[0].style != nil)
57
+ assert(documents[1].style == style)
58
+ assert(documents[2].style != nil)
59
+ assert(documents[3].style == style)
60
+
61
+ assert(documents[0].body_width == Paper::A4.width - lr_margin)
62
+ assert(documents[0].body_height == Paper::A4.height - tb_margin)
63
+ assert(documents[0].default_font == @fonts[0])
64
+ assert(documents[0].paper == Paper::A4)
65
+ assert(documents[0].header == nil)
66
+ assert(documents[0].header(HeaderNode::UNIVERSAL) == nil)
67
+ assert(documents[0].header(HeaderNode::LEFT_PAGE) == nil)
68
+ assert(documents[0].header(HeaderNode::RIGHT_PAGE) == nil)
69
+ assert(documents[0].header(HeaderNode::FIRST_PAGE) == nil)
70
+ assert(documents[0].footer == nil)
71
+ assert(documents[0].footer(FooterNode::UNIVERSAL) == nil)
72
+ assert(documents[0].footer(FooterNode::LEFT_PAGE) == nil)
73
+ assert(documents[0].footer(FooterNode::RIGHT_PAGE) == nil)
74
+ assert(documents[0].footer(FooterNode::FIRST_PAGE) == nil)
75
+ end
76
+
77
+ def test_mutators
78
+ document = Document.new(@fonts[0])
79
+
80
+ document.default_font = @fonts[1]
81
+ assert(document.default_font == @fonts[1])
82
+
83
+ document.character_set = Document::CS_PCA
84
+ assert(document.character_set == Document::CS_PCA)
85
+
86
+ document.language = Document::LC_CZECH
87
+ assert(document.language == Document::LC_CZECH)
88
+ end
89
+
90
+ def test_page_break
91
+ document = Document.new(@fonts[0])
92
+
93
+ assert(document.page_break == nil)
94
+ assert(document.size == 1)
95
+ assert(document[0].prefix == '\page')
96
+ end
97
+
98
+ def test_exceptions
99
+ document = Document.new(@fonts[0])
100
+ begin
101
+ document.parent = document
102
+ flunk("Successfully change the parent of a Document object.")
103
+ rescue
104
+ end
105
+ end
106
+ end
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,91 @@
1
+ require 'test_helper'
2
+
3
+ # FontTable class unit test class.
4
+ class FontTableTest < Test::Unit::TestCase
5
+ def setup
6
+ @fonts = []
7
+ @fonts.push(Font.new(Font::MODERN, "Courier New"))
8
+ @fonts.push(Font.new(Font::ROMAN, "Arial"))
9
+ @fonts.push(Font.new(Font::SWISS, "Tahoma"))
10
+ @fonts.push(Font.new(Font::NIL, "La La La"))
11
+ end
12
+
13
+ def test_01
14
+ tables = []
15
+ tables.push(FontTable.new)
16
+ tables.push(FontTable.new(@fonts[0], @fonts[2]))
17
+ tables.push(FontTable.new(*@fonts))
18
+ tables.push(FontTable.new(@fonts[0], @fonts[2], @fonts[0]))
19
+
20
+ assert(tables[0].size == 0)
21
+ assert(tables[1].size == 2)
22
+ assert(tables[2].size == 4)
23
+ assert(tables[3].size == 2)
24
+
25
+ assert(tables[0][2] == nil)
26
+ assert(tables[1][1] == @fonts[2])
27
+ assert(tables[2][3] == @fonts[3])
28
+ assert(tables[3][2] == nil)
29
+
30
+ assert(tables[0].index(@fonts[0]) == nil)
31
+ assert(tables[1].index(@fonts[2]) == 1)
32
+ assert(tables[2].index(@fonts[2]) == 2)
33
+ assert(tables[3].index(@fonts[1]) == nil)
34
+
35
+ tables[0].add(@fonts[0])
36
+ assert(tables[0].size == 1)
37
+ assert(tables[0].index(@fonts[0]) == 0)
38
+
39
+ tables[0] << @fonts[1]
40
+ assert(tables[0].size == 2)
41
+ assert(tables[0].index(@fonts[1]) == 1)
42
+
43
+ tables[0].add(@fonts[0])
44
+ assert(tables[0].size == 2)
45
+ assert([tables[0][0], tables[0][1]] == [@fonts[0], @fonts[1]])
46
+
47
+ tables[0] << @fonts[1]
48
+ assert(tables[0].size == 2)
49
+ assert([tables[0][0], tables[0][1]] == [@fonts[0], @fonts[1]])
50
+
51
+ flags = [false, false, false, false]
52
+ tables[2].each do |font|
53
+ flags[@fonts.index(font)] = true if @fonts.index(font) != nil
54
+ end
55
+ assert(flags.index(false) == nil)
56
+
57
+ assert(tables[0].to_s == "Font Table (2 fonts)\n"\
58
+ " Family: modern, Name: Courier New\n"\
59
+ " Family: roman, Name: Arial")
60
+ assert(tables[1].to_s(6) == " Font Table (2 fonts)\n"\
61
+ " Family: modern, Name: Courier New\n"\
62
+ " Family: swiss, Name: Tahoma")
63
+ assert(tables[2].to_s(3) == " Font Table (4 fonts)\n"\
64
+ " Family: modern, Name: Courier New\n"\
65
+ " Family: roman, Name: Arial\n"\
66
+ " Family: swiss, Name: Tahoma\n"\
67
+ " Family: nil, Name: La La La")
68
+ assert(tables[3].to_s(-10) == "Font Table (2 fonts)\n"\
69
+ " Family: modern, Name: Courier New\n"\
70
+ " Family: swiss, Name: Tahoma")
71
+
72
+ assert(tables[0].to_rtf == "{\\fonttbl\n"\
73
+ "{\\f0\\fmodern Courier New;}\n"\
74
+ "{\\f1\\froman Arial;}\n"\
75
+ "}")
76
+ assert(tables[1].to_rtf(4) == " {\\fonttbl\n"\
77
+ " {\\f0\\fmodern Courier New;}\n"\
78
+ " {\\f1\\fswiss Tahoma;}\n"\
79
+ " }")
80
+ assert(tables[2].to_rtf(2) == " {\\fonttbl\n"\
81
+ " {\\f0\\fmodern Courier New;}\n"\
82
+ " {\\f1\\froman Arial;}\n"\
83
+ " {\\f2\\fswiss Tahoma;}\n"\
84
+ " {\\f3\\fnil La La La;}\n"\
85
+ " }")
86
+ assert(tables[3].to_rtf(-6) == "{\\fonttbl\n"\
87
+ "{\\f0\\fmodern Courier New;}\n"\
88
+ "{\\f1\\fswiss Tahoma;}\n"\
89
+ "}")
90
+ end
91
+ end
data/test/font_test.rb ADDED
@@ -0,0 +1,48 @@
1
+ require 'test_helper'
2
+
3
+ # Font class unit test class.
4
+ class FontTest < Test::Unit::TestCase
5
+ def test_01
6
+ fonts = []
7
+ fonts.push(Font.new(Font::MODERN, "Courier New"))
8
+ fonts.push(Font.new(Font::ROMAN, "Arial"))
9
+ fonts.push(Font.new(Font::SWISS, "Tahoma"))
10
+ fonts.push(Font.new(Font::NIL, "La La La"))
11
+
12
+ assert(fonts[0] == fonts[0])
13
+ assert(!(fonts[0] == fonts[1]))
14
+ assert(!(fonts[1] == 'a string of text'))
15
+ assert(fonts[2] == Font.new(Font::SWISS, "Tahoma"))
16
+
17
+ assert(fonts[0].family == Font::MODERN)
18
+ assert(fonts[1].family == Font::ROMAN)
19
+ assert(fonts[2].family == Font::SWISS)
20
+ assert(fonts[3].family == Font::NIL)
21
+
22
+ assert(fonts[0].name == 'Courier New')
23
+ assert(fonts[1].name == 'Arial')
24
+ assert(fonts[2].name == 'Tahoma')
25
+ assert(fonts[3].name == 'La La La')
26
+
27
+ assert(fonts[0].to_s == 'Family: modern, Name: Courier New')
28
+ assert(fonts[1].to_s(3) == ' Family: roman, Name: Arial')
29
+ assert(fonts[2].to_s(6) == ' Family: swiss, Name: Tahoma')
30
+ assert(fonts[3].to_s(-1) == 'Family: nil, Name: La La La')
31
+
32
+ assert(fonts[0].to_rtf == '\fmodern Courier New;')
33
+ assert(fonts[1].to_rtf(2) == ' \froman Arial;')
34
+ assert(fonts[2].to_rtf(4) == ' \fswiss Tahoma;')
35
+ assert(fonts[3].to_rtf(-6) == '\fnil La La La;')
36
+
37
+ begin
38
+ Font.new(12345, "Ningy")
39
+ flunk("Created a Font object with an invalid family setting.")
40
+ rescue RTFError
41
+ rescue Test::Unit::AssertionFailedError => error
42
+ raise error
43
+ rescue => error
44
+ flunk("Unexpected exception caught checking font creation with "\
45
+ "an invalid family. Exception type #{error.class.name}.")
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,30 @@
1
+ require 'test_helper'
2
+
3
+ # Information class unit test class.
4
+ class FooterNodeTest < Test::Unit::TestCase
5
+ def setup
6
+ @document = Document.new(Font.new(Font::ROMAN, 'Arial'))
7
+ end
8
+
9
+ def test_basics
10
+ footers = []
11
+
12
+ footers << FooterNode.new(@document)
13
+ footers << FooterNode.new(@document, FooterNode::LEFT_PAGE)
14
+
15
+ assert(footers[0].parent == @document)
16
+ assert(footers[1].parent == @document)
17
+
18
+ assert(footers[0].type == FooterNode::UNIVERSAL)
19
+ assert(footers[1].type == FooterNode::LEFT_PAGE)
20
+ end
21
+
22
+ def test_exceptions
23
+ footer = FooterNode.new(@document)
24
+ begin
25
+ footer.footnote("La la la.")
26
+ flunk("Successfully added a footnote to a footer.")
27
+ rescue
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ require 'test_helper'
2
+
3
+ # Information class unit test class.
4
+ class HeaderNodeTest < Test::Unit::TestCase
5
+ def setup
6
+ @document = Document.new(Font.new(Font::ROMAN, 'Arial'))
7
+ end
8
+
9
+ def test_basics
10
+ headers = []
11
+
12
+ headers << HeaderNode.new(@document)
13
+ headers << HeaderNode.new(@document, HeaderNode::LEFT_PAGE)
14
+
15
+ assert(headers[0].parent == @document)
16
+ assert(headers[1].parent == @document)
17
+
18
+ assert(headers[0].type == HeaderNode::UNIVERSAL)
19
+ assert(headers[1].type == HeaderNode::LEFT_PAGE)
20
+ end
21
+
22
+ def test_exceptions
23
+ headers = HeaderNode.new(@document)
24
+ begin
25
+ headers.footnote("La la la.")
26
+ flunk("Successfully added a footnote to a header.")
27
+ rescue
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,125 @@
1
+ $:.unshift(File.dirname(__FILE__)+"/../lib")
2
+
3
+ require 'test_helper'
4
+
5
+ # Colour class unit test class.
6
+ class ImageNodeTest < Test::Unit::TestCase
7
+ def setup
8
+ @document = Document.new(Font.new(Font::ROMAN, 'Arial'))
9
+ end
10
+ def test_basics
11
+ image = ImageNode.new(@document, fixture_file_path("bitmap1.bmp"), 1)
12
+
13
+ assert(image.width == 20)
14
+ assert(image.height == 20)
15
+ assert(image.x_scaling == nil)
16
+ assert(image.y_scaling == nil)
17
+ assert(image.top_crop == nil)
18
+ assert(image.right_crop == nil)
19
+ assert(image.left_crop == nil)
20
+ assert(image.bottom_crop == nil)
21
+ end
22
+
23
+ def test_mutators
24
+ image = ImageNode.new(@document, fixture_file_path("jpeg2.jpg"), 1)
25
+
26
+ image.x_scaling = 75
27
+ assert(image.x_scaling == 75)
28
+
29
+ image.y_scaling = 60
30
+ assert(image.y_scaling == 60)
31
+
32
+ image.top_crop = 100
33
+ assert(image.top_crop == 100)
34
+
35
+ image.bottom_crop = 10
36
+ assert(image.bottom_crop == 10)
37
+
38
+ image.right_crop = 35
39
+ assert(image.right_crop == 35)
40
+
41
+ image.left_crop = 50
42
+ assert(image.left_crop == 50)
43
+ end
44
+
45
+ def test_image_reading
46
+ images = []
47
+ images << ImageNode.new(@document, fixture_file_path('bitmap1.bmp'), 1)
48
+ images << ImageNode.new(@document, fixture_file_path('bitmap2.bmp'), 2)
49
+ images << ImageNode.new(@document, fixture_file_path('jpeg1.jpg'), 3)
50
+ images << ImageNode.new(@document, fixture_file_path('jpeg2.jpg'), 4)
51
+ images << ImageNode.new(@document, fixture_file_path('png1.png'), 5)
52
+ images << ImageNode.new(@document, fixture_file_path('png2.png'), 6)
53
+
54
+ assert(images[0].width == 20)
55
+ assert(images[0].height == 20)
56
+ assert(images[1].width == 123)
57
+ assert(images[1].height == 456)
58
+ assert(images[2].width == 20)
59
+ assert(images[2].height == 20)
60
+ assert(images[3].width == 123)
61
+ assert(images[3].height == 456)
62
+ assert(images[4].width == 20)
63
+ assert(images[4].height == 20)
64
+ assert(images[5].width == 123)
65
+ assert(images[5].height == 456)
66
+ end
67
+
68
+ def test_rtf
69
+ image = ImageNode.new(@document, fixture_file_path('png1.png'), 1)
70
+ image.x_scaling = 100
71
+ image.y_scaling = 75
72
+ image.top_crop = 10
73
+ image.right_crop = 15
74
+ image.left_crop = 20
75
+ image.bottom_crop = 25
76
+ rtf = image.to_rtf
77
+
78
+ assert(rtf == "{\\*\\shppict{\\pict\\picscalex100\\picscaley75"\
79
+ "\\piccropl20\\piccropr15\\piccropt10\\piccropb25"\
80
+ "\\picw20\\pich20\\bliptag1\\pngblip\n"\
81
+ "89504e470d0a1a0a0000000d494844520000001400000014080200000002eb8a5a00000001735247\n"\
82
+ "4200aece1ce90000000467414d410000b18f0bfc6105000000206348524d00007a26000080840000\n"\
83
+ "fa00000080e8000075300000ea6000003a98000017709cba513c000003dd49444154384f1d545b6c\n"\
84
+ "145518fee6cccccecc9e99d9b9ed76bbb3bdd8ae5b8144144413a335f141259228d60096b485aa2d\n"\
85
+ "b4686b634bb65b6d682244e2050d46239af0c88b181ff1c507f4411ec4447cf1f2808118d05ab1ed\n"\
86
+ "de778fff6cf2e73c9c33dfff7ddf7f1929052d015945890326d002cac0bfc05f30d624066b131d40\n"\
87
+ "0d5001016c020c68b6cf75e06ed84ff87d7b79728c1b33091c8d63c2c55ecf7a30c8596640c8f040\n"\
88
+ "3639ae741c55bba6b29de3e196d9befccb3db9e7b62104fa81a7adf428f75fe3c6b289a282e31ce3\n"\
89
+ "26df9dec330058c81fe9cdbde12697625e31482e66320b7eefab99ae17fa23455b81e74d678a270a\n"\
90
+ "aa7a1258014e4838c6947d5e97476013fd93416659958a40015864da02320b6e7632871e60277028\n"\
91
+ "61cf73bec2f01ef02ef03e50843c12f7badacc7d93b6bb0cbc05bcd38e37915ae1e1dc5dd802ec00\n"\
92
+ "46e2ca5c4c59024eb7c11f004b908765a397c01c3d633a9f6f4ba2378a027801d6a4037abe0f1875\n"\
93
+ "b5195b2fc878bbfd7a46370b317ec8f1a91cc4bc75bca383ca40b9c9d52938a7957025917925c400\n"\
94
+ "22f2215f7bd1d1a734b6a0c845595d34ac71591bf2dd148135dc3b92cfcde5f9acc716b856b4adb9\n"\
95
+ "78ea989b1e0b9103b2c0431c53db070e06f6b0a11f3613cf4aca81747a30e92608ac62d7fec7761c\n"\
96
+ "792a37f948f7f4aed4c4b67b6676660fe6b3cfe423e480a307887a461628d7fd6484b14ec0a6cbb4\n"\
97
+ "2fdb1e540f5a082384e923dd09c782a521134067a40bbdc98403108fdb0eea105d1a860446639585\n"\
98
+ "fa30f87e48fb802781c781c1a845d676a0138c29376ffc214445b42aa2d114cda668d51aa2561135\n"\
99
+ "2de882fe2877a675ed148f7d1206e77de723db3b13b70be9cc4bc003514d1a42b444fdd6ed1bf57a\n"\
100
+ "bd5a2764bd2a6a655107f381dd9a7e52c197b6fa43dafa09f8dae1df6bea05df3901ec895ab95eaa\n"\
101
+ "374493f0ad288b20dadbfffd1981e37d504754f59cc37f8db355e0baa5adc9b8095cb6ad8f81c330\n"\
102
+ "787abdd41482a25ebab3592b95230ba2541595762b860d7ed1f3fe614a15f85bb785ac3520ffe206\n"\
103
+ "5f01af13b341b2095cad6c44199aa2bcb146f896a0c5eb267090ba045ca56d8c99b493ab904ac0b5\n"\
104
+ "b87911381e6d2669aed43784a891e8f266ad49262217f469379346659c95f06d60ae1bb15585dd22\n"\
105
+ "d95cfbd1887d0eccc34870aa504b54ee6cac6e6e545b44de765eae34a8d30c4361f25cc6bb6280aa\n"\
106
+ "754595aec5d59f5d7ed9323e04a6c162ea6fd77f6f891a152c025150cd5af54aaddc19d2e0535767\n"\
107
+ "2dfd8b98f48d19ff2e99bcca70c9d02ee81acdfa3020a1bbbf87ce28a0ea9a153991e0fa3463343b\n"\
108
+ "830a9b05ce029fb5e3538004d3ee4ed04fe47f31ae584cdee40aed0000000049454e44ae426082"\
109
+ "\n}}")
110
+ end
111
+
112
+ def test_exceptions
113
+ begin
114
+ ImageNode.new(@document, 'lalala', 1)
115
+ flunk("Created an ImageNode for a non-existent file.")
116
+ rescue
117
+ end
118
+
119
+ begin
120
+ ImageNode.new(@document, 'ImageNodeTest.rb', 1)
121
+ flunk("Created an ImageNode from an unsupported file format.")
122
+ rescue
123
+ end
124
+ end
125
+ end