summaryrefslogtreecommitdiffhomepage
path: root/test/drawing
diff options
context:
space:
mode:
authorrandym <[email protected]>2018-02-08 00:14:12 +0900
committerrandym <[email protected]>2018-02-08 00:14:12 +0900
commit747ff93269c518db21c9869b61b1d1470395b502 (patch)
tree16c8d9c416a02fc7ca8bd91e058ea61c72dfc7ce /test/drawing
parent3f34514ecf53fb4a3401b5336833bbeb439efe2a (diff)
downloadcaxlsx-747ff93269c518db21c9869b61b1d1470395b502.tar.gz
caxlsx-747ff93269c518db21c9869b61b1d1470395b502.zip
chore(coverage) increase coverage and cleanup
Diffstat (limited to 'test/drawing')
-rw-r--r--test/drawing/tc_pic.rb7
-rw-r--r--test/drawing/tc_scatter_series.rb21
-rw-r--r--test/drawing/tc_title.rb5
3 files changed, 23 insertions, 10 deletions
diff --git a/test/drawing/tc_pic.rb b/test/drawing/tc_pic.rb
index 2c58fcfd..67e6c416 100644
--- a/test/drawing/tc_pic.rb
+++ b/test/drawing/tc_pic.rb
@@ -9,10 +9,7 @@ class TestPic < Test::Unit::TestCase
@test_img_png = File.dirname(__FILE__) + "/../../examples/image1.png"
@test_img_gif = File.dirname(__FILE__) + "/../../examples/image1.gif"
@test_img_fake = File.dirname(__FILE__) + "/../../examples/image1_fake.jpg"
- @image = ws.add_image :image_src => @test_img, :hyperlink => 'https://github.com/randym', :tooltip => "What's up doc?"
- end
-
- def teardown
+ @image = ws.add_image :image_src => @test_img, :hyperlink => 'https://github.com/randym', :tooltip => "What's up doc?", :opacity => 5
end
def test_initialization
@@ -40,6 +37,7 @@ class TestPic < Test::Unit::TestCase
assert_equal(200, @image.width)
end
+
def test_hyperlink
assert_equal(@image.hyperlink.href, "https://github.com/randym")
@image.hyperlink = "http://axlsx.blogspot.com"
@@ -102,5 +100,4 @@ class TestPic < Test::Unit::TestCase
doc = Nokogiri::XML(@image.anchor.drawing.to_xml_string)
assert_equal r_id, doc.xpath("//a:blip").first["r:embed"]
end
-
end
diff --git a/test/drawing/tc_scatter_series.rb b/test/drawing/tc_scatter_series.rb
index 62a338b1..ea3611ab 100644
--- a/test/drawing/tc_scatter_series.rb
+++ b/test/drawing/tc_scatter_series.rb
@@ -18,28 +18,39 @@ class TestScatterSeries < Test::Unit::TestCase
@series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"smoothed exponents"
assert(@series.smooth, "series is smooth by default on smooth charts")
end
-
+
def test_unsmoothed_chart_default_smoothing
@chart = @ws.add_chart Axlsx::ScatterChart, :title => "Unsmooth Chart", :scatter_style => :line
@series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"unsmoothed exponents"
assert([email protected], "series is not smooth by default on non-smooth charts")
end
-
+
def test_explicit_smoothing
@chart = @ws.add_chart Axlsx::ScatterChart, :title => "Unsmooth Chart, Smooth Series", :scatter_style => :line
@series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"smoothed exponents", :smooth => true
assert(@series.smooth, "series is smooth when overriding chart default")
- end
-
+ end
+
def test_explicit_unsmoothing
@chart = @ws.add_chart Axlsx::ScatterChart, :title => "Smooth Chart, Unsmooth Series", :scatter_style => :smoothMarker
@series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"unsmoothed exponents", :smooth => false
assert([email protected], "series is not smooth when overriding chart default")
- end
+ end
+
+ def test_ln_width
+ @chart = @ws.add_chart Axlsx::ScatterChart, :title => "ln width", :scatter_style => :line
+ @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"ln_width"
+ @series.ln_width = 12700
+ assert_equal(@series.ln_width, 12700, 'line width assigment is allowed')
+ end
def test_to_xml_string
+ @chart.scatter_style = :line
+ @series.ln_width = 12700
doc = Nokogiri::XML(@chart.to_xml_string)
+ assert_equal(12700, @series.ln_width)
assert_equal(doc.xpath("//a:srgbClr[@val='#{@series.color}']").size,4)
+ assert_equal(doc.xpath("//a:ln[@w='#{@series.ln_width}']").length, 1)
end
end
diff --git a/test/drawing/tc_title.rb b/test/drawing/tc_title.rb
index 84345150..95e44602 100644
--- a/test/drawing/tc_title.rb
+++ b/test/drawing/tc_title.rb
@@ -19,6 +19,11 @@ class TestTitle < Test::Unit::TestCase
assert(@title.cell == nil)
end
+ def test_initialize_title_size
+ title = Axlsx::Title.new 'bob', 90
+ assert_equal "90", title.text_size
+ end
+
def test_text
assert_raise(ArgumentError, "text must be a string") { @title.text = 123 }
@title.cell = @row.cells.first