Class: ODDB::TestFachinfoWriter

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

Defined Under Namespace

Classes: StubFachinfoDocument, StubRule, StubRule1, StubRule2

Instance Method Summary (collapse)

Instance Method Details

- (Object) extract_result_lines(output, search, before, after)



174
175
176
177
178
179
180
181
182
183
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 174

def extract_result_lines(output, search, before, after)
  lines = output.split("\n")
  idx = nil
  lines.each_with_index { |line, index|
    if(line.index(search))
      idx = index
    end
  }
  lines[idx-before, before + after + 1].join("\n")
end

- (Object) setup



169
170
171
172
173
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 169

def setup
  @today = Date.today.to_s.delete "-"
  @chapter = ODDB::Text::Chapter.new
  @writer = ODDB::FiPDF::FachinfoWriter.new
end

- (Object) test_add_destination

def test_write_index

      @writer.page_type_standard
      @writer.text("The rest of the File", 10)
      @writer.new_page
      @writer.new_page
      @writer.new_page
      products = [
        ["Ponstan", "Ywesee", 1, :generic, "2"],
      ]
      @writer.substance_index.store("Penicilin", products[0])
      @writer.prepare_substance_index
      @writer.new_page
      @writer.new_page
      @writer.new_page
      @writer.set_page_element_type(:page_type_substance_index)
      @writer.new_page
      @writer.instance_variable_set("@first_line_of_page", false)
      @writer.y  =  @writer.bottom_margin +
         1 * @writer.font_height(@writer.formats[:chapter_index].size) \
        + 2 * @writer.font_height(@writer.formats[:text_index].size) \
        + 1 * @writer.font_height(@writer.formats[:kombi_index].size) \
     - (@writer.formats[:kombi_index].spacing_before("foo") + @writer.formats[:chapter_index].spacing_before("foo") + @writer.formats[:text_index].spacing_before("foo")) - 0.1
      @writer.write_index
      #@writer.save_pdf
      expected = ""

BT 151.945 813.798 Td /F1 7.0 Tf 0 Tr (Penicilin) Tj ET< BT 151.945 806.362 Td /F5 6.0 Tf 0 Tr (Kombinationen) Tj ET< 0.000 0.400 0.000 rg< BT 151.945 800.004 Td /F3 5.5 Tf 0 Tr (Ponstan \(1\)) Tj ET< BT 151.945 793.646 Td /F5 5.5 Tf 0 Tr (Ywesee) Tj ET<

      EOS
      # NOTE: to avoid confusion about end-of-line whitespace, both
      #       expected and output have added "<"-signs at EOL
      output = @writer.render.gsub("\n", "<\n")
      result = extract_result_lines(output, 'Penicilin', 0, 4)
      message = "Expected: \n#{expected}\nin:\n#{result}"
      assert_not_nil(output.index(expected), message)
    end
    def test_widow_combination
      @writer.page_type_standard
      @writer.text("The rest of the File", 10)
      products = [
        ["Ponstan", "Ywesee", 1, :generic, "2"],
      ]
      @writer.substance_index.store("Penicilin", products[0])
      @writer.prepare_substance_index
      @writer.first_line_of_page = false
      @writer.y  = ODDB::FiPDF::FachinfoWriter::MARGIN_BOTTOM \
        + 2 * @writer.font_height(@writer.formats[:text_index].size) \
        + 1 * @writer.font_height(@writer.formats[:chapter_index].size) \
        + 1 * @writer.font_height(@writer.formats[:kombi_index].size) \
        - (@writer.formats[:kombi_index].spacing_before("foo")\
        + 1 * @writer.formats[:text_index].spacing_before("foo") + @writer.formats[:chapter_index].spacing_before("foo")) - 0.001 
      @writer.write_index
      #@writer.save_pdf
      expected = "BT 40.000 805.706 Td /F1 14.0 Tf 0 Tr ( WIRKSTOFFREGISTER ) Tj ET<\n0.000 0.000 0.000 rg<\n0.1 w 1 J <\n173.195 20.000 m 173.195 791.890 l S<\nBT 176.945 783.798 Td /F1 7.0 Tf 0 Tr (Penicilin) Tj ET<\nBT 176.945 776.362 Td /F5 6.0 Tf 0 Tr (Kombinationen) Tj ET<\n0.000 0.400 0.000 rg<\nBT 176.945 770.004 Td /F3 5.5 Tf 0 Tr (Ponstan \\\\(1\\\\)) Tj ET<\n"
      # NOTE: to avoid confusion about end-of-line whitespace, both
      #       expected and output have added "<"-signs at EOL
      output = @writer.render.gsub("\n", "<\n")
      result = extract_result_lines(output, 'WIRKSTOFF', 0, 8)
      message = "Expected: \n#{expected}\nin:\n#{result}"
      assert_not_nil(output.index(expected), message)
    end
    def test_write_combination
      @writer.page_type_standard
      @writer.text("The rest of the File", 10)
      @writer.new_page
      @writer.new_page
      @writer.new_page
      products = [
        ["FOO", "Ywesee", 1, :generic, "1"],
        ["Ponstan", "Ywesee", 1, :generic, "2"],
      ]
      @writer.substance_index.store("Penicilin", products[0])
      @writer.substance_index.store("Penicilin", products[1])
      @writer.prepare_substance_index
      @writer.new_page
      @writer.new_page
      @writer.new_page
      @writer.set_page_element_type(:page_type_substance_index)
      @writer.new_page
      @writer.first_line_of_page = false
      @writer.y  = ODDB::FiPDF::FachinfoWriter::MARGIN_BOTTOM \
        + 4 * @writer.font_height(@writer.formats[:text_index].size) \
        + 1 * @writer.font_height(@writer.formats[:chapter_index].size) \
        + 1 * @writer.font_height(@writer.formats[:kombi_index].size) \
        - (@writer.formats[:kombi_index].spacing_before("foo")\
        + 2 * @writer.formats[:text_index].spacing_before("foo") + @writer.formats[:chapter_index].spacing_before("foo")) - 2
      @writer.write_index
      #   @writer.save_pdf
      expected = "BT 151.945 814.954 Td /F5 6.0 Tf 0 Tr (Kombinationen) Tj ET<\n0.000 0.400 0.000 rg<\nBT 151.945 808.596 Td /F3 5.5 Tf 0 Tr (Ponstan \\\\(1\\\\)) Tj ET<\nBT 151.945 802.238 Td /F5 5.5 Tf 0 Tr (Ywesee) Tj ET<\n"
      # NOTE: to avoid confusion about end-of-line whitespace, both
      #       expected and output have added "<"-signs at EOL
      output = @writer.render.gsub("\n", "<\n")
      result = extract_result_lines(output, 'Penicilin', 0, 12)
      message = "Expected: \n#{expected}\nin:\n#{result}"
      assert_not_nil(output.index(expected), message)
    end
    def test_write_tuple
      @writer.set_page_element_type(:page_type_substance_title)
      @writer.fi_new_page
      product = ["Ponstan", "Ywesee", 1, "generic", "1"]
      @writer.prepare_substance_index
      @writer.new_page
      @writer.new_page
      @writer.new_page
      @writer.set_page_element_type(:page_type_substance_index)
      @writer.new_page
      @writer.first_line_of_page = false
      @writer.y  = 2 * @writer.font_height(\
        @writer.formats[:text_index].size) \
        + ODDB::FiPDF::FachinfoWriter::MARGIN_BOTTOM \
        - 1 * @writer.formats[:text_index].spacing_before(\
        "fooBaar") - 0.01
      @writer.write_tuple(product)
      #   @writer.save_pdf
      expected = "BT 151.945 815.532 Td /F3 5.5 Tf 0 Tr (Ponstan \\\\(1\\\\)) Tj ET<\nBT 151.945 809.174 Td /F5 5.5 Tf 0 Tr (Ywesee) Tj ET<\n"
      # NOTE: to avoid confusion about end-of-line whitespace, both
      #       expected and output have added "<"-signs at EOL
      output = @writer.render.gsub("\n", "<\n")
      result = extract_result_lines(output, 'Ponstan', 1, 1)
      message = "Expected: \n#{expected}\nin:\n#{result}"
      assert_not_nil(output.index(expected), message)
    end
    def test_write_tuple__company_on_2_lines
      @writer.set_page_element_type(:page_type_substance_index)
      @writer.fi_new_page
      product = ["PonstanPonstanPonstanPonstanPonstanPonstan und wieder Ponstan", "Ywesee", 1, "generic", "1"]
      @writer.prepare_substance_index
      @writer.new_page
      @writer.new_page
      @writer.new_page
      @writer.set_page_element_type(:page_type_substance_index)
      @writer.new_page
      @writer.first_line_of_page = false
      @writer.y  = 3 * @writer.font_height(\
        @writer.formats[:text_index].size) \
        + ODDB::FiPDF::FachinfoWriter::MARGIN_BOTTOM \
        - 1 * @writer.formats[:text_index].spacing_before(\
        "fooBaar") - 0.001
      @writer.write_tuple(product)
      #   @writer.save_pdf
      expected = "BT 151.945 815.532 Td /F3 5.5 Tf 0 Tr (PonstanPonstanPonstanPonstanPonstanPonstan) Tj ET<\nBT 151.945 809.174 Td /F3 5.5 Tf 0 Tr (und wieder Ponstan \\\\(1\\\\)) Tj ET<\nBT 151.945 802.816 Td /F5 5.5 Tf 0 Tr (Ywesee) Tj ET<\n"
      # NOTE: to avoid confusion about end-of-line whitespace, both
      #       expected and output have added "<"-signs at EOL
      output = @writer.render.gsub("\n", "<\n")
      result = extract_result_lines(output, 'Ponstan', 1, 2)
      message = "Expected: \n#{expected}\nin:\n#{result}"
      assert_not_nil(output.index(expected), message)
    end


