Sha256: dab568675b6e8db19571e4d994cd4a03eab75aac7d66bb40428b02f68fef1e56

Contents?: true

Size: 1.2 KB

Versions: 19

Compression:

Stored size: 1.2 KB

Contents

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

class TestWriteCalcPr < Minitest::Test
  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

19 entries across 19 versions & 1 rubygems

Version Path
write_xlsx-1.09.4 test/workbook/test_write_calc_pr.rb
write_xlsx-1.09.3 test/workbook/test_write_calc_pr.rb
write_xlsx-1.09.2 test/workbook/test_write_calc_pr.rb
write_xlsx-1.09.1 test/workbook/test_write_calc_pr.rb
write_xlsx-1.09.0 test/workbook/test_write_calc_pr.rb
write_xlsx-1.08.2 test/workbook/test_write_calc_pr.rb
write_xlsx-1.08.1 test/workbook/test_write_calc_pr.rb
write_xlsx-1.08.0 test/workbook/test_write_calc_pr.rb
write_xlsx-1.07.0 test/workbook/test_write_calc_pr.rb
write_xlsx-1.04.0 test/workbook/test_write_calc_pr.rb
write_xlsx-1.02.0 test/workbook/test_write_calc_pr.rb
write_xlsx-1.01.0 test/workbook/test_write_calc_pr.rb
write_xlsx-1.00.0 test/workbook/test_write_calc_pr.rb
write_xlsx-0.99.0 test/workbook/test_write_calc_pr.rb
write_xlsx-0.97.0 test/workbook/test_write_calc_pr.rb
write_xlsx-0.90.0 test/workbook/test_write_calc_pr.rb
write_xlsx-0.89.0 test/workbook/test_write_calc_pr.rb
write_xlsx-0.88.0 test/workbook/test_write_calc_pr.rb
write_xlsx-0.87.0 test/workbook/test_write_calc_pr.rb