prawn 1.1.0 → 2.4.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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data/.yardopts +1 -0
- data/GPLv2 +20 -21
- data/Gemfile +3 -9
- data/Rakefile +9 -40
- data/lib/prawn/document/bounding_box.rb +54 -40
- data/lib/prawn/document/column_box.rb +8 -10
- data/lib/prawn/document/internals.rb +39 -146
- data/lib/prawn/document/span.rb +23 -17
- data/lib/prawn/document.rb +217 -182
- data/lib/prawn/encoding.rb +69 -101
- data/lib/prawn/errors.rb +47 -43
- data/lib/prawn/font.rb +124 -104
- data/lib/prawn/font_metric_cache.rb +23 -21
- data/lib/prawn/fonts/afm.rb +292 -0
- data/lib/prawn/{font → fonts}/dfont.rb +5 -12
- data/lib/prawn/fonts/otf.rb +11 -0
- data/lib/prawn/fonts/ttc.rb +36 -0
- data/lib/prawn/{font → fonts}/ttf.rb +140 -88
- data/lib/prawn/graphics/blend_mode.rb +65 -0
- data/lib/prawn/graphics/cap_style.rb +5 -5
- data/lib/prawn/graphics/color.rb +46 -44
- data/lib/prawn/graphics/dash.rb +27 -11
- data/lib/prawn/graphics/join_style.rb +11 -6
- data/lib/prawn/graphics/patterns.rb +220 -78
- data/lib/prawn/graphics/transformation.rb +20 -12
- data/lib/prawn/graphics/transparency.rb +20 -18
- data/lib/prawn/graphics.rb +153 -115
- data/lib/prawn/grid.rb +93 -50
- data/lib/prawn/image_handler.rb +4 -4
- data/lib/prawn/images/image.rb +3 -2
- data/lib/prawn/images/jpg.rb +31 -24
- data/lib/prawn/images/png.rb +101 -68
- data/lib/prawn/images.rb +64 -56
- data/lib/prawn/measurement_extensions.rb +10 -9
- data/lib/prawn/measurements.rb +20 -23
- data/lib/prawn/outline.rb +96 -75
- data/lib/prawn/repeater.rb +16 -16
- data/lib/prawn/security/arcfour.rb +2 -2
- data/lib/prawn/security.rb +100 -85
- data/lib/prawn/soft_mask.rb +37 -38
- data/lib/prawn/stamp.rb +28 -13
- data/lib/prawn/text/box.rb +24 -29
- data/lib/prawn/text/formatted/arranger.rb +108 -63
- data/lib/prawn/text/formatted/box.rb +187 -124
- data/lib/prawn/text/formatted/fragment.rb +24 -20
- data/lib/prawn/text/formatted/line_wrap.rb +133 -73
- data/lib/prawn/text/formatted/parser.rb +147 -127
- data/lib/prawn/text/formatted/wrap.rb +48 -35
- data/lib/prawn/text/formatted.rb +5 -5
- data/lib/prawn/text.rb +103 -68
- data/lib/prawn/transformation_stack.rb +44 -0
- data/lib/prawn/utilities.rb +10 -22
- data/lib/prawn/version.rb +5 -0
- data/lib/prawn/view.rb +101 -0
- data/lib/prawn.rb +39 -54
- data/manual/basic_concepts/adding_pages.rb +6 -7
- data/manual/basic_concepts/basic_concepts.rb +34 -25
- data/manual/basic_concepts/creation.rb +10 -11
- data/manual/basic_concepts/cursor.rb +4 -5
- data/manual/basic_concepts/measurement.rb +8 -9
- data/manual/basic_concepts/origin.rb +5 -6
- data/manual/basic_concepts/other_cursor_helpers.rb +11 -12
- data/manual/basic_concepts/view.rb +48 -0
- data/manual/bounding_box/bounding_box.rb +30 -28
- data/manual/bounding_box/bounds.rb +12 -13
- data/manual/bounding_box/canvas.rb +7 -8
- data/manual/bounding_box/creation.rb +6 -7
- data/manual/bounding_box/indentation.rb +14 -15
- data/manual/bounding_box/nesting.rb +25 -18
- data/manual/bounding_box/russian_boxes.rb +18 -18
- data/manual/bounding_box/stretchy.rb +12 -14
- data/manual/contents.rb +28 -22
- data/manual/cover.rb +33 -32
- data/manual/document_and_page_options/background.rb +15 -13
- data/manual/document_and_page_options/document_and_page_options.rb +24 -22
- data/manual/document_and_page_options/metadata.rb +20 -18
- data/manual/document_and_page_options/page_margins.rb +18 -20
- data/manual/document_and_page_options/page_size.rb +13 -13
- data/manual/document_and_page_options/print_scaling.rb +18 -15
- data/manual/example_helper.rb +5 -4
- data/manual/graphics/blend_mode.rb +52 -0
- data/manual/graphics/circle_and_ellipse.rb +4 -5
- data/manual/graphics/color.rb +7 -9
- data/manual/graphics/common_lines.rb +7 -8
- data/manual/graphics/fill_and_stroke.rb +5 -6
- data/manual/graphics/fill_rules.rb +12 -11
- data/manual/graphics/gradients.rb +27 -21
- data/manual/graphics/graphics.rb +46 -40
- data/manual/graphics/helper.rb +19 -9
- data/manual/graphics/line_width.rb +8 -7
- data/manual/graphics/lines_and_curves.rb +8 -9
- data/manual/graphics/polygon.rb +6 -8
- data/manual/graphics/rectangle.rb +4 -5
- data/manual/graphics/rotate.rb +6 -9
- data/manual/graphics/scale.rb +14 -13
- data/manual/graphics/soft_masks.rb +4 -6
- data/manual/graphics/stroke_cap.rb +7 -8
- data/manual/graphics/stroke_dash.rb +15 -16
- data/manual/graphics/stroke_join.rb +6 -7
- data/manual/graphics/translate.rb +10 -10
- data/manual/graphics/transparency.rb +7 -9
- data/manual/how_to_read_this_manual.rb +8 -9
- data/manual/images/absolute_position.rb +6 -7
- data/manual/images/fit.rb +7 -8
- data/manual/images/horizontal.rb +10 -11
- data/manual/images/images.rb +28 -27
- data/manual/images/plain_image.rb +5 -6
- data/manual/images/scale.rb +9 -10
- data/manual/images/vertical.rb +16 -14
- data/manual/images/width_and_height.rb +10 -11
- data/manual/layout/boxes.rb +10 -11
- data/manual/layout/content.rb +9 -10
- data/manual/layout/layout.rb +17 -18
- data/manual/layout/simple_grid.rb +6 -7
- data/manual/outline/add_subsection_to.rb +20 -21
- data/manual/outline/insert_section_after.rb +15 -16
- data/manual/outline/outline.rb +22 -21
- data/manual/outline/sections_and_pages.rb +17 -18
- data/manual/repeatable_content/alternate_page_numbering.rb +36 -0
- data/manual/repeatable_content/page_numbering.rb +17 -16
- data/manual/repeatable_content/repeatable_content.rb +27 -23
- data/manual/repeatable_content/repeater.rb +15 -16
- data/manual/repeatable_content/stamp.rb +14 -15
- data/manual/security/encryption.rb +8 -11
- data/manual/security/permissions.rb +20 -15
- data/manual/security/security.rb +18 -18
- data/manual/table.rb +16 -0
- data/manual/text/alignment.rb +16 -17
- data/manual/text/color.rb +12 -12
- data/manual/text/column_box.rb +9 -11
- data/manual/text/fallback_fonts.rb +25 -21
- data/manual/text/font.rb +11 -12
- data/manual/text/font_size.rb +13 -14
- data/manual/text/font_style.rb +10 -8
- data/manual/text/formatted_callbacks.rb +33 -23
- data/manual/text/formatted_text.rb +36 -25
- data/manual/text/free_flowing_text.rb +22 -23
- data/manual/text/inline.rb +18 -19
- data/manual/text/kerning_and_character_spacing.rb +14 -15
- data/manual/text/leading.rb +7 -8
- data/manual/text/line_wrapping.rb +37 -18
- data/manual/text/paragraph_indentation.rb +15 -10
- data/manual/text/positioned_text.rb +16 -17
- data/manual/text/registering_families.rb +27 -24
- data/manual/text/rendering_and_color.rb +9 -10
- data/manual/text/right_to_left_text.rb +30 -19
- data/manual/text/rotation.rb +33 -24
- data/manual/text/single_usage.rb +8 -9
- data/manual/text/text.rb +56 -54
- data/manual/text/text_box_excess.rb +20 -17
- data/manual/text/text_box_extensions.rb +18 -15
- data/manual/text/text_box_overflow.rb +24 -17
- data/manual/text/utf8.rb +12 -13
- data/manual/text/win_ansi_charset.rb +28 -25
- data/prawn.gemspec +45 -50
- data/spec/extensions/encoding_helpers.rb +3 -3
- data/spec/prawn/document/bounding_box_spec.rb +550 -0
- data/spec/prawn/document/column_box_spec.rb +75 -0
- data/spec/prawn/document/security_spec.rb +176 -0
- data/spec/prawn/document_annotations_spec.rb +76 -0
- data/spec/prawn/document_destinations_spec.rb +15 -0
- data/spec/prawn/document_grid_spec.rb +99 -0
- data/spec/prawn/document_reference_spec.rb +27 -0
- data/spec/prawn/document_span_spec.rb +44 -0
- data/spec/prawn/document_spec.rb +805 -0
- data/spec/prawn/font_metric_cache_spec.rb +54 -0
- data/spec/prawn/font_spec.rb +544 -0
- data/spec/prawn/graphics/blend_mode_spec.rb +63 -0
- data/spec/prawn/graphics/transparency_spec.rb +81 -0
- data/spec/prawn/graphics_spec.rb +872 -0
- data/spec/prawn/graphics_stroke_styles_spec.rb +229 -0
- data/spec/prawn/image_handler_spec.rb +53 -0
- data/spec/prawn/images/jpg_spec.rb +20 -0
- data/spec/prawn/images/png_spec.rb +283 -0
- data/spec/prawn/images_spec.rb +229 -0
- data/spec/prawn/measurements_extensions_spec.rb +24 -0
- data/spec/prawn/outline_spec.rb +512 -0
- data/spec/prawn/repeater_spec.rb +166 -0
- data/spec/prawn/soft_mask_spec.rb +74 -0
- data/spec/prawn/stamp_spec.rb +173 -0
- data/spec/prawn/text/box_spec.rb +1110 -0
- data/spec/prawn/text/formatted/arranger_spec.rb +466 -0
- data/spec/prawn/text/formatted/box_spec.rb +849 -0
- data/spec/prawn/text/formatted/fragment_spec.rb +343 -0
- data/spec/prawn/text/formatted/line_wrap_spec.rb +495 -0
- data/spec/prawn/text/formatted/parser_spec.rb +697 -0
- data/spec/prawn/text_draw_text_spec.rb +150 -0
- data/spec/prawn/text_rendering_mode_spec.rb +48 -0
- data/spec/prawn/text_spacing_spec.rb +95 -0
- data/spec/prawn/text_spec.rb +603 -0
- data/spec/prawn/text_with_inline_formatting_spec.rb +35 -0
- data/spec/prawn/transformation_stack_spec.rb +66 -0
- data/spec/prawn/view_spec.rb +63 -0
- data/spec/prawn_manual_spec.rb +35 -0
- data/spec/spec_helper.rb +19 -25
- data.tar.gz.sig +0 -0
- metadata +113 -276
- metadata.gz.sig +0 -0
- data/data/encodings/win_ansi.txt +0 -29
- data/data/images/16bit.alpha +0 -0
- data/data/images/16bit.color +0 -0
- data/data/images/16bit.png +0 -0
- data/data/images/arrow.png +0 -0
- data/data/images/arrow2.png +0 -0
- data/data/images/dice.alpha +0 -0
- data/data/images/dice.color +0 -0
- data/data/images/dice.png +0 -0
- data/data/images/dice_interlaced.png +0 -0
- data/data/images/fractal.jpg +0 -0
- data/data/images/indexed_color.dat +0 -0
- data/data/images/indexed_color.png +0 -0
- data/data/images/letterhead.jpg +0 -0
- data/data/images/license.md +0 -8
- data/data/images/page_white_text.alpha +0 -0
- data/data/images/page_white_text.color +0 -0
- data/data/images/page_white_text.png +0 -0
- data/data/images/pigs.jpg +0 -0
- data/data/images/prawn.png +0 -0
- data/data/images/ruport.png +0 -0
- data/data/images/ruport_data.dat +0 -0
- data/data/images/ruport_transparent.png +0 -0
- data/data/images/ruport_type0.png +0 -0
- data/data/images/stef.jpg +0 -0
- data/data/images/tru256.bmp +0 -0
- data/data/images/web-links.dat +0 -1
- data/data/images/web-links.png +0 -0
- data/data/pdfs/complex_template.pdf +0 -0
- data/data/pdfs/contains_ttf_font.pdf +0 -0
- data/data/pdfs/encrypted.pdf +0 -0
- data/data/pdfs/form.pdf +1 -819
- data/data/pdfs/hexagon.pdf +0 -61
- data/data/pdfs/indirect_reference.pdf +0 -86
- data/data/pdfs/multipage_template.pdf +0 -127
- data/data/pdfs/nested_pages.pdf +0 -118
- data/data/pdfs/page_without_mediabox.pdf +0 -193
- data/data/pdfs/resources_as_indirect_object.pdf +0 -83
- data/data/pdfs/two_hexagons.pdf +0 -90
- data/data/pdfs/version_1_6.pdf +0 -61
- data/data/shift_jis_text.txt +0 -1
- data/lib/prawn/document/graphics_state.rb +0 -73
- data/lib/prawn/font/afm.rb +0 -247
- data/lib/prawn/table/cell/image.rb +0 -69
- data/lib/prawn/table/cell/in_table.rb +0 -33
- data/lib/prawn/table/cell/span_dummy.rb +0 -93
- data/lib/prawn/table/cell/subtable.rb +0 -66
- data/lib/prawn/table/cell/text.rb +0 -154
- data/lib/prawn/table/cell.rb +0 -772
- data/lib/prawn/table/cells.rb +0 -255
- data/lib/prawn/table/column_width_calculator.rb +0 -182
- data/lib/prawn/table.rb +0 -644
- data/manual/table/basic_block.rb +0 -53
- data/manual/table/before_rendering_page.rb +0 -26
- data/manual/table/cell_border_lines.rb +0 -24
- data/manual/table/cell_borders_and_bg.rb +0 -31
- data/manual/table/cell_dimensions.rb +0 -30
- data/manual/table/cell_text.rb +0 -38
- data/manual/table/column_widths.rb +0 -30
- data/manual/table/content_and_subtables.rb +0 -39
- data/manual/table/creation.rb +0 -27
- data/manual/table/filtering.rb +0 -36
- data/manual/table/flow_and_header.rb +0 -17
- data/manual/table/image_cells.rb +0 -33
- data/manual/table/position.rb +0 -29
- data/manual/table/row_colors.rb +0 -20
- data/manual/table/span.rb +0 -30
- data/manual/table/style.rb +0 -22
- data/manual/table/table.rb +0 -52
- data/manual/table/width.rb +0 -27
- data/spec/acceptance/png.rb +0 -25
- data/spec/annotations_spec.rb +0 -74
- data/spec/bounding_box_spec.rb +0 -510
- data/spec/cell_spec.rb +0 -629
- data/spec/column_box_spec.rb +0 -65
- data/spec/destinations_spec.rb +0 -15
- data/spec/document_spec.rb +0 -730
- data/spec/extensions/mocha.rb +0 -46
- data/spec/font_metric_cache_spec.rb +0 -52
- data/spec/font_spec.rb +0 -449
- data/spec/formatted_text_arranger_spec.rb +0 -421
- data/spec/formatted_text_box_spec.rb +0 -639
- data/spec/formatted_text_fragment_spec.rb +0 -298
- data/spec/graphics_spec.rb +0 -669
- data/spec/grid_spec.rb +0 -96
- data/spec/image_handler_spec.rb +0 -54
- data/spec/images_spec.rb +0 -153
- data/spec/inline_formatted_text_parser_spec.rb +0 -564
- data/spec/jpg_spec.rb +0 -25
- data/spec/line_wrap_spec.rb +0 -344
- data/spec/measurement_units_spec.rb +0 -25
- data/spec/outline_spec.rb +0 -430
- data/spec/png_spec.rb +0 -237
- data/spec/reference_spec.rb +0 -25
- data/spec/repeater_spec.rb +0 -160
- data/spec/security_spec.rb +0 -158
- data/spec/soft_mask_spec.rb +0 -79
- data/spec/span_spec.rb +0 -44
- data/spec/stamp_spec.rb +0 -160
- data/spec/stroke_styles_spec.rb +0 -211
- data/spec/table/span_dummy_spec.rb +0 -17
- data/spec/table_spec.rb +0 -1527
- data/spec/text_at_spec.rb +0 -115
- data/spec/text_box_spec.rb +0 -1034
- data/spec/text_rendering_mode_spec.rb +0 -45
- data/spec/text_spacing_spec.rb +0 -93
- data/spec/text_spec.rb +0 -437
- data/spec/text_with_inline_formatting_spec.rb +0 -35
- data/spec/transparency_spec.rb +0 -91
data/spec/outline_spec.rb
DELETED
@@ -1,430 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
|
3
|
-
|
4
|
-
describe "Outline" do
|
5
|
-
before(:each) do
|
6
|
-
@pdf = Prawn::Document.new() do
|
7
|
-
text "Page 1. This is the first Chapter. "
|
8
|
-
start_new_page
|
9
|
-
text "Page 2. More in the first Chapter. "
|
10
|
-
start_new_page
|
11
|
-
outline.define do
|
12
|
-
section 'Chapter 1', :destination => 1, :closed => true do
|
13
|
-
page :destination => 1, :title => 'Page 1'
|
14
|
-
page :destination => 2, :title => 'Page 2'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "outline encoding" do
|
21
|
-
it "should store all outline titles as UTF-16" do
|
22
|
-
render_and_find_objects
|
23
|
-
@hash.values.each do |obj|
|
24
|
-
if obj.is_a?(Hash) && obj[:Title]
|
25
|
-
title = obj[:Title].dup
|
26
|
-
title.force_encoding(Encoding::UTF_16LE)
|
27
|
-
title.valid_encoding?.should == true
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "#generate_outline" do
|
34
|
-
before(:each) do
|
35
|
-
render_and_find_objects
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should create a root outline dictionary item" do
|
39
|
-
@outline_root.should_not be_nil
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should set the first and last top items of the root outline dictionary item" do
|
43
|
-
referenced_object(@outline_root[:First]).should == @section_1
|
44
|
-
referenced_object(@outline_root[:Last]).should == @section_1
|
45
|
-
end
|
46
|
-
|
47
|
-
describe "#create_outline_item" do
|
48
|
-
it "should create outline items for each section and page" do
|
49
|
-
[@section_1, @page_1, @page_2].each {|item| item.should_not be_nil}
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe "#set_relations, #set_variables_for_block, and #reset_parent" do
|
54
|
-
it "should link sibling items" do
|
55
|
-
referenced_object(@page_1[:Next]).should == @page_2
|
56
|
-
referenced_object(@page_2[:Prev]).should == @page_1
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should link child items to parent item" do
|
60
|
-
[@page_1, @page_2].each {|page| referenced_object(page[:Parent]).should == @section_1 }
|
61
|
-
end
|
62
|
-
|
63
|
-
it "should set the first and last child items for parent item" do
|
64
|
-
referenced_object(@section_1[:First]).should == @page_1
|
65
|
-
referenced_object(@section_1[:Last]).should == @page_2
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
describe "#increase_count" do
|
70
|
-
|
71
|
-
it "should add the count of all descendant items" do
|
72
|
-
@outline_root[:Count].should == 3
|
73
|
-
@section_1[:Count].abs.should == 2
|
74
|
-
@page_1[:Count].should == 0
|
75
|
-
@page_2[:Count].should == 0
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|
79
|
-
|
80
|
-
describe "closed option" do
|
81
|
-
|
82
|
-
it "should set the item's integer count to negative" do
|
83
|
-
@section_1[:Count].should == -2
|
84
|
-
end
|
85
|
-
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|
89
|
-
|
90
|
-
describe "adding a custom destination" do
|
91
|
-
before(:each) do
|
92
|
-
@pdf.start_new_page
|
93
|
-
@pdf.text "Page 3 with a destination"
|
94
|
-
@pdf.add_dest('customdest', @pdf.dest_xyz(200, 200))
|
95
|
-
pdf = @pdf
|
96
|
-
@pdf.outline.update do
|
97
|
-
page :destination => pdf.dest_xyz(200, 200), :title => 'Custom Destination'
|
98
|
-
end
|
99
|
-
render_and_find_objects
|
100
|
-
end
|
101
|
-
|
102
|
-
it "should create an outline item" do
|
103
|
-
@custom_dest.should_not be_nil
|
104
|
-
end
|
105
|
-
|
106
|
-
it "should reference the custom destination" do
|
107
|
-
referenced_object(@custom_dest[:Dest].first).should == referenced_object(@pages.last)
|
108
|
-
end
|
109
|
-
|
110
|
-
end
|
111
|
-
|
112
|
-
describe "addding a section later with outline#section" do
|
113
|
-
before(:each) do
|
114
|
-
@pdf.start_new_page
|
115
|
-
@pdf.text "Page 3. An added section "
|
116
|
-
@pdf.outline.update do
|
117
|
-
section 'Added Section', :destination => 3 do
|
118
|
-
page :destination => 3, :title => 'Page 3'
|
119
|
-
end
|
120
|
-
end
|
121
|
-
render_and_find_objects
|
122
|
-
end
|
123
|
-
|
124
|
-
it "should add new outline items to document" do
|
125
|
-
[@section_2, @page_3].each { |item| item.should_not be_nil}
|
126
|
-
end
|
127
|
-
|
128
|
-
it "should reset the last items for root outline dictionary" do
|
129
|
-
referenced_object(@outline_root[:First]).should == @section_1
|
130
|
-
referenced_object(@outline_root[:Last]).should == @section_2
|
131
|
-
end
|
132
|
-
|
133
|
-
it "should reset the next relation for the previous last top level item" do
|
134
|
-
referenced_object(@section_1[:Next]).should == @section_2
|
135
|
-
end
|
136
|
-
|
137
|
-
it "should set the previous relation of the addded to section" do
|
138
|
-
referenced_object(@section_2[:Prev]).should == @section_1
|
139
|
-
end
|
140
|
-
|
141
|
-
it "should increase the count of root outline dictionary" do
|
142
|
-
@outline_root[:Count].should == 5
|
143
|
-
end
|
144
|
-
|
145
|
-
end
|
146
|
-
|
147
|
-
describe "#outline.add_subsection_to" do
|
148
|
-
context "positioned last" do
|
149
|
-
|
150
|
-
before(:each) do
|
151
|
-
@pdf.start_new_page
|
152
|
-
@pdf.text "Page 3. An added subsection "
|
153
|
-
@pdf.outline.update do
|
154
|
-
add_subsection_to 'Chapter 1' do
|
155
|
-
section 'Added SubSection', :destination => 3 do
|
156
|
-
page :destination => 3, :title => 'Added Page 3'
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
render_and_find_objects
|
161
|
-
end
|
162
|
-
|
163
|
-
it "should add new outline items to document" do
|
164
|
-
[@subsection, @added_page_3].each { |item| item.should_not be_nil}
|
165
|
-
end
|
166
|
-
|
167
|
-
it "should reset the last item for parent item dictionary" do
|
168
|
-
referenced_object(@section_1[:First]).should == @page_1
|
169
|
-
referenced_object(@section_1[:Last]).should == @subsection
|
170
|
-
end
|
171
|
-
|
172
|
-
it "should set the prev relation for the new subsection to its parent's old last item" do
|
173
|
-
referenced_object(@subsection[:Prev]).should == @page_2
|
174
|
-
end
|
175
|
-
|
176
|
-
|
177
|
-
it "the subsection should become the next relation for its parent's old last item" do
|
178
|
-
referenced_object(@page_2[:Next]).should == @subsection
|
179
|
-
end
|
180
|
-
|
181
|
-
it "should set the first relation for the new subsection" do
|
182
|
-
referenced_object(@subsection[:First]).should == @added_page_3
|
183
|
-
end
|
184
|
-
|
185
|
-
it "should set the correct last relation of the added to section" do
|
186
|
-
referenced_object(@subsection[:Last]).should == @added_page_3
|
187
|
-
end
|
188
|
-
|
189
|
-
it "should increase the count of root outline dictionary" do
|
190
|
-
@outline_root[:Count].should == 5
|
191
|
-
end
|
192
|
-
|
193
|
-
end
|
194
|
-
|
195
|
-
context "positioned first" do
|
196
|
-
|
197
|
-
before(:each) do
|
198
|
-
@pdf.start_new_page
|
199
|
-
@pdf.text "Page 3. An added subsection "
|
200
|
-
@pdf.outline.update do
|
201
|
-
add_subsection_to 'Chapter 1', :first do
|
202
|
-
section 'Added SubSection', :destination => 3 do
|
203
|
-
page :destination => 3, :title => 'Added Page 3'
|
204
|
-
end
|
205
|
-
end
|
206
|
-
end
|
207
|
-
render_and_find_objects
|
208
|
-
end
|
209
|
-
|
210
|
-
it "should add new outline items to document" do
|
211
|
-
[@subsection, @added_page_3].each { |item| item.should_not be_nil}
|
212
|
-
end
|
213
|
-
|
214
|
-
it "should reset the first item for parent item dictionary" do
|
215
|
-
referenced_object(@section_1[:First]).should == @subsection
|
216
|
-
referenced_object(@section_1[:Last]).should == @page_2
|
217
|
-
end
|
218
|
-
|
219
|
-
it "should set the next relation for the new subsection to its parent's old first item" do
|
220
|
-
referenced_object(@subsection[:Next]).should == @page_1
|
221
|
-
end
|
222
|
-
|
223
|
-
it "the subsection should become the prev relation for its parent's old first item" do
|
224
|
-
referenced_object(@page_1[:Prev]).should == @subsection
|
225
|
-
end
|
226
|
-
|
227
|
-
it "should set the first relation for the new subsection" do
|
228
|
-
referenced_object(@subsection[:First]).should == @added_page_3
|
229
|
-
end
|
230
|
-
|
231
|
-
it "should set the correct last relation of the added to section" do
|
232
|
-
referenced_object(@subsection[:Last]).should == @added_page_3
|
233
|
-
end
|
234
|
-
|
235
|
-
it "should increase the count of root outline dictionary" do
|
236
|
-
@outline_root[:Count].should == 5
|
237
|
-
end
|
238
|
-
|
239
|
-
end
|
240
|
-
|
241
|
-
it "should require an existing title" do
|
242
|
-
lambda do
|
243
|
-
@pdf.go_to_page 1
|
244
|
-
@pdf.start_new_page
|
245
|
-
@pdf.text "Inserted Page"
|
246
|
-
@pdf.outline.update do
|
247
|
-
add_subsection_to 'Wrong page' do
|
248
|
-
page page_number, :title => "Inserted Page"
|
249
|
-
end
|
250
|
-
end
|
251
|
-
render_and_find_objects
|
252
|
-
end.should raise_error(Prawn::Errors::UnknownOutlineTitle)
|
253
|
-
end
|
254
|
-
end
|
255
|
-
|
256
|
-
describe "#outline.insert_section_after" do
|
257
|
-
describe "inserting in the middle of another section" do
|
258
|
-
before(:each) do
|
259
|
-
@pdf.go_to_page 1
|
260
|
-
@pdf.start_new_page
|
261
|
-
@pdf.text "Inserted Page"
|
262
|
-
@pdf.outline.update do
|
263
|
-
insert_section_after 'Page 1' do
|
264
|
-
page :destination => page_number, :title => "Inserted Page"
|
265
|
-
end
|
266
|
-
end
|
267
|
-
end
|
268
|
-
|
269
|
-
it "should insert new outline items to document" do
|
270
|
-
render_and_find_objects
|
271
|
-
@inserted_page.should_not be_nil
|
272
|
-
end
|
273
|
-
|
274
|
-
it "should adjust the count of all ancestors" do
|
275
|
-
render_and_find_objects
|
276
|
-
@outline_root[:Count].should == 4
|
277
|
-
@section_1[:Count].abs.should == 3
|
278
|
-
end
|
279
|
-
|
280
|
-
describe "#adjust_relations" do
|
281
|
-
|
282
|
-
it "should reset the sibling relations of adjoining items to inserted item" do
|
283
|
-
render_and_find_objects
|
284
|
-
referenced_object(@page_1[:Next]).should == @inserted_page
|
285
|
-
referenced_object(@page_2[:Prev]).should == @inserted_page
|
286
|
-
end
|
287
|
-
|
288
|
-
it "should set the sibling relation of added item to adjoining items" do
|
289
|
-
render_and_find_objects
|
290
|
-
referenced_object(@inserted_page[:Next]).should == @page_2
|
291
|
-
referenced_object(@inserted_page[:Prev]).should == @page_1
|
292
|
-
end
|
293
|
-
|
294
|
-
it "should not affect the first and last relations of parent item" do
|
295
|
-
render_and_find_objects
|
296
|
-
referenced_object(@section_1[:First]).should == @page_1
|
297
|
-
referenced_object(@section_1[:Last]).should == @page_2
|
298
|
-
end
|
299
|
-
|
300
|
-
end
|
301
|
-
|
302
|
-
|
303
|
-
context "when adding another section afterwards" do
|
304
|
-
it "should have reset the root position so that a new section is added at the end of root sections" do
|
305
|
-
@pdf.start_new_page
|
306
|
-
@pdf.text "Another Inserted Page"
|
307
|
-
@pdf.outline.update do
|
308
|
-
section 'Added Section' do
|
309
|
-
page :destination => page_number, :title => "Inserted Page"
|
310
|
-
end
|
311
|
-
end
|
312
|
-
render_and_find_objects
|
313
|
-
referenced_object(@outline_root[:Last]).should == @section_2
|
314
|
-
referenced_object(@section_1[:Next]).should == @section_2
|
315
|
-
end
|
316
|
-
end
|
317
|
-
|
318
|
-
end
|
319
|
-
|
320
|
-
|
321
|
-
describe "inserting at the end of another section" do
|
322
|
-
|
323
|
-
before(:each) do
|
324
|
-
@pdf.go_to_page 2
|
325
|
-
@pdf.start_new_page
|
326
|
-
@pdf.text "Inserted Page"
|
327
|
-
@pdf.outline.update do
|
328
|
-
insert_section_after 'Page 2' do
|
329
|
-
page :destination => page_number, :title => "Inserted Page"
|
330
|
-
end
|
331
|
-
end
|
332
|
-
render_and_find_objects
|
333
|
-
end
|
334
|
-
|
335
|
-
describe "#adjust_relations" do
|
336
|
-
|
337
|
-
it "should reset the sibling relations of adjoining item to inserted item" do
|
338
|
-
referenced_object(@page_2[:Next]).should == @inserted_page
|
339
|
-
end
|
340
|
-
|
341
|
-
it "should set the sibling relation of added item to adjoining items" do
|
342
|
-
referenced_object(@inserted_page[:Next]).should be_nil
|
343
|
-
referenced_object(@inserted_page[:Prev]).should == @page_2
|
344
|
-
end
|
345
|
-
|
346
|
-
it "should adjust the last relation of parent item" do
|
347
|
-
referenced_object(@section_1[:Last]).should == @inserted_page
|
348
|
-
end
|
349
|
-
|
350
|
-
end
|
351
|
-
end
|
352
|
-
|
353
|
-
it "should require an existing title" do
|
354
|
-
lambda do
|
355
|
-
@pdf.go_to_page 1
|
356
|
-
@pdf.start_new_page
|
357
|
-
@pdf.text "Inserted Page"
|
358
|
-
@pdf.outline.update do
|
359
|
-
insert_section_after 'Wrong page' do
|
360
|
-
page :destination => page_number, :title => "Inserted Page"
|
361
|
-
end
|
362
|
-
end
|
363
|
-
render_and_find_objects
|
364
|
-
end.should raise_error(Prawn::Errors::UnknownOutlineTitle)
|
365
|
-
end
|
366
|
-
|
367
|
-
end
|
368
|
-
|
369
|
-
describe "#page" do
|
370
|
-
it "should require a title option to be set" do
|
371
|
-
lambda do
|
372
|
-
@pdf = Prawn::Document.new() do
|
373
|
-
text "Page 1. This is the first Chapter. "
|
374
|
-
outline.define do
|
375
|
-
page :destination => 1, :title => nil
|
376
|
-
end
|
377
|
-
end
|
378
|
-
end.should raise_error(Prawn::Errors::RequiredOption)
|
379
|
-
end
|
380
|
-
end
|
381
|
-
end
|
382
|
-
|
383
|
-
describe "foreign character encoding" do
|
384
|
-
before(:each) do
|
385
|
-
pdf = Prawn::Document.new() do
|
386
|
-
outline.define do
|
387
|
-
section 'La pomme croquée', :destination => 1, :closed => true
|
388
|
-
end
|
389
|
-
end
|
390
|
-
@hash = PDF::Reader::ObjectHash.new(StringIO.new(pdf.render, 'r+'))
|
391
|
-
end
|
392
|
-
|
393
|
-
it "should handle other encodings for the title" do
|
394
|
-
object = find_by_title('La pomme croquée')
|
395
|
-
object.should_not == nil
|
396
|
-
end
|
397
|
-
end
|
398
|
-
|
399
|
-
def render_and_find_objects
|
400
|
-
output = StringIO.new(@pdf.render, 'r+')
|
401
|
-
@hash = PDF::Reader::ObjectHash.new(output)
|
402
|
-
@outline_root = @hash.values.find {|obj| obj.is_a?(Hash) && obj[:Type] == :Outlines}
|
403
|
-
@pages = @hash.values.find {|obj| obj.is_a?(Hash) && obj[:Type] == :Pages}[:Kids]
|
404
|
-
@section_1 = find_by_title('Chapter 1')
|
405
|
-
@page_1 = find_by_title('Page 1')
|
406
|
-
@page_2 = find_by_title('Page 2')
|
407
|
-
@section_2 = find_by_title('Added Section')
|
408
|
-
@page_3 = find_by_title('Page 3')
|
409
|
-
@inserted_page = find_by_title('Inserted Page')
|
410
|
-
@subsection = find_by_title('Added SubSection')
|
411
|
-
@added_page_3 = find_by_title('Added Page 3')
|
412
|
-
@custom_dest = find_by_title('Custom Destination')
|
413
|
-
end
|
414
|
-
|
415
|
-
# Outline titles are stored as UTF-16. This method accepts a UTF-8 outline title
|
416
|
-
# and returns the PDF Object that contains an outline with that name
|
417
|
-
def find_by_title(title)
|
418
|
-
@hash.values.find {|obj|
|
419
|
-
if obj.is_a?(Hash) && obj[:Title]
|
420
|
-
title_codepoints = obj[:Title].unpack("n*")
|
421
|
-
title_codepoints.shift
|
422
|
-
utf8_title = title_codepoints.pack("U*")
|
423
|
-
utf8_title == title ? obj : nil
|
424
|
-
end
|
425
|
-
}
|
426
|
-
end
|
427
|
-
|
428
|
-
def referenced_object(reference)
|
429
|
-
@hash[reference]
|
430
|
-
end
|
data/spec/png_spec.rb
DELETED
@@ -1,237 +0,0 @@
|
|
1
|
-
# encoding: ASCII-8BIT
|
2
|
-
|
3
|
-
# Spec'ing the PNG class. Not complete yet - still needs to check the
|
4
|
-
# contents of palette and transparency to ensure they're correct.
|
5
|
-
# Need to find files that have these sections first.
|
6
|
-
#
|
7
|
-
# see http://www.w3.org/TR/PNG/ for a detailed description of the PNG spec,
|
8
|
-
# particuarly Table 11.1 for the different color types
|
9
|
-
|
10
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
|
11
|
-
|
12
|
-
describe "When reading a greyscale PNG file (color type 0)" do
|
13
|
-
|
14
|
-
before(:each) do
|
15
|
-
@filename = "#{Prawn::DATADIR}/images/web-links.png"
|
16
|
-
@data_filename = "#{Prawn::DATADIR}/images/web-links.dat"
|
17
|
-
@img_data = File.binread(@filename)
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should read the attributes from the header chunk correctly" do
|
21
|
-
png = Prawn::Images::PNG.new(@img_data)
|
22
|
-
|
23
|
-
png.width.should == 21
|
24
|
-
png.height.should == 14
|
25
|
-
png.bits.should == 8
|
26
|
-
png.color_type.should == 0
|
27
|
-
png.compression_method.should == 0
|
28
|
-
png.filter_method.should == 0
|
29
|
-
png.interlace_method.should == 0
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should read the image data chunk correctly" do
|
33
|
-
png = Prawn::Images::PNG.new(@img_data)
|
34
|
-
data = Zlib::Inflate.inflate(File.binread(@data_filename))
|
35
|
-
png.img_data.should == data
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe "When reading a greyscale PNG file with transparency (color type 0)" do
|
40
|
-
|
41
|
-
before(:each) do
|
42
|
-
@filename = "#{Prawn::DATADIR}/images/ruport_type0.png"
|
43
|
-
@img_data = File.binread(@filename)
|
44
|
-
end
|
45
|
-
|
46
|
-
# In a greyscale type 0 PNG image, the tRNS chunk should contain a single value
|
47
|
-
# that indicates the color that should be interpreted as transparent.
|
48
|
-
#
|
49
|
-
# http://www.w3.org/TR/PNG/#11tRNS
|
50
|
-
it "should read the tRNS chunk correctly" do
|
51
|
-
png = Prawn::Images::PNG.new(@img_data)
|
52
|
-
png.transparency[:grayscale].should == 255
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe "When reading an RGB PNG file (color type 2)" do
|
57
|
-
|
58
|
-
before(:each) do
|
59
|
-
@filename = "#{Prawn::DATADIR}/images/ruport.png"
|
60
|
-
@data_filename = "#{Prawn::DATADIR}/images/ruport_data.dat"
|
61
|
-
@img_data = File.binread(@filename)
|
62
|
-
end
|
63
|
-
|
64
|
-
it "should read the attributes from the header chunk correctly" do
|
65
|
-
png = Prawn::Images::PNG.new(@img_data)
|
66
|
-
|
67
|
-
png.width.should == 258
|
68
|
-
png.height.should == 105
|
69
|
-
png.bits.should == 8
|
70
|
-
png.color_type.should == 2
|
71
|
-
png.compression_method.should == 0
|
72
|
-
png.filter_method.should == 0
|
73
|
-
png.interlace_method.should == 0
|
74
|
-
end
|
75
|
-
|
76
|
-
it "should read the image data chunk correctly" do
|
77
|
-
png = Prawn::Images::PNG.new(@img_data)
|
78
|
-
data = Zlib::Inflate.inflate(File.binread(@data_filename))
|
79
|
-
png.img_data.should == data
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
describe "When reading an RGB PNG file with transparency (color type 2)" do
|
84
|
-
|
85
|
-
before(:each) do
|
86
|
-
@filename = "#{Prawn::DATADIR}/images/arrow2.png"
|
87
|
-
@img_data = File.binread(@filename)
|
88
|
-
end
|
89
|
-
|
90
|
-
# In a RGB type 2 PNG image, the tRNS chunk should contain a single RGB value
|
91
|
-
# that indicates the color that should be interpreted as transparent. In this
|
92
|
-
# case it's green.
|
93
|
-
#
|
94
|
-
# http://www.w3.org/TR/PNG/#11tRNS
|
95
|
-
it "should read the tRNS chunk correctly" do
|
96
|
-
png = Prawn::Images::PNG.new(@img_data)
|
97
|
-
png.transparency[:rgb].should == [0, 255, 0]
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
# TODO: describe "When reading an indexed color PNG file wiih transparency (color type 3)"
|
102
|
-
|
103
|
-
describe "When reading an indexed color PNG file (color type 3)" do
|
104
|
-
|
105
|
-
before(:each) do
|
106
|
-
@filename = "#{Prawn::DATADIR}/images/indexed_color.png"
|
107
|
-
@data_filename = "#{Prawn::DATADIR}/images/indexed_color.dat"
|
108
|
-
@img_data = File.binread(@filename)
|
109
|
-
end
|
110
|
-
|
111
|
-
it "should read the attributes from the header chunk correctly" do
|
112
|
-
png = Prawn::Images::PNG.new(@img_data)
|
113
|
-
|
114
|
-
png.width.should == 150
|
115
|
-
png.height.should == 200
|
116
|
-
png.bits.should == 8
|
117
|
-
png.color_type.should == 3
|
118
|
-
png.compression_method.should == 0
|
119
|
-
png.filter_method.should == 0
|
120
|
-
png.interlace_method.should == 0
|
121
|
-
end
|
122
|
-
|
123
|
-
it "should read the image data chunk correctly" do
|
124
|
-
png = Prawn::Images::PNG.new(@img_data)
|
125
|
-
data = Zlib::Inflate.inflate(File.binread(@data_filename))
|
126
|
-
png.img_data.should == data
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
describe "When reading a greyscale+alpha PNG file (color type 4)" do
|
131
|
-
|
132
|
-
before(:each) do
|
133
|
-
@filename = "#{Prawn::DATADIR}/images/page_white_text.png"
|
134
|
-
@color_data_filename = "#{Prawn::DATADIR}/images/page_white_text.color"
|
135
|
-
@alpha_data_filename = "#{Prawn::DATADIR}/images/page_white_text.alpha"
|
136
|
-
@img_data = File.binread(@filename)
|
137
|
-
end
|
138
|
-
|
139
|
-
it "should read the attributes from the header chunk correctly" do
|
140
|
-
png = Prawn::Images::PNG.new(@img_data)
|
141
|
-
|
142
|
-
png.width.should == 16
|
143
|
-
png.height.should == 16
|
144
|
-
png.bits.should == 8
|
145
|
-
png.color_type.should == 4
|
146
|
-
png.compression_method.should == 0
|
147
|
-
png.filter_method.should == 0
|
148
|
-
png.interlace_method.should == 0
|
149
|
-
end
|
150
|
-
|
151
|
-
it "should correctly return the raw image data (with no alpha channel) from the image data chunk" do
|
152
|
-
png = Prawn::Images::PNG.new(@img_data)
|
153
|
-
png.split_alpha_channel!
|
154
|
-
data = File.binread(@color_data_filename)
|
155
|
-
png.img_data.should == data
|
156
|
-
end
|
157
|
-
|
158
|
-
it "should correctly extract the alpha channel data from the image data chunk" do
|
159
|
-
png = Prawn::Images::PNG.new(@img_data)
|
160
|
-
png.split_alpha_channel!
|
161
|
-
data = File.binread(@alpha_data_filename)
|
162
|
-
png.alpha_channel.should == data
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
describe "When reading an RGB+alpha PNG file (color type 6)" do
|
167
|
-
|
168
|
-
before(:each) do
|
169
|
-
@filename = "#{Prawn::DATADIR}/images/dice.png"
|
170
|
-
@color_data_filename = "#{Prawn::DATADIR}/images/dice.color"
|
171
|
-
@alpha_data_filename = "#{Prawn::DATADIR}/images/dice.alpha"
|
172
|
-
@img_data = File.binread(@filename)
|
173
|
-
end
|
174
|
-
|
175
|
-
it "should read the attributes from the header chunk correctly" do
|
176
|
-
png = Prawn::Images::PNG.new(@img_data)
|
177
|
-
|
178
|
-
png.width.should == 320
|
179
|
-
png.height.should == 240
|
180
|
-
png.bits.should == 8
|
181
|
-
png.color_type.should == 6
|
182
|
-
png.compression_method.should == 0
|
183
|
-
png.filter_method.should == 0
|
184
|
-
png.interlace_method.should == 0
|
185
|
-
end
|
186
|
-
|
187
|
-
it "should correctly return the raw image data (with no alpha channel) from the image data chunk" do
|
188
|
-
png = Prawn::Images::PNG.new(@img_data)
|
189
|
-
png.split_alpha_channel!
|
190
|
-
data = File.binread(@color_data_filename)
|
191
|
-
png.img_data.should == data
|
192
|
-
end
|
193
|
-
|
194
|
-
it "should correctly extract the alpha channel data from the image data chunk" do
|
195
|
-
png = Prawn::Images::PNG.new(@img_data)
|
196
|
-
png.split_alpha_channel!
|
197
|
-
data = File.binread(@alpha_data_filename)
|
198
|
-
png.alpha_channel.should == data
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
describe "When reading a 16bit RGB+alpha PNG file (color type 6)" do
|
203
|
-
|
204
|
-
before(:each) do
|
205
|
-
@filename = "#{Prawn::DATADIR}/images/16bit.png"
|
206
|
-
@color_data_filename = "#{Prawn::DATADIR}/images/16bit.color"
|
207
|
-
# alpha channel truncated to 8-bit
|
208
|
-
@alpha_data_filename = "#{Prawn::DATADIR}/images/16bit.alpha"
|
209
|
-
@img_data = File.binread(@filename)
|
210
|
-
end
|
211
|
-
|
212
|
-
it "should read the attributes from the header chunk correctly" do
|
213
|
-
png = Prawn::Images::PNG.new(@img_data)
|
214
|
-
|
215
|
-
png.width.should == 32
|
216
|
-
png.height.should == 32
|
217
|
-
png.bits.should == 16
|
218
|
-
png.color_type.should == 6
|
219
|
-
png.compression_method.should == 0
|
220
|
-
png.filter_method.should == 0
|
221
|
-
png.interlace_method.should == 0
|
222
|
-
end
|
223
|
-
|
224
|
-
it "should correctly return the raw image data (with no alpha channel) from the image data chunk" do
|
225
|
-
png = Prawn::Images::PNG.new(@img_data)
|
226
|
-
png.split_alpha_channel!
|
227
|
-
data = File.binread(@color_data_filename)
|
228
|
-
png.img_data.should == data
|
229
|
-
end
|
230
|
-
|
231
|
-
it "should correctly extract the alpha channel data from the image data chunk" do
|
232
|
-
png = Prawn::Images::PNG.new(@img_data)
|
233
|
-
png.split_alpha_channel!
|
234
|
-
data = File.binread(@alpha_data_filename)
|
235
|
-
png.alpha_channel.should == data
|
236
|
-
end
|
237
|
-
end
|
data/spec/reference_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
|
4
|
-
|
5
|
-
describe "A Reference object" do
|
6
|
-
describe "generated via Prawn::Document" do
|
7
|
-
it "should return a proper reference on ref!" do
|
8
|
-
pdf = Prawn::Document.new
|
9
|
-
pdf.ref!({}).is_a?(PDF::Core::Reference).should == true
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should return an identifier on ref" do
|
13
|
-
pdf = Prawn::Document.new
|
14
|
-
r = pdf.ref({})
|
15
|
-
r.is_a?(Integer).should == true
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should have :Length of stream if it has one when compression disabled" do
|
19
|
-
pdf = Prawn::Document.new :compress => false
|
20
|
-
ref = pdf.ref!({})
|
21
|
-
ref << 'Hello'
|
22
|
-
ref.stream.data[:Length].should == 5
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|