900
901
902
903
904
905
906
907
908
909
910
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 900

def test_add_destination
  @writer.fi_new_page
  @writer.write_drug_name("<b>Foobaar</b>")
  #@writer.save_pdf
  expected = "[6 0 R /XYZ 40 821.89 0]<\n"
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  message = "Expected: \n#{expected}\nin:\n#{output}"
  assert_not_nil(output.index(expected), message)
end

- (Object) test_add_substance_name



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 184

def test_add_substance_name
  fachinfo = StubFachinfoDocument.new
  fachinfo.name = "Ponstan"
  fachinfo.company_name = "Ywesee"
  fachinfo.generic_type = :generic
  fachinfo.substance_names = ["Zucker", "Salz"]
  @writer.fi_page_number = 1
  expected = { 
    "Zucker" => [
      ["Ponstan", "Ywesee", "1", "generic", "2", "anchor0"]
    ],
    "Salz"    =>  [
      ["Ponstan", "Ywesee", "1", "generic", "2", "anchor0"]
    ],
  }
  assert_equal(expected, @writer.add_substance_name(fachinfo))
end

- (Object) test_anchor_name



1869
1870
1871
1872
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 1869

def test_anchor_name
  assert_equal('anchor3', @writer.anchor_name(3))
  assert_equal('anchor5', @writer.anchor_name(5))
end

- (Object) test_change_column_count



712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 712

def test_change_column_count
  @writer.page_type_standard
  @writer.text("The rest of the File", 10)
  @writer.new_page
  @writer.text('and its second column')
  @writer.new_page(true, @writer.first_page, :before)
 # @writer.col_num = 1
  @writer.page_type_substance_index
  @writer.text('index 1')
  @writer.new_page
  colnum =  @writer.column_number
  @writer.text('index 2')
  #@writer.save_pdf
  assert_equal(1, colnum)
end

- (Object) test_combination_substances



285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 285

def test_combination_substances
  substances = 
  [
    ["Aonstan", "Ywesee", "1", "generic", "1"],
    ["Bonstan", "Ywesee", "1", "generic", "3"],
    ["Constan", "Ywesee", "1", "generic", "5"],
    ["Donstan", "Ywesee", "1", "generic", "6"], 
    ["Eonstan", "Ywesee", "1", "generic", "2"],
  ]
  expected = 
  [
    ["Bonstan", "Ywesee", "1", "generic", "3"],
    ["Constan", "Ywesee", "1", "generic", "5"],
    ["Eonstan", "Ywesee", "1", "generic", "2"],
  ]
  assert_equal(expected, @writer.combination_substances(substances))
end

- (Object) test_draw_background



1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 1484

def test_draw_background
  fachinfo = StubFachinfoDocument.new
  fachinfo.name = "Ponstan"
  fachinfo.generic_type = :generic
  fachinfo.company_name = "Ywesee"
  ch1 = ODDB::Text::Chapter.new
  ch1.heading = "Zusammensetzung"
  sec1 = ch1.next_section
  sec1.subheading = "Wirkstoff"
  para1 = sec1.next_paragraph
  para1 << "The quick brown fox jumped over the lazy dogs" * 10
  fachinfo.chapters = [ch1]
  @writer.write_fachinfo(fachinfo)
  #@writer.save_pdf
  expected = "BT 188.528 798.238 Td /F4 7.0 Tf 0 Tr (Ywesee) Tj ET<\nBT 40.000 786.146 Td /F1 7.0 Tf 0 Tr (Zusammensetzung) Tj ET<\nBT 40.000 777.554 Td 1.887 Tw /F5 7.0 Tf 0 Tr (Wirkstoff ) Tj /F4 7.0 Tf 0 Tr (The quick brown fox jumped over the lazy) Tj ET<\nBT 40.000 769.462 Td 4.155 Tw /F4 7.0 Tf 0 Tr (dogsThe quick brown fox jumped over the lazy) Tj ET<\nBT 40.000 761.370 Td 4.155 Tw /F4 7.0 Tf 0 Tr (dogsThe quick brown fox jumped over the lazy) Tj ET<\nBT 40.000 753.278 Td 4.155 Tw /F4 7.0 Tf 0 Tr (dogsThe quick brown fox jumped over the lazy) Tj ET<\nBT 40.000 745.186 Td 4.155 Tw /F4 7.0 Tf 0 Tr (dogsThe quick brown fox jumped over the lazy) Tj ET<\nBT 40.000 737.094 Td 4.155 Tw /F4 7.0 Tf 0 Tr (dogsThe quick brown fox jumped over the lazy) Tj ET<\nBT 40.000 729.002 Td 4.155 Tw /F4 7.0 Tf 0 Tr (dogsThe quick brown fox jumped over the lazy) Tj ET<\nBT 40.000 720.910 Td 4.155 Tw /F4 7.0 Tf 0 Tr (dogsThe quick brown fox jumped over the lazy) Tj ET<\nBT 40.000 712.818 Td 4.155 Tw /F4 7.0 Tf 0 Tr (dogsThe quick brown fox jumped over the lazy) Tj ET<\nBT 40.000 704.726 Td 0.000 Tw /F4 7.0 Tf 0 Tr (dogsThe quick brown fox jumped over the lazy dogs) Tj ET<\n"
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  result = extract_result_lines(output, 'Ywesee', 4, 12)
  message = "Expected: \n#{expected}\nin:\n#{result}"
  assert_not_nil(output.index(expected), message)
end

- (Object) test_fachinfo_rule



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 201

def test_fachinfo_rule
  fachinfo = StubFachinfoDocument.new
  fachinfo.name = "Ponstan"
  fachinfo.company_name = "ywesee"
  fachinfo.generic_type = :generic
  ch1 = ODDB::Text::Chapter.new
  ch1.heading = "Zusammensetzung"
  sec1 = ch1.next_section
  sec1.subheading = "Wirkstoff"
  para1 = sec1.next_paragraph
  para1 << "paragraph 1 " * 10
  ch2 = ODDB::Text::Chapter.new
  ch2.heading = "Eigenschaften"
  sec2 = ch2.next_section
  sec2.subheading = "Hilfstoffe\n"
  para2 = sec2.next_paragraph
  para2 << "paragraph 2 " * 4
  fachinfo.chapters = [
    ch1,
  ]
  @writer.fi_new_page
  @writer.y  =  ODDB::FiPDF::FachinfoWriter::MARGIN_BOTTOM\
    + 8 * @writer.font_height(@writer.formats[:paragraph].size) 
  @writer.write_fachinfo(fachinfo)
  #@writer.write_substance_index
  #fachinfo2 = Marshal.load(Marshal.dump(fachinfo))
  #@writer.write_fachinfo(fachinfo2)
  #@writer.save_pdf
  #puts @writer.dump_bigvars
=begin
  expected = <<-EOS
  stream<
  <
  q<
  1.000 1.000 1.000 rg<
  35.000 821.890 183.427 -801.890 re f<
  0.1 w 1 J <
  Q<
  q<
  0.168 0.640 0.461 rg<
  218.427 803.882 183.427 18.008 re f<
  0.1 w 1 J <
  Q<
  q<
  0.635 1.000 0.627 rg<
  218.427 803.882 183.427 -64.524 re f<
  0.1 w 1 J <
  Q<
  <
  0.000 0.000 0.000 rg<
  BT 576.280 10.000 Td /F3 8.0 Tf (1) Tj ET<
  0.1 w 1 J <
  218.427 20.000 m 218.427 821.890 l S<
  q<
  0.1 w 1 J <
  Q<
  1.000 1.000 1.000 rg<
  BT 223.427 808.498 Td 0.000 Tw /F4 12.0 Tf (Ponstan) Tj ET<
  0.000 0.000 0.000 rg<
  BT 373.309 794.570 Td 0.000 Tw /F3 8.0 Tf (ywesee) Tj ET<
  BT 223.427 779.642 Td 0.000 Tw /F4 8.0 Tf (Zusammensetzung) Tj ET<
  BT 223.427 767.214 Td 4.023 Tw /F5 8.0 Tf (Wirkstoff) Tj /F3 8.0 Tf ( paragraph 1 paragraph 1 paragraph 1) Tj ET<
  BT 223.427 758.286 Td 2.213 Tw /F3 8.0 Tf (paragraph 1 paragraph 1 paragraph 1 paragraph 1) Tj ET<
  BT 223.427 749.358 Td 0.000 Tw /F3 8.0 Tf (paragraph 1 paragraph 1 paragraph 1) Tj ET<
  endstream<
  EOS
