# -*- coding: utf-8 -*- require 'helper' require 'write_xlsx' require 'stringio' class TestCondFormat18 < Minitest::Test def setup @workbook = WriteXLSX.new(StringIO.new) @worksheet = @workbook.add_worksheet('') end ############################################################################### # # 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.write('A9', 9) @worksheet.write('A10', 10) @worksheet.write('A11', 11) @worksheet.write('A12', 12) @worksheet.conditional_formatting('=$A$3:$A$4,A1 , A6:$A$8 ,$A10 , A$12', { :type => '3_color_scale' } ) @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 9 10 11 12 EOS end end