summaryrefslogtreecommitdiffhomepage
path: root/test/drawing/tc_str_data.rb
blob: e8fc04418dd9a5d0dfaa03e4c50dbc3aa0fe4095 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

require 'tc_helper'

class TestStrData < Test::Unit::TestCase
  def setup
    @str_data = Axlsx::StrData.new :data => ["1", "2", "3"]
  end

  def test_to_xml_string_strLit
    str = '<?xml version="1.0" encoding="UTF-8"?>'
    str << '<c:chartSpace xmlns:c="' << Axlsx::XML_NS_C << '">'
    str << @str_data.to_xml_string
    doc = Nokogiri::XML(str)

    assert_equal(1, doc.xpath("//c:strLit/c:ptCount[@val=3]").size)
    assert_equal(1, doc.xpath("//c:strLit/c:pt/c:v[text()='1']").size)
  end
end