# -*- coding: utf-8 -*- require 'helper' require 'write_xlsx' require 'stringio' class TestCondFormat23 < Minitest::Test def setup @workbook = WriteXLSX.new(StringIO.new) @worksheet = @workbook.add_worksheet('') end ############################################################################### # # Tests for Excel::Writer::XLSX::Worksheet methods. # ############################################################################### # # Test the _assemble_xml_file() method. # # Test conditional formats. # def test_conditional_formats @worksheet.select # Start test code. @worksheet.write('A1', 1) @worksheet.write('A2', 2) @worksheet.write('A3', 3) @worksheet.write('A4', 4) @worksheet.write('A5', 5) @worksheet.write('A6', 6) @worksheet.write('A7', 7) @worksheet.write('A8', 8) @worksheet.conditional_formatting( 'A1', { :type => 'icon_set', :icon_style => '3_arrows_gray' } ) @worksheet.conditional_formatting( 'A2', { :type => 'icon_set', :icon_style => '3_traffic_lights' } ) @worksheet.conditional_formatting( 'A3', { :type => 'icon_set', :icon_style => '3_signs' } ) @worksheet.conditional_formatting( 'A4', { :type => 'icon_set', :icon_style => '3_symbols' } ) @worksheet.conditional_formatting( 'A5', { :type => 'icon_set', :icon_style => '4_arrows_gray' } ) @worksheet.conditional_formatting( 'A6', { :type => 'icon_set', :icon_style => '4_ratings' } ) @worksheet.conditional_formatting( 'A7', { :type => 'icon_set', :icon_style => '5_arrows' } ) @worksheet.conditional_formatting( 'A8', { :type => 'icon_set', :icon_style => '5_ratings' } ) # End test code. @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 < 1 2 3 4 5 6 7 8 EOS end end