=end


  
  expected = "BT 223.427 810.330 Td /F1 10.0 Tf 0 Tr (Ponstan) Tj ET<\n"
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  possible_lines = []
  output.each_line { |line|
    if(line.index('Ponstan'))
      possible_lines << line
    end
  }
  message = "Expected: \n#{expected}\nin:\n#{possible_lines.join()}"
  assert_equal(true, possible_lines.include?(expected), message)
end

- (Object) test_generic_color



1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 1520

def test_generic_color
  map = ODDB::FiPDF::FachinfoWriter::COLOR_BG
  generic = Color::RGB.from_fraction(*map[:generic])
  unknown = Color::RGB.from_fraction(*map[:unknown])
  assert_equal(generic, @writer.generic_color(:generic))
  assert_equal(unknown, @writer.generic_color(nil))
  assert_equal(unknown, @writer.generic_color(nil))
  assert_equal(unknown, @writer.generic_color(:unknown, {}))
  
  map = {:unknown => [1,1,1], :other => [0,0,0]}
  bar = Color::RGB.from_fraction(0,0,0)
  foo = Color::RGB.from_fraction(1,1,1)
  assert_equal(bar, @writer.generic_color(:other, map))
  assert_equal(foo, @writer.generic_color(:bla, map))
end

- (Object) test_heading



317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 317

def test_heading
  @chapter.heading = "Ein Medikament"
  @writer.fi_new_page
  @writer.write_heading(@chapter)
  #@writer.save_pdf
  expected = "q<\nBT 575.832 10.000 Td /F4 8.0 Tf 0 Tr (1) Tj ET<\n1 w<\nQ<\nBT 40.000 813.798 Td /F1 7.0 Tf 0 Tr (Ein Medikament) Tj ET<\n"
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  result = extract_result_lines(output, 'Ein Medikament', 5, 0)
  message = "Expected: \n#{expected}\nin:\n#{result}"
  assert_not_nil(output.index(expected), message)
end

- (Object) test_orphan_chapter_text



1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 1641

def test_orphan_chapter_text
  chapter = ODDB::Text::Chapter.new
  chapter.heading << "Verbot"
  section = chapter.next_section
  section.subheading << "Drogen"
  paragraph1 = section.next_paragraph
  text = "Foo, Baar und Test  sind keine zugelassenen Heilmittel" *4
  paragraph1 << text
  @writer.fi_new_page
  @writer.first_line_of_page = false
  @writer.y  =  ODDB::FiPDF::FachinfoWriter::MARGIN_BOTTOM \
    + @writer.font_height(@writer.formats[:chapter].size) \
    - @writer.formats[:chapter].spacing_before("foo") \
    + 2 * @writer.font_height(@writer.formats[:paragraph].size) \
    - @writer.formats[:paragraph].spacing_before("foo") \
    - 0.001
  c_wrapper = ODDB::FiPDF::ChapterWrapper.new(chapter)
  @writer.write_chapter(c_wrapper)
  #@writer.save_pdf
  expected = "BT 223.427 805.206 Td 1.008 Tw /F5 7.0 Tf 0 Tr (Drogen ) Tj /F4 7.0 Tf 0 Tr (Foo, Baar und Test  sind keine zugelassenen) Tj ET<\nBT 223.427 797.114 Td 0.598 Tw /F4 7.0 Tf 0 Tr (HeilmittelFoo, Baar und Test  sind keine zugelassenen) Tj ET<\nBT 223.427 789.022 Td 0.598 Tw /F4 7.0 Tf 0 Tr (HeilmittelFoo, Baar und Test  sind keine zugelassenen) Tj ET<\nBT 223.427 780.930 Td 0.598 Tw /F4 7.0 Tf 0 Tr (HeilmittelFoo, Baar und Test  sind keine zugelassenen) Tj ET<\nBT 223.427 772.838 Td 0.000 Tw /F4 7.0 Tf 0 Tr (Heilmittel) Tj ET<\n"
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  result = extract_result_lines(output, 'Drogen', 1, 4)
  message = "Expected: \n#{expected}\nin:\n#{result}"
  assert_not_nil(output.index(expected), message)
end

- (Object) test_orphan_chapter_text_subheading_newline



1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 1675

def test_orphan_chapter_text_subheading_newline
  chapter = ODDB::Text::Chapter.new
  chapter.heading << "Verbot"
  section = chapter.next_section
  section.subheading << "Drogen\n"
  paragraph1 = section.next_paragraph
  text = "Foo, Baar und Test  sind keine zugelassenen Heilmittel" *4
  paragraph1 << text
  @writer.fi_new_page
  @writer.first_line_of_page = false
  c_wrapper = ODDB::FiPDF::ChapterWrapper.new(chapter)
  @writer.y  =  ODDB::FiPDF::FachinfoWriter::MARGIN_BOTTOM \
    + @writer.font_height(@writer.formats[:chapter].size)- @writer.formats[:chapter].spacing_before("foo")
  @writer.write_chapter(c_wrapper)
  #@writer.save_pdf
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #  expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  #the end of the file
  expected = "BT 223.427 813.798 Td /F1 7.0 Tf 0 Tr (Verbot) Tj ET<\nBT 223.427 804.206 Td /F5 7.0 Tf 0 Tr (Drogen) Tj ET<\nBT 223.427 795.614 Td 4.709 Tw /F4 7.0 Tf 0 Tr (Foo, Baar und Test  sind keine zugelassenen) Tj ET<\nBT 223.427 787.522 Td 0.598 Tw /F4 7.0 Tf 0 Tr (HeilmittelFoo, Baar und Test  sind keine zugelassenen) Tj ET<\nBT 223.427 779.430 Td 0.598 Tw /F4 7.0 Tf 0 Tr (HeilmittelFoo, Baar und Test  sind keine zugelassenen) Tj ET<\nBT 223.427 771.338 Td 0.598 Tw /F4 7.0 Tf 0 Tr (HeilmittelFoo, Baar und Test  sind keine zugelassenen) Tj ET<\nBT 223.427 763.246 Td 0.000 Tw /F4 7.0 Tf 0 Tr (Heilmittel) Tj ET<\n"
  message = "Expected: \n#{expected}\nin:\n#{output}"
  assert_not_nil(output.index(expected), message)
end

- (Object) test_orphan_paragraph



1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 1535

def test_orphan_paragraph
  text = "Foo, Baar und Test  sind keine zugelassenen Heilmittel " *4
  @writer.fi_new_page
  @writer.first_line_of_page = false
  @writer.y  =  ODDB::FiPDF::FachinfoWriter::MARGIN_BOTTOM  + 1 * @writer.font_height(@writer.formats[:paragraph].size) - @writer.formats[:paragraph].spacing_before("foo")
  paragraph = ODDB::Text::Paragraph.new
  paragraph << text
  p_wrapper = ODDB::FiPDF::ParagraphWrapper.new(paragraph)
  @writer.write_paragraph(p_wrapper)
  #@writer.save_pdf
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  #the end of the file
  expected = "BT 223.427 813.798 Td 0.280 Tw /F4 7.0 Tf 0 Tr (Foo, Baar und Test  sind keine zugelassenen Heilmittel) Tj ET<\nBT 223.427 805.706 Td 0.280 Tw /F4 7.0 Tf 0 Tr (Foo, Baar und Test  sind keine zugelassenen Heilmittel) Tj ET<\nBT 223.427 797.614 Td 0.280 Tw /F4 7.0 Tf 0 Tr (Foo, Baar und Test  sind keine zugelassenen Heilmittel) Tj ET<\nBT 223.427 789.522 Td 0.000 Tw /F4 7.0 Tf 0 Tr (Foo, Baar und Test  sind keine zugelassenen Heilmittel) Tj ET<\n"
  message = "Expected: \n#{expected}\nin:\n#{output}"
  assert_not_nil(output.index(expected), message)
end

- (Object) test_orphan_paragraph_text_subheading



1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 1559

