# -*- coding: utf-8 -*- require 'helper' require 'write_xlsx' require 'stringio' class TestSparkline09 < Minitest::Test def setup @workbook = WriteXLSX.new(StringIO.new) @worksheet = @workbook.add_worksheet end def test_sparkline09 @worksheet.instance_variable_set(:@excel_version, 2010) @worksheet.select data = [-2, 2, 3, -1, 0] # Set up sparklines # Test all the styles. (1..36).each do |i| @worksheet.write(i-1, 0, data) @worksheet.add_sparkline( { :location => "F#{i}", :range => "A#{i}:E#{i}", :style => i } ) end # 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 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 -2 2 3 -1 0 Sheet1!A36:E36 F36 Sheet1!A35:E35 F35 Sheet1!A34:E34 F34 Sheet1!A33:E33 F33 Sheet1!A32:E32 F32 Sheet1!A31:E31 F31 Sheet1!A30:E30 F30 Sheet1!A29:E29 F29 Sheet1!A28:E28 F28 Sheet1!A27:E27 F27 Sheet1!A26:E26 F26 Sheet1!A25:E25 F25 Sheet1!A24:E24 F24 Sheet1!A23:E23 F23 Sheet1!A22:E22 F22 Sheet1!A21:E21 F21 Sheet1!A20:E20 F20 Sheet1!A19:E19 F19 Sheet1!A18:E18 F18 Sheet1!A17:E17 F17 Sheet1!A16:E16 F16 Sheet1!A15:E15 F15 Sheet1!A14:E14 F14 Sheet1!A13:E13 F13 Sheet1!A12:E12 F12 Sheet1!A11:E11 F11 Sheet1!A10:E10 F10 Sheet1!A9:E9 F9 Sheet1!A8:E8 F8 Sheet1!A7:E7 F7 Sheet1!A6:E6 F6 Sheet1!A5:E5 F5 Sheet1!A4:E4 F4 Sheet1!A3:E3 F3 Sheet1!A2:E2 F2 Sheet1!A1:E1 F1 EOS end end