Sha256: a092b41c5e37309fff56bebc793b2e4ca5dc39196cc6b100e4ec7de357fd177c

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

# -*- coding: utf-8 -*-
require 'helper'
require 'write_xlsx'
require 'stringio'

class TestWriteSheetPr < Test::Unit::TestCase
  def setup
    @workbook = WriteXLSX.new(StringIO.new)
    @worksheet = @workbook.add_worksheet('')
  end

  def test_write_sheet_pr_fit_page
    @worksheet.instance_variable_get(:@print_style).fit_page = true
    @worksheet.__send__('write_sheet_pr')
    result = @worksheet.instance_variable_get(:@writer).string
    expected = '<sheetPr><pageSetUpPr fitToPage="1"/></sheetPr>'
    assert_equal(expected, result)
  end

  def test_write_sheet_pr_tab_color
    @worksheet.tab_color = 'red'
    @worksheet.__send__('write_sheet_pr')
    result = @worksheet.instance_variable_get(:@writer).string
    expected = '<sheetPr><tabColor rgb="FFFF0000"/></sheetPr>'
    assert_equal(expected, result)
  end

  def test_write_sheet_pr_fit_page_and_tab_color
    @worksheet.instance_variable_get(:@print_style).fit_page = true
    @worksheet.tab_color = 'red'
    @worksheet.__send__('write_sheet_pr')
    result = @worksheet.instance_variable_get(:@writer).string
    expected = '<sheetPr><tabColor rgb="FFFF0000"/><pageSetUpPr fitToPage="1"/></sheetPr>'
    assert_equal(expected, result)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
write_xlsx-0.64.1 test/worksheet/test_write_sheet_pr.rb
write_xlsx-0.64.0 test/worksheet/test_write_sheet_pr.rb