def test_orphan_paragraph_text_subheading
  text = "Foo, Baar und Test  sind keine zugelassenen Heilmittel " *4
  @writer.fi_new_page
  @writer.first_line_of_page = false
  @writer.y  =  ODDB::FiPDF::FachinfoWriter::MARGIN_BOTTOM  + 4 * @writer.font_height(@writer.formats[:paragraph].size) - @writer.formats[:paragraph].spacing_before("foo")
  section  = ODDB::Text::Section.new
  section.subheading = "subheading"
  paragraph = section.next_paragraph
  paragraph << text
  s_wrapper = ODDB::FiPDF::SectionWrapper.new(section)
  @writer.write_section(s_wrapper)
  #@writer.save_pdf
  expected = "BT 40.000 44.276 Td 5.709 Tw /F5 7.0 Tf 0 Tr (subheading ) Tj /F4 7.0 Tf 0 Tr (Foo, Baar und Test  sind keine) Tj ET<\nBT 40.000 36.184 Td 0.280 Tw /F4 7.0 Tf 0 Tr (zugelassenen Heilmittel Foo, Baar und Test  sind keine) Tj ET<\nBT 40.000 28.092 Td 0.280 Tw /F4 7.0 Tf 0 Tr (zugelassenen Heilmittel Foo, Baar und Test  sind keine) Tj ET<\nq<\n1.000 1.000 1.000 rg<\n218.427 20.000 183.427 801.890 re f<\n1 w<\nQ<\nBT 223.427 813.798 Td 0.280 Tw /F4 7.0 Tf 0 Tr (zugelassenen Heilmittel Foo, Baar und Test  sind keine) Tj ET<\n"
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  result = extract_result_lines(output, 'subheading', 0, 10)
  message = "Expected: \n#{expected}\nin:\n#{result}"
  assert_not_nil(output.index(expected), message)
end

- (Object) test_orphan_paragraph_text_subheading_newline



1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 1590

def test_orphan_paragraph_text_subheading_newline
  text = "Foo, Baar und Test  sind keine zugelassenen Heilmittel " *4
  @writer.fi_new_page
  @writer.first_line_of_page = false
  @writer.y  =  ODDB::FiPDF::FachinfoWriter::MARGIN_BOTTOM  + 0 * @writer.font_height(@writer.formats[:paragraph].size) - @writer.formats[:paragraph].spacing_before("foo") - @writer.formats[:section].spacing_before("foo") + @writer.font_height(@writer.formats[:section].size) - 0.1
  section  = ODDB::Text::Section.new
  section.subheading = "subheading\n"
  paragraph = section.next_paragraph
  paragraph << text
  s_wrapper = ODDB::FiPDF::SectionWrapper.new(section)
  @writer.write_section(s_wrapper)
  #@writer.save_pdf
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  #the end of the file
  expected = "BT 223.427 813.798 Td /F5 7.0 Tf 0 Tr (subheading) Tj ET<\nBT 223.427 805.206 Td 0.280 Tw /F4 7.0 Tf 0 Tr (Foo, Baar und Test  sind keine zugelassenen Heilmittel) Tj ET<\nBT 223.427 797.114 Td 0.280 Tw /F4 7.0 Tf 0 Tr (Foo, Baar und Test  sind keine zugelassenen Heilmittel) Tj ET<\nBT 223.427 789.022 Td 0.280 Tw /F4 7.0 Tf 0 Tr (Foo, Baar und Test  sind keine zugelassenen Heilmittel) Tj ET<\nBT 223.427 780.930 Td 0.000 Tw /F4 7.0 Tf 0 Tr (Foo, Baar und Test  sind keine zugelassenen Heilmittel) Tj ET<\n"
  message = "Expected: \n#{expected}\nin:\n#{output}"
  assert_not_nil(output.index(expected), message)
end

- (Object) test_preformatted_text

Preformatted test kann verbessert werden



1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 1708

def test_preformatted_text
 text = "----------------------------------------------------\npro Tag      250 mg\n----------------------------------------------------\n1/2    3\327 5 ml      -         2(-3)\327tgl. 1 \340 125 mg\n1-3    3\327 7,5 ml    -             3\327tgl. 1 \340 125 mg\n3-6    3\32710 ml      -             4\327tgl. 1 \340 125 mg\n6-9    3\32715 ml      -         1(-2)\327tgl. 1 \340 500 mg\n9-12   3\32720 ml      2(-3)\327\ntgl. 1        2\327tgl. 1 \340 500 mg\n12-14   3\32725 ml      3\327tgl. 1      3\327tgl. 1 \340 500 mg\n----------------------------------------------------\n"
  paragraph = ODDB::Text::Paragraph.new
  paragraph << text
  paragraph.preformatted!
  @writer.fi_new_page
  @writer.first_line_of_page = false
  p_wrapper = ODDB::FiPDF::ParagraphWrapper.new(paragraph)
  @writer.y  =  ODDB::FiPDF::FachinfoWriter::MARGIN_BOTTOM \
    + 3 * @writer.font_height(@writer.formats[:preformatted].size) - @writer.formats[:preformatted].spacing_before(text)
  @writer.write_paragraph(p_wrapper)
  #@writer.save_pdf
  expected = "BT 40.000 32.789 Td /F2 5.3 Tf 0 Tr (----------------------------------------------------) Tj ET<\nBT 40.000 27.197 Td /F2 5.3 Tf 0 Tr (        pro Tag      250 mg) Tj ET<\nBT 40.000 21.606 Td /F2 5.3 Tf 0 Tr (----------------------------------------------------) Tj ET<\nq<\n1.000 1.000 1.000 rg<\n218.427 20.000 183.427 801.890 re f<\n1 w<\nQ<\nBT 223.427 816.298 Td /F2 5.3 Tf 0 Tr ( 1/2    3\327 5 ml      -         2\\\\(-3\\\\)\327tgl. 1 \340 125 mg) Tj ET<\nBT 223.427 810.707 Td /F2 5.3 Tf 0 Tr ( 1-3    3\327 7,5 ml    -             3\327tgl. 1 \340 125 mg) Tj ET<\nBT 223.427 805.115 Td /F2 5.3 Tf 0 Tr ( 3-6    3\32710 ml      -             4\327tgl. 1 \340 125 mg) Tj ET<\nBT 223.427 799.524 Td /F2 5.3 Tf 0 Tr ( 6-9    3\32715 ml      -         1\\\\(-2\\\\)\327tgl. 1 \340 500 mg) Tj ET<\n"
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #  expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  result = extract_result_lines(output, 'pro Tag', 2, 8)
  message = "Expected: \n#{expected}\nin:\n#{result}"
  assert_not_nil(output.index(expected), message)
end

- (Object) test_set_ptype_margins

def test_new_page

      # TODO: what does this test test?
      @chapter.heading = "The Tale of the Fox"
      s1 = @chapter.next_section
      s1.subheading = "The Fox and the lazy Dogs\n"
      p1 = s1.next_paragraph
      p1 << "The quick brown Fox jumped over the lazy Dogs! " * 50
      @writer.write_chapter(@chapter)
      @writer.write_chapter(@chapter)
      @writer.write_chapter(@chapter)
      @writer.write_chapter(@chapter)
      @writer.write_chapter(@chapter)
      #@writer.save_pdf
      expected = "%PDF-1.3\n%\342\343\317\323\n\n1 0 obj\n<< /Type /Catalog\n/Outlines 2 0 R\n/Pages 3 0 R>>\nendobj\n2 0 obj\n<< /Type /Outlines /Count 0 >>\nendobj\n3 0 obj\n<< /Type /Pages\n/Kids [6 0 R\n14 0 R\n]\n/Count 2\n/Resources <<\n/ProcSet 4 0 R\n/Font <<\n/F1 9 0 R\n/F2 11 0 R\n/F3 13 0 R >>\n>>\n/MediaBox [0 0 595.28 841.89]\n>>\nendobj\n4 0 obj\n[/PDF /Text ]\nendobj\n5 0 obj\n<<\n/CreationDate (D:\#{@today})\n/Producer (Ruby PDF::Writer, http://www.halostatue.ca/)\n>>\nendobj\n6 0 obj\n<< /Type /Page\n/Parent 3 0 R\n/Contents 7 0 R\n>>\nendobj\n7 0 obj\n<<\n/Length 24865 >>\nstream\n\nq\n0.999 0.999 0.999 rg\n25.000 821.890 570.280 801.890 re f\n\nQ\nq\n0.999 0.999 0.999 rg\n213.427 821.890 570.280 801.890 re f\n1 w 1 J  [ 0 10 ] 0 d\nQ\nq\n0.999 0.999 0.999 rg\n401.853 821.890 570.280 801.890 re f\n1 w 1 J  [ 0 10 ] 0 d\nQ\n\n0.000 0.000 0.000 rg\nBT 579.720 15.000 Td /F1 10.0 Tf 0 Tr (1) Tj ET\nBT 30.000 812.642 Td /F2 8.0 Tf 0 Tr (The Tale of the Fox) Tj ET\nBT 30.000 799.894 Td /F3 8.0 Tf 0 Tr (The Fox and the lazy Dogs) Tj /F1 8.0 Tf 0 Tr () Tj ET\nBT 30.000 788.146 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 778.898 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 769.650 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 760.402 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 751.154 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 741.906 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 732.658 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 723.410 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 714.162 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 704.914 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 695.666 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 686.418 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 677.170 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 667.922 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 658.674 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 649.426 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 640.178 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 630.930 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 621.682 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 612.434 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 603.186 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 593.938 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 584.690 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 575.442 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 566.194 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 556.946 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 547.698 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 538.450 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 529.202 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 519.954 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 510.706 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 501.458 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 492.210 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 482.962 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 473.714 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 464.466 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 455.218 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 445.970 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 436.722 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 427.474 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 418.226 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 408.978 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 399.730 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 390.482 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 381.234 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 371.986 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 362.738 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 353.490 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 344.242 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 334.994 Td 0.000 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 319.746 Td 0.000 Tw /F2 8.0 Tf 0 Tr (The Tale of the Fox) Tj ET\nBT 30.000 306.998 Td 0.000 Tw /F3 8.0 Tf 0 Tr (The Fox and the lazy Dogs) Tj /F1 8.0 Tf 0 Tr () Tj ET\nBT 30.000 295.250 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 286.002 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 276.754 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 267.506 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 258.258 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 249.010 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 239.762 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 230.514 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 221.266 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 212.018 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 202.770 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 193.522 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 184.274 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 175.026 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 165.778 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 156.530 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 147.282 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 138.034 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 128.786 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 119.538 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 110.290 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 101.042 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 91.794 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 82.546 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 73.298 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 64.050 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 54.802 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 45.554 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 36.306 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 30.000 27.058 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\n1 w 1 J  [ 0 10 ] 0 d\n213.427 20.000 m 213.427 821.890 l S\nBT 218.427 821.890 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 812.642 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 803.394 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 794.146 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 784.898 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 775.650 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 766.402 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 757.154 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 747.906 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 738.658 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 729.410 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 720.162 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 710.914 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 701.666 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 692.418 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 683.170 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 673.922 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 664.674 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 655.426 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 646.178 Td 0.000 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 630.930 Td 0.000 Tw /F2 8.0 Tf 0 Tr (The Tale of the Fox) Tj ET\nBT 218.427 618.182 Td 0.000 Tw /F3 8.0 Tf 0 Tr (The Fox and the lazy Dogs) Tj /F1 8.0 Tf 0 Tr () Tj ET\nBT 218.427 606.434 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 597.186 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 587.938 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 578.690 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 569.442 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 560.194 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 550.946 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 541.698 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 532.450 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 523.202 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 513.954 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 504.706 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 495.458 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 486.210 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 476.962 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 467.714 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 458.466 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 449.218 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 439.970 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 430.722 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 421.474 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 412.226 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 402.978 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 393.730 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 384.482 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 375.234 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 365.986 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 356.738 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 347.490 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 338.242 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 328.994 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 319.746 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 310.498 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 301.250 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 292.002 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 282.754 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 273.506 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 264.258 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 255.010 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 245.762 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 236.514 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 227.266 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 218.018 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 208.770 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 199.522 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 190.274 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 181.026 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 171.778 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 162.530 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 153.282 Td 0.000 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 138.034 Td 0.000 Tw /F2 8.0 Tf 0 Tr (The Tale of the Fox) Tj ET\nBT 218.427 125.286 Td 0.000 Tw /F3 8.0 Tf 0 Tr (The Fox and the lazy Dogs) Tj /F1 8.0 Tf 0 Tr () Tj ET\nBT 218.427 113.538 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 104.290 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 95.042 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 85.794 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 76.546 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 67.298 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 58.050 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 48.802 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 39.554 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 30.306 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 218.427 21.058 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\n1 w 1 J  [ 0 10 ] 0 d\n401.853 20.000 m 401.853 821.890 l S\nBT 406.853 821.890 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 812.642 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 803.394 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 794.146 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 784.898 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 775.650 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 766.402 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 757.154 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 747.906 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 738.658 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 729.410 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 720.162 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 710.914 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 701.666 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 692.418 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 683.170 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 673.922 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 664.674 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 655.426 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 646.178 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 636.930 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 627.682 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 618.434 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 609.186 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 599.938 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 590.690 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 581.442 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 572.194 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 562.946 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 553.698 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 544.450 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 535.202 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 525.954 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 516.706 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 507.458 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 498.210 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 488.962 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 479.714 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 470.466 Td 0.000 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 455.218 Td 0.000 Tw /F2 8.0 Tf 0 Tr (The Tale of the Fox) Tj ET\nBT 406.853 442.470 Td 0.000 Tw /F3 8.0 Tf 0 Tr (The Fox and the lazy Dogs) Tj /F1 8.0 Tf 0 Tr () Tj ET\nBT 406.853 430.722 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 421.474 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 412.226 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 402.978 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 393.730 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 384.482 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 375.234 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 365.986 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 356.738 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 347.490 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 338.242 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 328.994 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 319.746 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 310.498 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 301.250 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 292.002 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 282.754 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 273.506 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 264.258 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 255.010 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 245.762 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 236.514 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 227.266 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 218.018 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 208.770 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 199.522 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 190.274 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 181.026 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 171.778 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 162.530 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 153.282 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 144.034 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 134.786 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 125.538 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 116.290 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 107.042 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 97.794 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 88.546 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 79.298 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 70.050 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 60.802 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 51.554 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 42.306 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 33.058 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 406.853 23.810 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nendstream\nendobj\n\n8 0 obj\n<< /Type /Encoding\n/BaseEncoding /WinAnsiEncoding\n/Differences\n[\n]\n>>\nendobj\n9 0 obj\n<< /Type /Font\n/Subtype /Type1\n/Name /F1\n/BaseFont /Helvetica\n/Encoding 8 0 R\n>>\nendobj\n10 0 obj\n<< /Type /Encoding\n/BaseEncoding /WinAnsiEncoding\n/Differences\n[\n]\n>>\nendobj\n11 0 obj\n<< /Type /Font\n/Subtype /Type1\n/Name /F2\n/BaseFont /Helvetica-Bold\n/Encoding 10 0 R\n>>\nendobj\n12 0 obj\n<< /Type /Encoding\n/BaseEncoding /WinAnsiEncoding\n/Differences\n[\n]\n>>\nendobj\n13 0 obj\n<< /Type /Font\n/Subtype /Type1\n/Name /F3\n/BaseFont /Helvetica-Oblique\n/Encoding 12 0 R\n>>\nendobj\n14 0 obj\n<< /Type /Page\n/Parent 3 0 R\n/Contents 15 0 R\n>>\nendobj\n15 0 obj\n<<\n/Length 574 >>\nstream\n\n0.000 0.000 0.000 rg\n1 w 1 J  [ 0 10 ] 0 d\nBT 10.000 15.000 Td 0.000 Tw /F1 10.0 Tf 0 Tr (2) Tj ET\nBT 10.000 821.890 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 10.000 812.642 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 10.000 803.394 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 10.000 794.146 Td 0.628 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nBT 10.000 784.898 Td 0.000 Tw /F1 8.0 Tf 0 Tr (The quick brown Fox jumped over the lazy Dogs!) Tj ET\nendstream\nendobj\n\nxref\n0 16\n0000000000 65535 f\n0000000015 00000 n\n0000000079 00000 n\n0000000125 00000 n\n0000000298 00000 n\n0000000327 00000 n\n0000000431 00000 n\n0000000494 00000 n\n0000025413 00000 n\n0000025499 00000 n\n0000025595 00000 n\n0000025682 00000 n\n0000025785 00000 n\n0000025872 00000 n\n0000025978 00000 n\n0000026043 00000 n\n\ntrailer\n<< /Size 16\n/Root 1 0 R\n/Info 5 0 R\n>>\nstartxref\n26670\n%%EOF\n"
      assert_equal(expected, @writer.render)
    end


1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 1421

def test_set_ptype_margins
  # tests that set_ptype_margins sets the margins correctly for even 
  # and odd pages
  @chapter.heading = "The Tale of the Fox"
  s1 = @chapter.next_section
  s1.subheading = "The Fox and the lazy Dogs\n"
  p1 = s1.next_paragraph
  p1 << "The quick brown Fox jumped over the lazy Dogs! " * 4
  @writer.set_ptype_margins(:odd)
  assert_equal(ODDB::FiPDF::FachinfoWriter::MARGIN_IN, @writer.left_margin)
  assert_equal(ODDB::FiPDF::FachinfoWriter::MARGIN_OUT, @writer.right_margin)
  @writer.set_ptype_margins(:even)
  assert_equal(ODDB::FiPDF::FachinfoWriter::MARGIN_OUT, @writer.left_margin)
  assert_equal(ODDB::FiPDF::FachinfoWriter::MARGIN_IN, @writer.right_margin)
end

- (Object) test_single_substances



302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 302

