Class: ODDB::FiPDF::TestChapterWrapper

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

Defined Under Namespace

Classes: StubChapter, StubFormat, StubSection, StubSectionWrapper

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



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

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

- (Object) test_need_new_page_no



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'ext/fipdf/test/chapter_wrapper_test.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

- (Object) test_need_new_page_section



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'ext/fipdf/test/chapter_wrapper_test.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

- (Object) test_need_new_page_with_heading



47
48
49
50
51
52
53
54
55
56
57
58
# File 'ext/fipdf/test/chapter_wrapper_test.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