summaryrefslogtreecommitdiffhomepage
path: root/test/drawing/tc_graphic_frame.rb
blob: fc5743be0c97f541aa6a2ab2b84cd9087269f46d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

require 'tc_helper'

class TestGraphicFrame < Test::Unit::TestCase
  def setup
    p = Axlsx::Package.new
    @ws = p.workbook.add_worksheet
    @chart = @ws.add_chart Axlsx::Chart
    @frame = @chart.graphic_frame
  end

  def teardown; end

  def test_initialization
    assert(@frame.anchor.is_a?(Axlsx::TwoCellAnchor))
    assert_equal(@frame.chart, @chart)
  end

  def test_rId
    assert_equal @ws.drawing.relationships.for(@chart).Id, @frame.rId
  end

  def test_to_xml_has_correct_rId
    doc = Nokogiri::XML(@frame.to_xml_string)

    assert_equal @frame.rId, doc.xpath("//c:chart", doc.collect_namespaces).first["r:id"]
  end
end