summaryrefslogtreecommitdiffhomepage
path: root/test/drawing
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-05-30 08:39:35 +0900
committerRandy Morgan <[email protected]>2012-05-30 08:39:35 +0900
commit2ec3335c66e42158975a4d3531e12b5560444d3c (patch)
tree6ac36605737f3135f824e6e7550da7565a5ea980 /test/drawing
parentea66a00e1a6275ce263ba943c45d1e6ff844eb0c (diff)
downloadcaxlsx-2ec3335c66e42158975a4d3531e12b5560444d3c.tar.gz
caxlsx-2ec3335c66e42158975a4d3531e12b5560444d3c.zip
enable anchor swapping between one and two cell anchors for drawings
Diffstat (limited to 'test/drawing')
-rw-r--r--test/drawing/tc_pic.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/drawing/tc_pic.rb b/test/drawing/tc_pic.rb
index 5fc1f1c3..a892678d 100644
--- a/test/drawing/tc_pic.rb
+++ b/test/drawing/tc_pic.rb
@@ -18,6 +18,25 @@ class TestPic < Test::Unit::TestCase
assert_equal(@image.image_src, @test_img)
end
+ def test_anchor_swapping
+ #swap from one cell to two cell when end_at is specified
+ assert(@image.anchor.is_a?(Axlsx::OneCellAnchor))
+ start_at = @image.anchor.from
+ @image.end_at 10,5
+ assert(@image.anchor.is_a?(Axlsx::TwoCellAnchor))
+ assert_equal(start_at.col, @image.anchor.from.col)
+ assert_equal(start_at.row, @image.anchor.from.row)
+ assert_equal(10,@image.anchor.to.col)
+ assert_equal(5, @image.anchor.to.row)
+
+ #swap from two cell to one cell when width or height are specified
+ @image.width = 200
+ assert(@image.anchor.is_a?(Axlsx::OneCellAnchor))
+ assert_equal(start_at.col, @image.anchor.from.col)
+ assert_equal(start_at.row, @image.anchor.from.row)
+ assert_equal(200, @image.width)
+
+ end
def test_hyperlink
assert_equal(@image.hyperlink.href, "https://github.com/randym")
@image.hyperlink = "http://axlsx.blogspot.com"