print handling

This commit is contained in:
John Bintz 2010-01-05 22:15:16 -05:00
parent f36a14d9c1
commit 37c54970d5
2 changed files with 27 additions and 1 deletions

View File

@ -43,7 +43,7 @@ module PrintHandling
def build_for_print(input, output, side = "none")
page_width, page_height = calculate_page_size
command = [
"-density #{config['dpi']}",
"-density #{@config['dpi']}",
"-size #{page_width.to_i}x#{page_height.to_i}",
"xc:white"
]

View File

@ -26,4 +26,30 @@ class TestPrintHandling < Test::Unit::TestCase
assert_equal expected_return, @instance.calculate_page_size
end
end
def test_build_for_print
@instance.stubs(:calculate_page_size).returns([10, 20])
@instance.config = { 'dpi' => 100 }
[
[ 'none', 'Center' ],
[ 'left', 'East' ],
[ 'right', 'West' ]
].each do |side, gravity|
[
[ '|pipe', 'pipe' ],
[ 'nopipe', '"nopipe"' ]
].each do |output, expected_filename|
@instance.expects(:convert).with([
'-density 100',
'-size 10x20',
'xc:white',
"-gravity #{gravity}",
"-draw 'image Over 0,0 0,0 \"input\"'",
expected_filename
])
@instance.build_for_print('input', output, side)
end
end
end
end