This repository has been archived by the owner on Sep 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
111 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
zbarlight==1.2 | ||
zbarlight==2.2 | ||
Kivy==1.10.1 | ||
Kivy-Garden==0.1.4 | ||
Pillow==4.3.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
isort==4.2.5 | ||
flake8==3.3.0 | ||
mock==2.0.0 | ||
pytest==4.3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import os | ||
import unittest | ||
|
||
import mock | ||
from kivy.base import EventLoop | ||
from kivy.core.image import Image | ||
|
||
from zbarcam import ZBarCam | ||
|
||
FIXTURE_DIR = os.path.join( | ||
os.path.dirname(os.path.abspath(__file__)), 'fixtures') | ||
# https://github.com/kivy/kivy/blob/1.10.1/doc/sources/faq.rst | ||
EventLoop.ensure_window() | ||
|
||
|
||
class TestZBarCam(unittest.TestCase): | ||
|
||
def setUp(self): | ||
with mock.patch('kivy.uix.anchorlayout.AnchorLayout.__init__'): | ||
self.zbarcam = ZBarCam() | ||
|
||
def test_detect_qrcode_frame_no_qrcode(self): | ||
""" | ||
Checks `_detect_qrcode_frame()` returns empty list on no qrcode. | ||
""" | ||
fixture_path = os.path.join(FIXTURE_DIR, 'no_qr_code.png') | ||
texture = Image(fixture_path).texture | ||
code_types = self.zbarcam.code_types | ||
symbols = self.zbarcam._detect_qrcode_frame(texture, code_types) | ||
self.assertEqual(symbols, []) | ||
|
||
def test_detect_qrcode_frame_one_qrcode(self): | ||
""" | ||
Checks `_detect_qrcode_frame()` can detect one qrcode. | ||
""" | ||
fixture_path = os.path.join(FIXTURE_DIR, 'one_qr_code.png') | ||
texture = Image(fixture_path).texture | ||
code_types = self.zbarcam.code_types | ||
symbols = self.zbarcam._detect_qrcode_frame(texture, code_types) | ||
self.assertEqual( | ||
symbols, | ||
['zbarlight test qr code']) | ||
|
||
def test_detect_qrcode_frame_one_qrcode_one_ean(self): | ||
""" | ||
Checks `_detect_qrcode_frame()` can detect one qrcode and one ean. | ||
""" | ||
fixture_path = os.path.join(FIXTURE_DIR, 'one_qr_code_and_one_ean.png') | ||
texture = Image(fixture_path).texture | ||
code_types = self.zbarcam.code_types | ||
symbols = self.zbarcam._detect_qrcode_frame(texture, code_types) | ||
# currently detects no codes, but that's a bug | ||
self.assertEqual(symbols, []) | ||
|
||
def test_detect_qrcode_frame_two_qrcodes(self): | ||
""" | ||
Checks `_detect_qrcode_frame()` can detect two qrcodes. | ||
""" | ||
fixture_path = os.path.join(FIXTURE_DIR, 'two_qr_codes.png') | ||
texture = Image(fixture_path).texture | ||
code_types = self.zbarcam.code_types | ||
symbols = self.zbarcam._detect_qrcode_frame(texture, code_types) | ||
self.assertEqual( | ||
symbols, | ||
['second zbarlight test qr code', 'zbarlight test qr code'] | ||
) |
File renamed without changes.
Empty file.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,28 @@ | ||
[tox] | ||
envlist = pep8,isort-check | ||
envlist = pep8,isort-check,py2 | ||
# no setup.py to be ran | ||
skipsdist = True | ||
# trick to enable pre-installation of Cython | ||
# https://stackoverflow.com/a/50081741/185510 | ||
indexserver = | ||
preinstall = https://pypi.python.org/simple | ||
|
||
[testenv] | ||
setenv = KIVY_UNITTEST = 1 | ||
passenv = DISPLAY | ||
deps = | ||
:preinstall: Cython==0.26.1 | ||
-r{toxinidir}/requirements/requirements.txt | ||
-r{toxinidir}/requirements/test_requirements.txt | ||
commands = pytest --ignore tests/ui/ tests/ | ||
|
||
[testenv:pep8] | ||
deps = | ||
-r{toxinidir}/requirements/test_requirements.txt | ||
commands = flake8 zbarcam/ tests/ | ||
|
||
[testenv:isort-check] | ||
deps = | ||
-r{toxinidir}/requirements/test_requirements.txt | ||
commands = | ||
isort --check-only --recursive zbarcam/ tests/ | ||
isort --check-only --recursive --diff zbarcam/ tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '2019.0222' | ||
__version__ = '2019.0223' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters