Sha256: bf72d6f37cfc637630af610c06eb664e42e3601f7be843e83243f2c2478afa83

Contents?: true

Size: 1.2 KB

Versions: 18

Compression:

Stored size: 1.2 KB

Contents

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

class TestWriteCalcPr < Test::Unit::TestCase
  def setup
    @workbook = WriteXLSX.new(StringIO.new)
  end

  def test_write_calc_pr
    @workbook.__send__('write_calc_pr')
    result = @workbook.xml_str
    expected = '<calcPr calcId="124519" fullCalcOnLoad="1"/>'
    assert_equal(expected, result)
  end

  def test_write_calc_pr_with_auto_except_tables_mode
    @workbook.set_calc_mode('auto_except_tables')
    @workbook.__send__('write_calc_pr')
    result = @workbook.xml_str
    expected = '<calcPr calcId="124519" calcMode="autoNoTable" fullCalcOnLoad="1"/>'
    assert_equal(expected, result)
  end

  def test_write_calc_pr_with_manual_mode
    @workbook.set_calc_mode('manual')
    @workbook.__send__('write_calc_pr')
    result = @workbook.xml_str
    expected = '<calcPr calcId="124519" calcMode="manual" calcOnSave="0"/>'
    assert_equal(expected, result)
  end

  def test_write_calc_pr_with_non_default_calc_id
    @workbook.set_calc_mode('auto', 12345)
    @workbook.__send__('write_calc_pr')
    result = @workbook.xml_str
    expected = '<calcPr calcId="12345" fullCalcOnLoad="1"/>'
    assert_equal(expected, result)
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
write_xlsx-0.86.0 test/workbook/test_write_calc_pr.rb
write_xlsx-0.85.11 test/workbook/test_write_calc_pr.rb
write_xlsx-0.85.10 test/workbook/test_write_calc_pr.rb
write_xlsx-0.85.9 test/workbook/test_write_calc_pr.rb
write_xlsx-0.85.8 test/workbook/test_write_calc_pr.rb
write_xlsx-0.85.7 test/workbook/test_write_calc_pr.rb
write_xlsx-0.85.6 test/workbook/test_write_calc_pr.rb
write_xlsx-0.85.5 test/workbook/test_write_calc_pr.rb
write_xlsx-0.85.4 test/workbook/test_write_calc_pr.rb
write_xlsx-0.85.3 test/workbook/test_write_calc_pr.rb
write_xlsx-0.85.2 test/workbook/test_write_calc_pr.rb
write_xlsx-0.85.1 test/workbook/test_write_calc_pr.rb
write_xlsx-0.83.0 test/workbook/test_write_calc_pr.rb
write_xlsx-0.81.1 test/workbook/test_write_calc_pr.rb
write_xlsx-0.81.0 test/workbook/test_write_calc_pr.rb
write_xlsx-0.80.0 test/workbook/test_write_calc_pr.rb
write_xlsx-0.79.0 test/workbook/test_write_calc_pr.rb
write_xlsx-0.78.0 test/workbook/test_write_calc_pr.rb