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  55e90a1e74ec8756d36eda8418a283e3d5a9af06
tree    204bdee944868a555021c5274807ef5c59edb11f
parent  2e7740e75b84fb7b43d70383aad0ab6a47a770f0
...
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