Skip to content

Commit

Permalink
Merge pull request sirfz#41 from PeterZhizhin/master
Browse files Browse the repository at this point in the history
Added segfault test
  • Loading branch information
sirfz authored May 9, 2017
2 parents 30dbb10 + 79c5934 commit dcf3554
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,21 @@ def test_end(self):
self._api.End()
self._api.SetImageFile(self._image_file)
self.assertRaises(RuntimeError, self._api.GetUTF8Text)

@unittest.skipIf(not pil_installed, "Pillow not installed")
def test_empty_getcomponents(self):
self._api.Init()
image = Image.new("RGB", (100, 100), (1, 1, 1))
self._api.SetImage(image)
result = self._api.GetComponentImages(tesserocr.RIL.TEXTLINE, True)
# Test if empty
self.assertFalse(result)

@unittest.skipIf(not pil_installed, "Pillow not installed")
def test_empty_small_getcomponents(self):
self._api.Init()
image = Image.new("RGB", (1, 1), (1, 1, 1))
self._api.SetImage(image)
result = self._api.GetComponentImages(tesserocr.RIL.TEXTLINE, True)
# Test if empty
self.assertFalse(result)

0 comments on commit dcf3554

Please sign in to comment.