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  9d0b188ccf14a1c9afe55ef9fe36125376f8bdcf
tree    db9f401bb73049198f0246798e74ccfad137b4d0
parent  39d364d26736a2c0378d522f2928157c76cc009a
...
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