public
Description: Fast, Nimble PDF Writer for Ruby
Homepage: http://prawn.majesticseacreature.com
Clone URL: git://github.com/sandal/prawn.git
Test nested bounding boxes. They still use absolute positioning to define the 
boxes (I didn't know that) [#30]
sandal (author)
Fri Jun 20 13:43:45 -0700 2008
commit  39d364d26736a2c0378d522f2928157c76cc009a
tree    1328de40aeee3160ea59eaf9890ddd9b269b9443
parent  dcfa7f8d047beb1da729cd46d60e862eb4eef189
...
44
45
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
0
@@ -44,3 +44,36 @@ describe "A bounding box" do
0
   end
0
 
0
 end
0
+
0
+describe "drawing bounding boxes" do
0
+
0
+  it "should restore the margin box when bounding box exits" do
0
+    @pdf = Prawn::Document.new
0
+    margin_box = @pdf.bounds
0
+
0
+    @pdf.bounding_box [100,500] do
0
+      #nothing
0
+    end
0
+
0
+    @pdf.bounds.should == margin_box
0
+
0
+  end
0
+
0
+  it "should restore the parent bounding box when calls are nested" do
0
+    @pdf = Prawn::Document.new
0
+    @pdf.bounding_box [100,500], :width => 300, :height => 300 do 
0
+
0
+      @pdf.bounds.absolute_top.should  == 500
0
+      @pdf.bounds.absolute_left.should == 100 
0
+
0
+      @pdf.bounding_box [50,200], :width => 100, :height => 100 do
0
+        @pdf.bounds.absolute_top.should == 200 
0
+        @pdf.bounds.absolute_left.should == 50
0
+      end
0
+
0
+      @pdf.bounds.absolute_top.should  == 500
0
+      @pdf.bounds.absolute_left.should == 100 
0
+
0
+    end
0
+  end
0
+end

Comments