Skip to content

Commit

Permalink
Merge branch 'issue-68'
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlia committed Mar 22, 2013
2 parents 60fb489 + 455827f commit af0f40b
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 237 deletions.
Binary file added wandtests/assets/channel_images/alpha.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added wandtests/assets/channel_images/opacity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added wandtests/assets/channel_images/true_alpha.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 16 additions & 18 deletions wandtests/drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from wand.api import library
from wand.drawing import Drawing

from .image import asset, get_sig_version
from .image import asset


tests = Tests()
Expand Down Expand Up @@ -131,23 +131,21 @@ def draw_line(wand):

@tests.test
def draw_text(wand):
sig = get_sig_version({
(6, 6, 9, 7):
'674cddb15f6e8527b509704641af21bd0549c15bd5be870734aeeaa473a7a60c',
(6, 7, 7, 6):
'54d1fc4825ef0bddebb5de88419f05351a8f137828cbae1f767fa4a2ca1bbab4',
})
with Image(width=100, height=100, background=Color('#fff')) as img:
with Drawing() as draw:
draw.font = asset('League_Gothic.otf')
draw.font_size = 25
with Color('#000') as bk:
draw.fill_color = bk
draw.gravity = 'west'
draw.text(0, 0, 'Hello Wand')
draw.draw(img)

assert img.signature == sig
with Color('#fff') as white:
with Image(width=100, height=100, background=white) as img:
with Drawing() as draw:
draw.font = asset('League_Gothic.otf')
draw.font_size = 25
with Color('#000') as bk:
draw.fill_color = bk
draw.gravity = 'west'
draw.text(0, 0, 'Hello Wand')
draw.draw(img)
assert (img[0, 0] == img[0, -1] == img[-1, 0] == img[-1, -1] ==
img[0, 39] == img[0, 57] == img[77, 39] == img[77, 57] ==
white)
assert (img[2, 40] == img[2, 57] == img[75, 40] == img[75, 57] ==
Color('black'))


@tests.test
Expand Down
Loading

0 comments on commit af0f40b

Please sign in to comment.