diff --git a/README.md b/README.md index 045cae8..92a3262 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ ![](https://github.com/source-foundry/font-v/raw/images/images/font-v-crunch.png) +[![Build Status](https://travis-ci.org/source-foundry/font-v.svg?branch=master)](https://travis-ci.org/source-foundry/font-v) [![Build status](https://ci.appveyor.com/api/projects/status/mtbar0q307926xff/branch/master?svg=true)](https://ci.appveyor.com/project/chrissimpkins/font-v/branch/master) + ## About font-v is a font version string reporting and modification tool. It reports and modifies the OpenType name table nameID 5 record in ttf and otf fonts. diff --git a/test_runner.sh b/test_runner.sh old mode 100644 new mode 100755 diff --git a/tests/test_fonttools.py b/tests/test_fonttools.py new file mode 100644 index 0000000..8276226 --- /dev/null +++ b/tests/test_fonttools.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + + +from __future__ import unicode_literals + +import sys +import pytest + +from fontTools.misc.py23 import unicode, tounicode, tobytes, tostr + + +def test_fontv_fonttools_lib_unicode(): + test_string = tobytes("hello") + test_string_str = tostr("hello") + test_string_unicode = tounicode(test_string, 'utf-8') + test_string_str_unicode = tounicode(test_string_str, 'utf-8') + + assert (isinstance(test_string, unicode)) is False + if sys.version_info[0] == 2: + assert (isinstance(test_string_str, unicode)) is False # str != unicode in Python 2 + elif sys.version_info[0] == 3: + assert (isinstance(test_string_str, unicode)) is True # str = unicode in Python 3 + assert (isinstance(test_string_unicode, unicode)) is True # after cast with fonttools function, Py2+3 = unicode + assert (isinstance(test_string_str_unicode, unicode)) is True # ditto + assert test_string_unicode == "hello"