# -*- coding: utf-8 -*- require 'helper' require 'write_xlsx' require 'stringio' class TestSparkline10 < Test::Unit::TestCase def setup @workbook = WriteXLSX.new(StringIO.new) @worksheet = @workbook.add_worksheet end def test_sparkline10 @worksheet.instance_variable_set(:@excel_version, 2010) @worksheet.select data = [-2, 2, 3, -1, 0] @worksheet.write('A1', data) # Set up sparklines @worksheet.add_sparkline( { :location => 'F1', :range => 'A1:E1', :high_point => 1, :low_point => 1, :negative_points => 1, :first_point => 1, :last_point => 1, :markers => 1, :series_color => '#C00000', :negative_color => '#FF0000', :markers_color => '#FFC000', :first_color => '#00B050', :last_color => '#00B0F0', :high_color => '#FFFF00', :low_color => '#92D050' } ) # End sparklines @worksheet.assemble_xml_file result = got_to_array(@worksheet.instance_variable_get(:@writer).string) expected = expected_to_array(expected_xml) assert_equal(expected, result) end def expected_xml < -2 2 3 -1 0 Sheet1!A1:E1 F1 EOS end end