def test_single_substances
  substances = [
    ["Aonstan", "Ywesee", "1", "generic", "3"],
    ["Bonstan", "Ywesee", "1", "generic", "1"],
    ["Constan", "Ywesee", "1", "generic", "1"],
    ["Donstan", "Ywesee", "1", "generic", "6"], 
    ["Eonstan", "Ywesee", "1", "generic", "1"],
  ]
  expected = [
    ["Bonstan", "Ywesee", "1", "generic", "1"],
    ["Constan", "Ywesee", "1", "generic", "1"],
    ["Eonstan", "Ywesee", "1", "generic", "1"],
  ]
  assert_equal(expected, @writer.single_substances(substances))
end

- (Object) test_tuple_to_paragraph



914
915
916
917
918
919
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 914

def test_tuple_to_paragraph
  tuple = ["Ponstan", "Ywesee", 1, :generic, "2"]
  wrapper = @writer.wrap_tuple(tuple)
  assert_instance_of(ODDB::FiPDF::ParagraphWrapper, wrapper)
  assert_equal("Ponstan (1)<i>\nYwesee</i>", wrapper.text)
end

- (Object) test_widow_paragraph



1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 1755

def test_widow_paragraph
  chapter = ODDB::Text::Chapter.new
  section = chapter.next_section
  section.subheading = "Foo\n"
  paragraph = section.next_paragraph
  text = "Baaar und Test sind keine zugelassenen Heilmittel " *3
  paragraph << text
  p_wrapper = ODDB::FiPDF::ParagraphWrapper.new(paragraph)
  @writer.fi_new_page
  @writer.first_line_of_page = false
  @writer.y  =  ODDB::FiPDF::FachinfoWriter::MARGIN_BOTTOM\
    + 2 * @writer.font_height(@writer.formats[:paragraph].size)\
    - @writer.formats[:paragraph].spacing_before(text)
  @writer.write_paragraph(p_wrapper)  
  #@writer.save_pdf
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #  expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  #the end of the file
  expected = "BT 223.427 813.798 Td 2.708 Tw /F4 7.0 Tf 0 Tr (Baaar und Test sind keine zugelassenen Heilmittel) Tj ET<\nBT 223.427 805.706 Td 2.708 Tw /F4 7.0 Tf 0 Tr (Baaar und Test sind keine zugelassenen Heilmittel) Tj ET<\nBT 223.427 797.614 Td 0.000 Tw /F4 7.0 Tf 0 Tr (Baaar und Test sind keine zugelassenen Heilmittel) Tj ET<\n"
  message = "Expected: \n#{expected}\nin:\n#{output}"
  assert_not_nil(output.index(expected), message)
end

- (Object) test_widow_text_by_site_change



1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 1783

def test_widow_text_by_site_change
  chapter = ODDB::Text::Chapter.new
  section = chapter.next_section
  section.subheading = "Foo\n"
  paragraph = section.next_paragraph
  text = "Foo, Baaar und Test sind keine zugelassenen Heilmittel " *3
  paragraph << text
  c_wrapper = ODDB::FiPDF::ChapterWrapper.new(chapter)
  @writer.fi_new_page
  @writer.new_page
  @writer.new_page
  @writer.y  =  ODDB::FiPDF::FachinfoWriter::MARGIN_BOTTOM\
    + 2 * @writer.font_height(@writer.formats[:paragraph].size)\
    - @writer.formats[:paragraph].spacing_before(text)
  @writer.write_chapter(c_wrapper)  
  #@writer.save_pdf
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #  expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  #the end of the file
  expected = "BT 223.427 813.798 Td /F5 7.0 Tf 0 Tr (Foo) Tj ET<\nBT 223.427 805.206 Td 0.042 Tw /F4 7.0 Tf 0 Tr (Foo, Baaar und Test sind keine zugelassenen Heilmittel) Tj ET<\nBT 223.427 797.114 Td 0.042 Tw /F4 7.0 Tf 0 Tr (Foo, Baaar und Test sind keine zugelassenen Heilmittel) Tj ET<\nBT 223.427 789.022 Td 0.000 Tw /F4 7.0 Tf 0 Tr (Foo, Baaar und Test sind keine zugelassenen Heilmittel) Tj ET<\n"
  message = "Expected: \n#{expected}\nin:\n#{output}"
  assert_not_nil(output.index(expected), message)
end

- (Object) test_write_alphabet__A



1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 1813

def test_write_alphabet__A
  @writer.flic_name = "appelbergen"
  @writer.write_alphabet
  #@writer.save_pdf
  expected = [
    "585.280 792.190 10.000 27.700 re f",
    "BT 584.944 799.592 Td /F1 16.0 Tf 0 Tr (A) Tj ET"
  ]
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  expected.each { |line|
    message = "Expected: \n#{line}\nin:\n#{output}"
    assert_not_nil(output.index(line), message)
  }
end

- (Object) test_write_alphabet__AB



1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 1829

def test_write_alphabet__AB
  @writer.flic_name = "appelbergen"
  @writer.write_alphabet
  @writer.flic_name = "bremerhaven"
  @writer.write_alphabet
  #@writer.save_pdf
  expected = [
    "585.280 792.190 10.000 27.700 re f<",
    "585.280 762.491 10.000 27.700 re f<",
    "585.280 762.491 10.000 27.700 re f<",
    "585.280 762.491 10.000 27.700 re f<"
  ]
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  expected.each { |line|
    message = "Expected: \n#{line}\nin:\n#{output}"
    assert_not_nil(output.index(line), message)
  }
end

- (Object) test_write_alphabet__Z_other



1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 1849

def test_write_alphabet__Z_other
  @writer.flic_name = "Zoroaster"
  @writer.write_alphabet
  @writer.flic_name = "3-Tetrahydrodingol"
  @writer.write_alphabet
  #@writer.save_pdf
  expected = [
    "585.280 49.700 10.000 27.700 re f",
    "585.280 20.000 10.000 27.700 re f",
    "BT 585.392 57.101 Td /F1 16.0 Tf 0 Tr (Z) Tj ET<",
    "BT 587.168 27.402 Td /F1 16.0 Tf 0 Tr (*) Tj ET<",
  ]
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  expected.each { |line|
    message = "Expected: \n#{line}\nin:\n#{output}"
    assert_not_nil(output.index(line), message)
  }
end

- (Object) test_write_chapter



1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 1617

def test_write_chapter
  chapter = ODDB::Text::Chapter.new
  chapter.heading << "Verbot"
  section = chapter.next_section
  paragraph1 = section.next_paragraph
  text = "Foo, Baar und Test  sind keine zugelassenen Heilmittel" *1
  paragraph1 << text
  @writer.fi_new_page
  @writer.first_line_of_page = false
  c_wrapper = ODDB::FiPDF::ChapterWrapper.new(chapter)
  @writer.write_chapter(c_wrapper)
  #@writer.save_pdf
  expected = "BT 40.000 809.798 Td /F1 7.0 Tf 0 Tr (Verbot) Tj ET<\nBT 40.000 801.206 Td /F4 7.0 Tf 0 Tr (Foo, Baar und Test  sind keine zugelassenen Heilmittel) Tj ET<\n"
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  result = extract_result_lines(output, 'Verbot', 0, 2)
  message = "Expected: \n#{expected}\nin:\n#{result}"
  assert_not_nil(output.index(expected), message)
end

- (Object) test_write_drug_name



1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 1448

def test_write_drug_name
  @writer.fi_new_page
  @writer.current_generic_type = :original
  @writer.write_drug_name("Ponstan")
  @writer.current_generic_type = :generic
  @writer.write_drug_name("Mefenacid")
  @writer.current_generic_type = :unknown
  @writer.write_drug_name("Dunnosan")
  #@writer.save_pdf
  expected = "1.000 1.000 1.000 rg<\nBT 40.000 810.330 Td /F4 10.0 Tf 0 Tr (Ponstan) Tj ET<\n0.000 0.000 0.000 rg<\nq<\n0.168 0.640 0.461 rg<\n35.000 782.770 183.427 16.560 re f<\n1 w<\nQ<\n1.000 1.000 1.000 rg<\nBT 40.000 787.770 Td /F4 10.0 Tf 0 Tr (Mefenacid) Tj ET<\n0.000 0.000 0.000 rg<\nq<\n0.667 0.667 0.667 rg<\n35.000 760.210 183.427 16.560 re f<\n1 w<\nQ<\nBT 40.000 765.210 Td /F4 10.0 Tf 0 Tr (Dunnosan) Tj ET<\n"
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  result = extract_result_lines(output, 'Ponstan', 3, 15)
  message = "Expected: \n#{expected}\nin:\n#{result}"
  assert_not_nil(output.index(expected), message)
end


1436
1437
1438
1439
1440
1441
1442
1443
1444
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 1436

def test_write_drug_name_link
  @writer.fi_new_page
  @writer.write_drug_name("<b>Foohallo®</b>")
  #@writer.save_pdf
  expected = "/URI (http://www.oddb.org/de/gcc/search/search_query/Foohallo)<\n"
  output = @writer.render.gsub("\n", "<\n")
  message = "Expected: \n#{expected}\nin:\n#{output}"
  assert_not_nil(output.index(expected), message)
