Class: ODDB::FiPDF::TestChapterWrapper

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
ext/fipdf/test/test_chapter_wrapper.rb

Defined Under Namespace

Classes: StubChapter, StubFormat, StubSection, StubSectionWrapper

Instance Method Summary collapse

Instance Method Details

#setupObject



43
44
45
46
# File 'ext/fipdf/test/test_chapter_wrapper.rb', line 43

def setup
  @chapter = StubChapter.new
  @wrapper = ChapterWrapper.new(@chapter)
end

#test_need_new_page_noObject



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'ext/fipdf/test/test_chapter_wrapper.rb', line 76

def test_need_new_page_no
  @chapter.heading = "Laa Laa"
  fmt_heading = StubFormat.new
  fmt_heading.height = 8
  section = StubSection.new
  section.need_new_page = false
  @wrapper.wrapper_class = StubSectionWrapper
  @chapter.sections = [section]
  formats = {
    :chapter => fmt_heading
  }
  height = 10
  width = "ignored in this test"
  result = @wrapper.need_new_page?(height, width, formats)
  assert_equal(false, result)
end

#test_need_new_page_sectionObject



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'ext/fipdf/test/test_chapter_wrapper.rb', line 59

def test_need_new_page_section
  @chapter.heading = "Lala"
  fmt_heading = StubFormat.new
  fmt_heading.height = 8
  section = StubSection.new
  section.need_new_page = true
  @wrapper.wrapper_class = StubSectionWrapper
  @chapter.sections = [section]
  fmt_section = StubFormat.new
  formats = {
    :chapter => fmt_heading
  }
  height = 10
  width = "ignored in this test"
  result = @wrapper.need_new_page?(height, width, formats)
  assert_equal(true, result)
end

#test_need_new_page_with_headingObject



47
48
49
50
51
52
53
54
55
56
57
58
# File 'ext/fipdf/test/test_chapter_wrapper.rb', line 47

def test_need_new_page_with_heading
  @chapter.heading = "Teletubbie"
  fmt_heading = StubFormat.new
  fmt_heading.height = 8
  formats = {
    :chapter => fmt_heading
  }
  height = 7 
  width = "ignored in this test"
  result = @wrapper.need_new_page?(height, width, formats)
  assert_equal(true, result)
end