Sha256: f9490ac2453cbee2d59b8ba5cf98acdead2a263ccaede6759ee089fbc99f818e

Contents?: true

Size: 1010 Bytes

Versions: 24

Compression:

Stored size: 1010 Bytes

Contents

require 'test/unit'

require 'rd/list.rb'
require 'rd/rd-struct'

include RD

class TestListItem < Test::Unit::TestCase
  def setup
    @a = ItemListItem.new
    @c1 = TextBlock.new
    @c2 = TextBlock.new
    @a.add_children_under_document_struct([@c1, @c2], DocumentStructure::RD)

    @b = ItemListItem.new
    @d1 = TextBlock.new
    @d11 = Emphasis.new
    @d1.add_child_under_document_struct(@d11, DocumentStructure::RD)
    @b.add_children_under_document_struct([@d1], DocumentStructure::RD)
  end
  
  def test_each_block
    exp = [@c1, @c2]
    i = 0
    @a.each_block do |b|
      assert_equal(exp[i], b)
      i += 1
    end

    exp = [@d1]
    i = 0
    @b.each_block do |b|
      assert_equal(exp[i], b)
      i += 1
    end
  end

  def test_each_element
    exp = [@a, @c1, @c2]
    i = 0
    @a.each_element do |b|
      assert_equal(exp[i], b)
      i += 1
    end

    exp = [@b, @d1, @d11]
    i = 0
    @b.each_element do |b|
      assert_equal(exp[i], b)
      i += 1
    end
  end

end

Version data entries

24 entries across 23 versions & 2 rubygems

Version Path
rdtool-0.6.27 test/test-list-item.rb
rdtool-0.6.26 test/test-list-item.rb
rdtool-0.6.25 test/test-list-item.rb
rdtool-0.6.23 test/test-list-item.rb