Skip to content

Commit

Permalink
Test for drawing mask contour on a transparent background.
Browse files Browse the repository at this point in the history
  • Loading branch information
m000 committed Jun 6, 2018
1 parent 26dfd5e commit c5966f4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/test_wordcloud.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from wordcloud import WordCloud, get_single_color_func, ImageColorGenerator
import os
import numpy as np
from random import Random
from nose.tools import (assert_equal, assert_greater, assert_true, assert_false,
Expand Down Expand Up @@ -229,6 +230,17 @@ def test_mask_contour():
assert_true(all(sm_array[100, 300] == [0, 0, 255]))


def test_mask_contour_transparent():
# test if mask contour can be drawn on a transparent background
# https://github.com/amueller/word_cloud/pull/389
mask = np.ones((600, 600), dtype='uint8')
mask[:, -10:] = 0
w = WordCloud(mode='RGBA', background_color=None, contour_color='blue', contour_width=2, mask=mask,
max_words=50, width=800, height=800)
w.generate(THIS)
img = w.to_image()


def test_single_color_func():
# test single color function for different color formats
random = Random(42)
Expand Down

0 comments on commit c5966f4

Please sign in to comment.