diff options
| author | Randy Morgan <[email protected]> | 2012-07-03 21:30:29 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-07-03 21:30:29 +0900 |
| commit | 35003679eb493f4cce078af203e5752cf75f30ef (patch) | |
| tree | c7f2c5c3f381fea9e1b283481b835fbc41b6b472 /test | |
| parent | 6949b1d1b0828d9af3974806e51523f5c2179ccd (diff) | |
| download | caxlsx-35003679eb493f4cce078af203e5752cf75f30ef.tar.gz caxlsx-35003679eb493f4cce078af203e5752cf75f30ef.zip | |
more snake casing work
Diffstat (limited to 'test')
| -rw-r--r-- | test/drawing/tc_bar_3D_chart.rb | 24 | ||||
| -rw-r--r-- | test/drawing/tc_chart.rb | 6 | ||||
| -rw-r--r-- | test/drawing/tc_pie_3D_chart.rb | 10 | ||||
| -rw-r--r-- | test/drawing/tc_view_3D.rb | 36 |
4 files changed, 34 insertions, 42 deletions
diff --git a/test/drawing/tc_bar_3D_chart.rb b/test/drawing/tc_bar_3D_chart.rb index 1f78fa0b..3e1ff342 100644 --- a/test/drawing/tc_bar_3D_chart.rb +++ b/test/drawing/tc_bar_3D_chart.rb @@ -15,15 +15,15 @@ class TestBar3DChart < Test::Unit::TestCase def test_initialization assert_equal(@chart.grouping, :clustered, "grouping defualt incorrect") assert_equal(@chart.series_type, Axlsx::BarSeries, "series type incorrect") - assert_equal(@chart.barDir, :bar, " bar direction incorrect") - assert(@chart.catAxis.is_a?(Axlsx::CatAxis), "category axis not created") - assert(@chart.valAxis.is_a?(Axlsx::ValAxis), "value access not created") + assert_equal(@chart.bar_dir, :bar, " bar direction incorrect") + assert(@chart.cat_axis.is_a?(Axlsx::CatAxis), "category axis not created") + assert(@chart.val_axis.is_a?(Axlsx::ValAxis), "value access not created") end def test_bar_direction - assert_raise(ArgumentError, "require valid bar direction") { @chart.barDir = :left } - assert_nothing_raised("allow valid bar direction") { @chart.barDir = :col } - assert(@chart.barDir == :col) + assert_raise(ArgumentError, "require valid bar direction") { @chart.bar_dir = :left } + assert_nothing_raised("allow valid bar direction") { @chart.bar_dir = :col } + assert(@chart.bar_dir == :col) end def test_grouping @@ -34,15 +34,15 @@ class TestBar3DChart < Test::Unit::TestCase def test_gapWidth - assert_raise(ArgumentError, "require valid gap width") { @chart.gapWidth = 200 } - assert_nothing_raised("allow valid gapWidth") { @chart.gapWidth = "200%" } - assert(@chart.gapWidth == "200%") + assert_raise(ArgumentError, "require valid gap width") { @chart.gap_width = 200 } + assert_nothing_raised("allow valid gapWidth") { @chart.gap_width = "200%" } + assert(@chart.gap_width == "200%") end def test_gapDepth - assert_raise(ArgumentError, "require valid gapDepth") { @chart.gapDepth = 200 } - assert_nothing_raised("allow valid gapDepth") { @chart.gapDepth = "200%" } - assert(@chart.gapDepth == "200%") + assert_raise(ArgumentError, "require valid gap_depth") { @chart.gap_depth = 200 } + assert_nothing_raised("allow valid gap_depth") { @chart.gap_depth = "200%" } + assert(@chart.gap_depth == "200%") end def test_shape diff --git a/test/drawing/tc_chart.rb b/test/drawing/tc_chart.rb index 13c400a3..e6ead247 100644 --- a/test/drawing/tc_chart.rb +++ b/test/drawing/tc_chart.rb @@ -77,11 +77,7 @@ class TestChart < Test::Unit::TestCase def test_to_xml_string schema = Nokogiri::XML::Schema(File.open(Axlsx::DRAWING_XSD)) doc = Nokogiri::XML(@chart.to_xml_string) - errors = [] - schema.validate(doc).each do |error| - errors.push error - puts error.message - end + errors = schema.validate(doc).map { |error| puts error.message; error } assert(errors.empty?, "error free validation") end diff --git a/test/drawing/tc_pie_3D_chart.rb b/test/drawing/tc_pie_3D_chart.rb index 5ac16e68..5e671989 100644 --- a/test/drawing/tc_pie_3D_chart.rb +++ b/test/drawing/tc_pie_3D_chart.rb @@ -13,19 +13,15 @@ class TestPie3DChart < Test::Unit::TestCase end def test_initialization - assert_equal(@chart.view3D.rotX, 30, "view 3d default rotX incorrect") - assert_equal(@chart.view3D.perspective, 30, "view 3d default perspective incorrect") + assert_equal(@chart.view_3D.rot_x, 30, "view 3d default rot_x incorrect") + assert_equal(@chart.view_3D.perspective, 30, "view_3d default perspective incorrect") assert_equal(@chart.series_type, Axlsx::PieSeries, "series type incorrect") end def test_to_xml schema = Nokogiri::XML::Schema(File.open(Axlsx::DRAWING_XSD)) doc = Nokogiri::XML(@chart.to_xml_string) - errors = [] - schema.validate(doc).each do |error| - errors.push error - puts error.message - end + errors = schema.validate(doc).map {|error| puts error.message; error } assert(errors.empty?, "error free validation") end diff --git a/test/drawing/tc_view_3D.rb b/test/drawing/tc_view_3D.rb index e9626c75..5f6809ef 100644 --- a/test/drawing/tc_view_3D.rb +++ b/test/drawing/tc_view_3D.rb @@ -9,33 +9,33 @@ class TestView3D < Test::Unit::TestCase end def test_options - v = Axlsx::View3D.new :rotX => 10, :rotY => 5, :hPercent => "30%", :depthPercent => "45%", :rAngAx => false, :perspective => 10 - assert_equal(v.rotX, 10) - assert_equal(v.rotY, 5) - assert_equal(v.hPercent, "30%") - assert_equal(v.depthPercent, "45%") - assert_equal(v.rAngAx, false) + v = Axlsx::View3D.new :rot_x => 10, :rot_y => 5, :h_percent => "30%", :depth_percent => "45%", :r_ang_ax => false, :perspective => 10 + assert_equal(v.rot_x, 10) + assert_equal(v.rot_y, 5) + assert_equal(v.h_percent, "30%") + assert_equal(v.depth_percent, "45%") + assert_equal(v.r_ang_ax, false) assert_equal(v.perspective, 10) end - def test_rotX - assert_raise(ArgumentError) {@view.rotX = "bob"} - assert_nothing_raised {@view.rotX = -90} + def test_rot_x + assert_raise(ArgumentError) {@view.rot_x = "bob"} + assert_nothing_raised {@view.rot_x = -90} end - def test_rotY - assert_raise(ArgumentError) {@view.rotY = "bob"} - assert_nothing_raised {@view.rotY = 90} + def test_rot_y + assert_raise(ArgumentError) {@view.rot_y = "bob"} + assert_nothing_raised {@view.rot_y = 90} end - def test_hPercent - assert_raise(ArgumentError) {@view.hPercent = "bob"} - assert_nothing_raised {@view.hPercent = "500%"} + def test_h_percent + assert_raise(ArgumentError) {@view.h_percent = "bob"} + assert_nothing_raised {@view.h_percent = "500%"} end - def test_depthPercent - assert_raise(ArgumentError) {@view.depthPercent = "bob"} - assert_nothing_raised {@view.depthPercent = "20%"} + def test_depth_percent + assert_raise(ArgumentError) {@view.depth_percent = "bob"} + assert_nothing_raised {@view.depth_percent = "20%"} end |
