Changeset 9973 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 20 Feb 2013, 11:57:14 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/test_pdf.py
r9964 r9973 3 3 import unittest 4 4 from reportlab.lib import colors 5 from reportlab.platypus.flowables import PageBreak 5 6 from waeup.kofa.browser.pdf import ( 6 7 format_html, normalize_signature, format_signatures, … … 406 407 tables) 407 408 409 410 data += [PageBreak(), Paragraph( 411 '<br /><br /><font size="14"><font face="Times">horizontal</font>' 412 ' Parameter (with one sig): </b><br />', 413 NORMAL_STYLE)] 414 415 # one signature (default behaviour) 416 tables = get_signature_tables( 417 ['Sig 1'], horizontal=None) 418 data = self.add_tables( 419 data, '<br /><b>One Signature (default, horizontal=None):</b> ' 420 '<font face="Times">get_signature_tables(["Signature 1"], ' 421 'horizontal=None)</font></b>', 422 tables) 423 424 # one signature (horizontal) 425 tables = get_signature_tables( 426 ['Sig 1'], horizontal=True) 427 data = self.add_tables( 428 data, '<br /><b>One Signature (horizontal=True):</b> ' 429 '<font face="Times">get_signature_tables(["Signature 1"], ' 430 'horizontal=True)</font></b>', 431 tables) 432 433 # one signature (vertical) 434 tables = get_signature_tables( 435 ['Sig 1'], horizontal=False) 436 data = self.add_tables( 437 data, '<br /><b>One Signature (horizontal=False):</b> ' 438 '<font face="Times">get_signature_tables(["Signature 1"], ' 439 'horizontal=False)</font></b>', 440 tables) 441 442 data += [Paragraph( 443 '<br /><br /><font size="14"><font face="Times">horizontal</font>' 444 ' Parameter (with two sigs): </b><br />', 445 NORMAL_STYLE)] 446 447 # two signatures (default behaviour) 448 tables = get_signature_tables( 449 ['Signature 1', 'Signature 2'], horizontal=None) 450 data = self.add_tables( 451 data, '<br /><b>Two Signatures (default, horizontal=None):</b> ' 452 '<font face="Times">get_signature_tables(["Signature 1",' 453 ' "Signature 2"])</font></b>', 454 tables) 455 456 # two sigs, both horizontal 457 tables = get_signature_tables( 458 ['Sig 1', 'Sig 2'], horizontal=True) 459 data = self.add_tables( 460 data, 461 '<br /><b>Two Signatures (horizontal=True):</b> ' 462 '<font face="Times">get_signature_tables(' 463 '["Sig 1", "Sig 2"], horizontal=True)</font>', 464 tables) 465 466 # two sigs, both vertical 467 tables = get_signature_tables( 468 ['Sig 1', 'Sig 2'], horizontal=False) 469 data = self.add_tables( 470 data, 471 '<br /><b>Two Signatures (vertical, horizontal=False):</b> ' 472 '<font face="Times">get_signature_tables(' 473 '["Sig 1", "Sig 2"], horizontal=False)</font>', 474 tables) 475 476 477 data += [PageBreak(), Paragraph( 478 '<br /><br /><font size="14"><font face="Times">max_per_row</font>' 479 ' Parameter: </b><br />', 480 NORMAL_STYLE)] 481 482 # four signature (default) 483 tables = get_signature_tables( 484 ['Sig 1', 'Sig 2', 'Sig 3', 'Sig 4']) 485 data = self.add_tables( 486 data, 487 '<br /><b>Four Sigs (default, max_per_row=3):</b> ' 488 '<font face="Times">get_signature_tables(' 489 '["Sig 1", "Sig 2", "Sig 3", "Sig 4"])</font>', 490 tables) 491 492 # four signature (max_per_row=1) 493 tables = get_signature_tables( 494 ['Sig 1', 'Sig 2', 'Sig 3', 'Sig 4'], max_per_row=1) 495 496 data = self.add_tables( 497 data, 498 '<br /><b>Four Sigs (max_per_row=1):</b> ' 499 '<font face="Times">get_signature_tables(' 500 '["Sig 1", "Sig 2", "Sig 3", "Sig 4"], max_per_row=1)</font>' 501 '<br /><i>Please note: mode switches from vertical to ' 502 'horizontal automatically</i>', 503 tables) 504 505 # four signature (max_per_row=2) 506 tables = get_signature_tables( 507 ['Sig 1', 'Sig 2', 'Sig 3', 'Sig 4'], max_per_row=2) 508 data = self.add_tables( 509 data, 510 '<br /><b>Four Sigs (max_per_row=2):</b> ' 511 '<font face="Times">get_signature_tables(' 512 '["Sig 1", "Sig 2", "Sig 3", "Sig 4"], max_per_row=2)</font>', 513 tables) 514 515 data += [PageBreak()] 516 517 # four signature (max_per_row=4) 518 tables = get_signature_tables( 519 ['Sig 1', 'Sig 2', 'Sig 3', 'Sig 4'], max_per_row=4) 520 data = self.add_tables( 521 data, 522 '<b>Four Sigs (max_per_row=4):</b> ' 523 '<font face="Times">get_signature_tables(' 524 '["Sig 1", "Sig 2", "Sig 3", "Sig 4"], max_per_row=4)</font>', 525 tables) 526 527 # four signature (max_per_row=5) 528 tables = get_signature_tables( 529 ['Sig 1', 'Sig 2', 'Sig 3', 'Sig 4'], max_per_row=5) 530 data = self.add_tables( 531 data, 532 '<br /><b>Four Sigs (max_per_row=5):</b> ' 533 '<font face="Times">get_signature_tables(' 534 '["Sig 1", "Sig 2", "Sig 3", "Sig 4"], max_per_row=5)</font>', 535 tables) 536 537 408 538 # create PDF from data 409 539 path = draw_sample_pdf(data, title=u"Signatures Sample Sheet")
Note: See TracChangeset for help on using the changeset viewer.