Sha256: fdff953cce1b9c7fdd76f5d4ba3bfbb0adeaaa7ea6d50f20a1c7417cea99fd8a

Contents?: true

Size: 1.4 KB

Versions: 6

Compression:

Stored size: 1.4 KB

Contents

# -*- coding: utf-8 -*-
require 'helper'
require 'write_xlsx/chart'

class TestWriteNumberFormat < Test::Unit::TestCase
  def setup
    @chart = Writexlsx::Chart.new('Bar')
  end

  def test_write_number_format
    axis = Writexlsx::Chart::Axis.new
    axis.num_format = 'General'
    axis.defaults   = { :num_format => 'General' }

    expected = '<c:numFmt formatCode="General" sourceLinked="1"/>'
    result = @chart.__send__('write_number_format', axis)
    assert_equal(expected, result)
  end

  def test_write_number_format02
    axis = Writexlsx::Chart::Axis.new
    axis.num_format = '#,##0.00'
    axis.defaults   = { :num_format => 'General' }

    expected = '<c:numFmt formatCode="#,##0.00" sourceLinked="0"/>'
    result = @chart.__send__('write_number_format', axis)
    assert_equal(expected, result)
  end

  def test_write_number_format03
    axis = Writexlsx::Chart::Axis.new
    axis.num_format = 'General'
    axis.defaults   = { :num_format => 'General' }

    expected = ''
    result = @chart.__send__('write_cat_number_format', axis)
    assert_equal(expected, result)
  end

  def test_write_number_format04
    axis = Writexlsx::Chart::Axis.new
    axis.num_format = '#,##0.00'
    axis.defaults   = { :num_format => 'General' }

    expected = '<c:numFmt formatCode="#,##0.00" sourceLinked="0"/>'
    result = @chart.__send__('write_cat_number_format', axis)
    assert_equal(expected, result)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
write_xlsx-0.70.0 test/chart/test_write_number_format.rb
write_xlsx-0.69.0 test/chart/test_write_number_format.rb
write_xlsx-0.65.1 test/chart/test_write_number_format.rb
write_xlsx-0.65.0 test/chart/test_write_number_format.rb
write_xlsx-0.64.1 test/chart/test_write_number_format.rb
write_xlsx-0.64.0 test/chart/test_write_number_format.rb