public
Description: Fast, Nimble PDF Writer for Ruby
Homepage: http://prawn.majesticseacreature.com
Clone URL: git://github.com/sandal/prawn.git
Cover masking behaviour [#30]
sandal (author)
Fri Jun 20 13:56:51 -0700 2008
commit  a86c58def3765e69a0692e8a7fb98bb106cd8c09
tree    cadf44313be2b829df32704bf7891a2d5bf34f7e
parent  55e90a1e74ec8756d36eda8418a283e3d5a9af06
...
115
116
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
0
@@ -115,3 +115,18 @@ describe "When setting page layout" do
0
     page.size.should == Prawn::Document::PageGeometry::SIZES["A4"].reverse
0
   end   
0
 end
0
+
0
+describe "The mask() feature" do
0
+  it "should allow transactional restoration of attributes" do
0
+    @pdf = Prawn::Document.new
0
+    y, line_width = @pdf.y, @pdf.line_width
0
+    @pdf.mask(:y, :line_width) do
0
+      @pdf.y = y + 1
0
+      @pdf.line_width = line_width + 1
0
+      @pdf.y.should_not == y
0
+      @pdf.line_width.should_not == line_width
0
+    end
0
+    @pdf.y.should == y
0
+    @pdf.line_width.should == line_width 
0
+  end
0
+end

Comments