test/command_node_test.rb in clbustos-rtf-0.3.1 vs test/command_node_test.rb in clbustos-rtf-0.4.2

- old
+ new

@@ -1,6 +1,6 @@ -require 'test_helper' +require File.expand_path(File.dirname(__FILE__)+'/test_helper') # Information class unit test class. class CommandNodeTest < Test::Unit::TestCase def test_basics nodes = [] @@ -38,11 +38,11 @@ root = CommandNode.new(nil, nil) style = ParagraphStyle.new assert(root.paragraph(style) != nil) assert(root.size == 1) - assert(root[0].class == CommandNode) + assert(root[0].class == ParagraphNode) assert(root[0].prefix == '\pard\ql') assert(root[0].suffix == '\par') assert(root.split == true) style.justification = ParagraphStyle::RIGHT_JUSTIFY @@ -203,9 +203,35 @@ assert(table.columns == 3) assert(table[0][0].width == 100) assert(table[0][1].width == 150) assert(table[0][2].width == 200) + end + + # List object model test + def test_list + root = Document.new(Font.new(Font::ROMAN, 'Arial')) + root.list do |l1| + assert l1.class == ListLevelNode + assert l1.level == 1 + + l1.item do |li| + assert li.class == ListTextNode + text = li << 'text' + assert text.class == TextNode + assert text.text == 'text' + end + + l1.list do |l2| + assert l2.class == ListLevelNode + assert l2.level == 2 + l2.item do |li| + text = li << 'text' + assert text.class == TextNode + assert text.text == 'text' + end + end + end end # This test checks the previous_node and next_node methods that could not be # fully and properly checked in the NodeTest.rb file. def test_peers