# -*- coding: utf-8 -*- require 'helper' class TestRegressionAutofilter07 < Test::Unit::TestCase def setup setup_dir_var end def teardown File.delete(@xlsx) if File.exist?(@xlsx) end def test_autofilter07 @xlsx = 'autofilter07.xlsx' workbook = WriteXLSX.new(@xlsx) worksheet = workbook.add_worksheet # Extract the data embedded at the end of this file. headings = %w[Region Item Volume Month] data = [] data_lines.split(/\n/).each { |line| data << line.split } worksheet.write('D3', headings) worksheet.autofilter('D3:G53') worksheet.filter_column('D', 'Region eq East') # Hide the rows that don't match the filter criteria. row = 3 data.each do |row_data| region = row_data[0] if region == 'East' # Row is visible. else # Hide row. worksheet.set_row(row, nil, nil, 1) end worksheet.write(row, 3, row_data) row += 1 end workbook.close compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx, nil, {'xl/workbook.xml' => ['