end

- (Object) test_write_flic_name_one_page

def test_write_fachinfo

      fachinfo = StubFachinfoDocument.new
      fachinfo.name = "Ponstan df df df df kjadlkjf alkjd f"
      fachinfo.company_name = "Ywesee"
      ch1 = ODDB::Text::Chapter.new
      ch1.heading = "Zusammensetzung"
      sec1 = ch1.next_section
      sec1.subheading = "Wirkstoff\n"
      para1 = sec1.next_paragraph
      para1 << "paragraph 1 " * 10
      ch2 = ODDB::Text::Chapter.new
      ch2.heading = "Eigenschaften"
      sec2 = ch2.next_section
      sec2.subheading = "Hilfstoffe\n"
      para2 = sec2.next_paragraph
      para2 << "paragraph 2 " * 4
      para3 = sec2.next_paragraph
      para3 << "paragraph 3 in section 2 " * 7
      ch3 = ODDB::Text::Chapter.new
      ch3.heading = "Schwangerschaft"
      sec3 = ch3.next_section
      sec3.subheading = "Krankheit"
      para4 = sec3.next_paragraph
      para4 << "paragraph 4 " * 321
      para5 = sec3.next_paragraph
      para5 << "preformatted " * 12
      para5.preformatted!
      ch4 = ODDB::Text::Chapter.new
      ch4.heading << "Informationen"
      sec4 = ch4.next_section
      para6 = sec4.next_paragraph
      para6 << "Paragraph6 " *14
      fachinfo.chapters = [
        ch1,
        ch2,
        ch3,
        ch4,
        ch1,
        ch2,
        ch3,
        ch4,
      ]
      fachinfo.generic_type = :original
      @writer.fi_new_page
      @writer.first_line_of_page = true
      # @writer.y = ODDB::FiPDF::FachinfoWriter::MARGIN_BOTTOM + @writer.calculate_drug_name("<b>"+fachinfo.name+"</b>") + @writer.calculate_company_name(fachinfo.company_name) + @writer.calculate_heading(fachinfo.chapters[0]) + @writer.calculate_section(fachinfo.chapters[0].sections[0])[:min_page_break_y]
      @writer.y = 112
      @writer.write_fachinfo(fachinfo)
      fachinfo.generic_type = :generic
      @writer.write_fachinfo(fachinfo)
      fachinfo.generic_type = :unknown
      @writer.write_fachinfo(fachinfo)
      @writer.write_fachinfo(fachinfo)
      @writer.write_fachinfo(fachinfo)
      #@writer.write_fachinfo(fachinfo, "ywesee", :generic)
      #@writer.write_fachinfo(fachinfo, "Documed", :original)
      #@writer.write_fachinfo(fachinfo, "pro-generika", :unknown)
      @writer.write_substance_index
      #@writer.save_pdf
    end
    def test_write_internal_link
      product = ["Ponstan", "Ywesee", 1, "generic", "1", "anchor1"]
      @writer.fi_new_page
      @writer.set_page_element_type(:page_type_substance_index)
      @writer.write_tuple(product)
      #@writer.save_pdf
      expected = "16 0 obj<\n<< /Type /Annot<\n/Subtype /Link<\n/A 17 0 R<\n/Border [0 0 0]<\n/H /I<\n/Rect [40.0000 821.8900 213.4267 807.9365 ]<\n>><\nendobj<\n"
      output = @writer.render.gsub("\n", "<\n")
      message = "Expected: \n#{expected}\nin:\n#{output}"
      assert_not_nil(output.index(expected), message)
    end
    def test_write_drug_name_link
      @writer.fi_new_page
      @writer.write_drug_name("FooBaar®")
      #@writer.save_pdf
      expected = "/URI (http://www.oddb.org/de/gcc/search/search_query/Foohallo)<\n"
    end
    def test_write_flic_name_odd_page
      @writer.fi_page_number = 1
      @writer.flic_name = "Ponstan"
      @writer.write_flic_name
      #@writer.save_pdf
      expected = "BT 543.590 825.000 Td /F3 10.0 Tf 0 Tr (Ponstan) Tj ET<\n"
      output = @writer.render.gsub("\n", "<\n")
      message = "Expected: \n#{expected}\nin:\n#{output}"
      assert_not_nil(output.index(expected), message)
    end
    def test_write_flic_name_even_page
      @writer.fi_page_number = 2
      @writer.flic_name = "Ponstan"
      @writer.write_flic_name
      #@writer.save_pdf
      expected = "BT 15.000 825.000 Td /F3 10.0 Tf 0 Tr (Ponstan) Tj ET<\n"
      output = @writer.render.gsub("\n", "<\n")
      message = "Expected: \n#{expected}\nin:\n#{output}"
      assert_not_nil(output.index(expected), message)
    end


452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 452

def test_write_flic_name_one_page
  fachinfo = StubFachinfoDocument.new
  fachinfo.name = "Ponstan"
  fachinfo.company_name = "Ywesee"
  ch1 = ODDB::Text::Chapter.new
  ch1.heading = "Zusammensetzung"
  fachinfo.chapters = [
    ch1,
  ]
  @writer.fi_new_page
  @writer.write_fachinfo(fachinfo)
  #so that the last pdf page has a flic name
  @writer.write_flic_name
  #@writer.save_pdf
  assert_equal("Ponstan", @writer.flic_name)
end

- (Object) test_write_flic_name_three_pages



468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 468

def test_write_flic_name_three_pages
  fachinfo = StubFachinfoDocument.new
  fachinfo.name = "Ponstan"
  fachinfo.company_name = "Ywesee"
  ch1 = ODDB::Text::Chapter.new
  ch1.heading = "Zusammensetzung"
  section = ch1.next_section
  section = ch1.next_section
  section.subheading = "Wirkstoff"
  para1 = section.next_paragraph
  para1 << "paragraph 1 " * 5
  fachinfo.chapters = [
    ch1,
    ch1,
    ch1,
    ch1,
    ch1,
  ]
  @writer.fi_new_page
  @writer.y = 200
  #@writer.new_page
  @writer.write_fachinfo(fachinfo)
  assert_equal("Ponstan", @writer.flic_name)
  @writer.new_page
  @writer.new_page
  assert_equal("Ponstan", @writer.flic_name)
  @writer.new_page
  assert_equal("Ponstan", @writer.flic_name)
  @writer.new_page
  @writer.new_page
  fachinfo2 = StubFachinfoDocument.new
  fachinfo2.name = "Aspirin"
  fachinfo2.company_name = "Ywesee"
  ch1 = ODDB::Text::Chapter.new
  ch1.heading = "Zusammensetzung2"
  fachinfo2.chapters = [
    ch1,
  ]
  @writer.new_page
  @writer.write_fachinfo(fachinfo2)
  fachinfo3 = StubFachinfoDocument.new
  fachinfo3.name = "Penicilin"
  fachinfo3.company_name = "Ywesee"
  ch1 = ODDB::Text::Chapter.new
  ch1.heading = "Zusammensetzung2"
  fachinfo3.chapters = [
    ch1,
  ]
  @writer.write_fachinfo(fachinfo3)
  #so that the last pdf page has a flic name
  @writer.write_flic_name
  #@writer.save_pdf
  assert_equal("Penicilin",@writer.flic_name)
end

- (Object) test_write_flic_names_even_page



522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 522

def test_write_flic_names_even_page
  fachinfo = StubFachinfoDocument.new
  fachinfo.name = "Ponstan"
  fachinfo.company_name = "Ywesee"
  ch1 = ODDB::Text::Chapter.new
  ch1.heading = "Zusammensetzung"
  fachinfo.chapters = [
    ch1,
    ch1,
    ch1,
    ch1,
  ]
  @writer.fi_new_page
  @writer.fi_page_number = 2
  @writer.write_fachinfo(fachinfo)
  fachinfo.name = "Autorix"
  @writer.write_fachinfo(fachinfo)
  fachinfo.name = "Porzelanius"
  @writer.write_fachinfo(fachinfo)
  fachinfo.name = "Milzbrand"
  @writer.write_fachinfo(fachinfo)
  fachinfo.name = "Aspirinuale"
  @writer.write_fachinfo(fachinfo)
  fachinfo.name = "Merfen"
  @writer.write_fachinfo(fachinfo)
  fachinfo.name = "Aproz"
  @writer.write_fachinfo(fachinfo)
  #@writer.save_pdf
  @writer.write_flic_name
  assert_equal("Ponstan", @writer.flic_name)
end

- (Object) test_write_flic_names_odd_page



553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 553

