File: rbpdf_format_test.rb

package info (click to toggle)
ruby-rbpdf 1.21.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 16,488 kB
  • sloc: ruby: 138,259; makefile: 12
file content (30 lines) | stat: -rw-r--r-- 863 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Copyright (c) 2011-2017 NAITOH Jun
# Released under the MIT license
# http://www.opensource.org/licenses/MIT

require 'test_helper'

class RbpdfFormatTest < Test::Unit::TestCase
  test "set_page_orientation" do
    pdf = RBPDF.new

    pagedim = pdf.set_page_orientation('')
    assert_equal 'P',   pagedim['or']
    assert_equal true,  pagedim['pb']
    assert_equal nil,   pagedim['olm']
    assert_equal nil,   pagedim['orm']
    assert_in_delta 20, pagedim['bm'], 0.1

    pagedim = pdf.set_page_orientation('P')
    assert_equal 'P',   pagedim['or']

    pagedim = pdf.set_page_orientation('L', false)
    assert_equal 'L',   pagedim['or']
    assert_equal false, pagedim['pb']

    pagedim = pdf.set_page_orientation('P', true, 5)
    assert_equal 'P',   pagedim['or']
    assert_equal true,  pagedim['pb']
    assert_equal 5,     pagedim['bm']
  end
end