def test_write_flic_names_odd_page
  fachinfo = StubFachinfoDocument.new
  fachinfo.name = "Ponstan"
  fachinfo.company_name = "Ywesee"
  ch1 = ODDB::Text::Chapter.new
  ch1.heading = "Zusammensetzung"
  fachinfo.chapters = [
    ch1,
    ch1,
    ch1,
    ch1,
  ]
  @writer.fi_new_page
  @writer.write_fachinfo(fachinfo)
  fachinfo.name = "Autorix"
  @writer.write_fachinfo(fachinfo)
  fachinfo.name = "Porzelanius"
  @writer.write_fachinfo(fachinfo)
  fachinfo.name = "Milzbrand"
  @writer.write_fachinfo(fachinfo)
  fachinfo.name = "Aspirinuale"
  @writer.write_fachinfo(fachinfo)
  fachinfo.name = "Merfen"
  @writer.write_fachinfo(fachinfo)
  fachinfo.name = "Aproz"
  @writer.write_fachinfo(fachinfo)
  #@writer.save_pdf
  assert_equal("Aproz", @writer.flic_name)
end

- (Object) test_write_page_numbers

def test_write_substance_index_3_pages

      @writer.page_type_standard
      @writer.text("The rest of the File", 10)
      @writer.new_page
      @writer.text('and its second column')
      products = [
        ["Ponstan", "Ywesee", 1, :generic, "2"],
        ["Mefenamings", "Mefa", 1, :original, "3"],
        ["Acid", "Mefa", 1, :original, "1"],
        ["Panadol", "Mefa", 1, :original, "4"],
        ["Viagra", "Mefa", 1, :unknown,"1"]
      ]
      20.times { |var|
        products.each { |product|
          @writer.substance_index.store("Penicilin", product)
          @writer.substance_index.store("Anabolika", product)
          @writer.substance_index.store("Viagra", product)
          @writer.substance_index.store("Penicilin" + var.to_s, product)
          @writer.substance_index.store("Penicilin", product)
          @writer.substance_index.store("Merfen", product)
        }
      }
      @writer.write_substance_index
      expected = ""

/Kids [14 0 R< 494 0 R< 956 0 R< 6 0 R< ]<

      EOF
      # NOTE: to avoid confusion about end-of-line whitespace, both
      #       expected and output have added "<"-signs at EOL
      output = @writer.render.gsub("\n", "<\n")
      result = extract_result_lines(output, 'Ponstan', 1, 1)
      message = "Expected: \n#{expected}\nin:\n#{result}"
      assert_not_nil(output.index(expected), message)
    end


959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 959

def test_write_page_numbers
  @writer.fi_new_page
  @writer.write_page_number(2)
  @writer.new_page
  @writer.write_page_number(3333333)
  #@writer.save_pdf
  expected = [
    "BT 575.832 10.000 Td /F4 8.0 Tf 0 Tr (1) Tj ET<",
    "BT 15.000 10.000 Td /F4 8.0 Tf 0 Tr (2) Tj ET<",
    "BT 549.144 10.000 Td /F4 8.0 Tf 0 Tr (3333333) Tj ET<",
  ]
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  expected.each { |line| 
    message = "Expected: \n#{line}\nin:\n#{output}"
    assert_not_nil(output.index(line), message)
  }
end

- (Object) test_write_paragraph



582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 582

def test_write_paragraph
  @writer.fi_new_page
  section = @chapter.next_section
  paragraph = section.next_paragraph
  paragraph << "Kein Preformatted"
  p_wrapper = ODDB::FiPDF::ParagraphWrapper.new(paragraph)
  @writer.write_paragraph(p_wrapper)
  #@writer.save_pdf
  expected = "BT 40.000 813.798 Td /F4 7.0 Tf 0 Tr (Kein Preformatted) Tj ET<\n"
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  message = "Expected: \n#{expected}\nin:\n#{output}"
  assert_not_nil(output.index(expected), message)
end

- (Object) test_write_paragraph__preformatted



618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 618

def test_write_paragraph__preformatted
  @writer.fi_new_page
  section = @chapter.next_section
  paragraph = section.next_paragraph
  paragraph << "Preformatted"
  paragraph.preformatted!
  p_wrapper = ODDB::FiPDF::ParagraphWrapper.new(paragraph)
  @writer.write_paragraph(p_wrapper)
  #@writer.save_pdf
  expected = "BT 40.000 816.298 Td /F2 5.3 Tf 0 Tr (Preformatted) Tj ET<\n"
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  message = "Expected: \n#{expected}\nin:\n#{output}"
  assert_not_nil(output.index(expected), message)
end

- (Object) test_write_paragraph_strip_1_letter



600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 600

def test_write_paragraph_strip_1_letter
  @writer.fi_new_page
  section = @chapter.next_section
  paragraph = section.next_paragraph
  paragraph << "-nerfiges - am anfang"
  p_wrapper = ODDB::FiPDF::ParagraphWrapper.new(paragraph)
  @writer.write_paragraph(p_wrapper)
  #@writer.save_pdf
  expected = "BT 40.000 813.798 Td /F4 7.0 Tf 0 Tr (nerfiges - am anfang) Tj ET<\n"
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  message = "Expected: \n#{expected}\nin:\n#{output}"
  assert_not_nil(output.index(expected), message)
end

- (Object) test_write_section__inline_subheading



688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 688

def test_write_section__inline_subheading
  section = @chapter.next_section
  section.subheading = "Subheading ohne Newline"
  paragraph = section.next_paragraph
  paragraph << "Fliesstext mit hoffentlich Umbruchgemässer Länge" 
  paragraph2 = section.next_paragraph
  paragraph2 << "Ein zweiter Paragraph, so fürs Gemüt"
  s_wrapper = ODDB::FiPDF::SectionWrapper.new(section)
  @writer.fi_new_page
  @writer.write_section(s_wrapper)
  #@writer.save_pdf
  expected = "BT 40.000 813.798 Td 3.016 Tw /F5 7.0 Tf 0 Tr (Subheading ohne Newline ) Tj /F4 7.0 Tf 0 Tr (Fliesstext mit hoffentlich) Tj ET<\nBT 40.000 805.706 Td 0.000 Tw /F4 7.0 Tf 0 Tr (Umbruchgem\344sser L\344nge) Tj ET<\nBT 40.000 796.614 Td 0.000 Tw /F4 7.0 Tf 0 Tr (Ein zweiter Paragraph, so f\374rs Gem\374t) Tj ET<\n"
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  result = extract_result_lines(output, 'Subheading', 1, 2)
  message = "Expected: \n#{expected}\nin:\n#{result}"
  assert_not_nil(output.index(expected), message)
end

- (Object) test_write_section__newline_subheading



664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 664

def test_write_section__newline_subheading
  @writer.fi_new_page
  section = @chapter.next_section
  section.subheading = "Subheading mit Newline\n"
  paragraph = section.next_paragraph
  paragraph << "Fliesstext"
  paragraph2 = section.next_paragraph
  paragraph2 << "Noch ein Paragraph"
  s_wrapper = ODDB::FiPDF::SectionWrapper.new(section)
  @writer.write_section(s_wrapper)
  #@writer.save_pdf
  expected = "BT 40.000 813.798 Td /F5 7.0 Tf 0 Tr (Subheading mit Newline) Tj ET<\nBT 40.000 805.206 Td /F4 7.0 Tf 0 Tr (Fliesstext) Tj ET<\nBT 40.000 796.114 Td /F4 7.0 Tf 0 Tr (Noch ein Paragraph) Tj ET<\n"
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  result = extract_result_lines(output, 'Subheading', 1, 2)
  message = "Expected: \n#{expected}\nin:\n#{result}"
  assert_not_nil(output.index(expected), message)
end

- (Object) test_write_section__preformatted



637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
# File 'ext/fipdf/test/fachinfo_writer_test.rb', line 637

def test_write_section__preformatted
  @writer.fi_new_page
  section = @chapter.next_section
  section.subheading = "Subheading ohne NewLine"
  paragraph = section.next_paragraph
  paragraph << "Paragraph 1"
  paragraph2 = section.next_paragraph
  paragraph2 << "Preformatted Paragraph"
  paragraph2.preformatted!
  paragraph3 = section.next_paragraph
  paragraph3 << "Paragraph 3"
  s_wrapper = ODDB::FiPDF::SectionWrapper.new(section)
  @writer.write_section(s_wrapper)
  #@writer.save_pdf
  expected = "BT 40.000 813.798 Td /F5 7.0 Tf 0 Tr (Subheading ohne NewLine ) Tj /F4 7.0 Tf 0 Tr (Paragraph 1) Tj ET<\nBT 40.000 805.207 Td /F2 5.3 Tf 0 Tr (Preformatted Paragraph) Tj ET<\nBT 40.000 794.115 Td /F4 7.0 Tf 0 Tr (Paragraph 3) Tj ET<\n"
  # NOTE: to avoid confusion about end-of-line whitespace, both
  #       expected and output have added "<"-signs at EOL
  output = @writer.render.gsub("\n", "<\n")
  result = extract_result_lines(output, 'Subheading', 1, 2)
  message = "Expected: \n#{expected}\nin:\n#{result}"
  assert_not_nil(output.index(expected), message)
end