Commit Graph

238 Commits

Author SHA1 Message Date
nulano
2f95e49b36 add test using woff2 font with freetype 2022-09-07 20:25:59 +02:00
Ondrej Baranovič
0ec3d3ec2c
Use pytest.param for consistency
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2022-08-29 20:34:11 +02:00
Ondrej Baranovič
18bd77bbc0
simplify code, make test more generic 2022-08-25 19:45:33 +10:00
nulano
aa5d67e492
convert TestImageFont and TestImageFont_RaqmLayout into a test fixture 2022-08-25 03:02:47 +02:00
Andrew Murray
54b01f55f8 Round box position to integer when pasting embedded color 2022-08-22 12:14:54 +10:00
Andrew Murray
dea30e4c80 Fixed set_variation_by_name offset 2022-07-18 08:39:23 +10:00
nulano
74e0b954f2
test {ImageFont,TransposedFont}.getsize() deprecation 2022-07-01 11:22:47 +02:00
nulano
93acbcf9e2
add getbbox and getlength to TransposedFont with tests 2022-06-20 02:37:42 +01:00
nulano
e2158344a0
update test_imagefont to use textbbox 2022-06-20 01:20:56 +01:00
nulano
c854bf8d1c
add getbbox and getlength to basic ImageFont and update related tests 2022-06-19 22:04:56 +01:00
Andrew Murray
a40c7a6bea If font is file-like object, do not re-read from object to get variant 2022-04-22 07:31:20 +10:00
nulano
ab86bdda0a
fix deprecation test 2022-04-17 16:03:53 +02:00
nulano
b4b8249c9d
None is also not a valid value 2022-04-16 17:46:43 +02:00
nulano
a766b5b0d5
deprecate fill in imageFont 2022-04-16 17:07:32 +02:00
Andrew Murray
030a6225de Removed duplicate test 2022-02-22 11:03:36 +11:00
Andrew Murray
b38a67fa12
Merge branch 'main' into enum 2022-02-10 09:52:24 +11:00
nulano
a278e0aa65
issue warning if Raqm layout is requested, but Raqm is not available 2022-02-07 23:57:35 +00:00
Andrew Murray
ed8073e846 Deprecated constants in favour of enums 2022-01-15 10:07:07 +11:00
Andrew Murray
f8e4e9c2dd Added enums 2022-01-15 09:02:31 +11:00
Hugo van Kemenade
31a96b9c9b Upgrade Python syntax with pyupgrade --py36-plus and format with Black 2021-10-19 15:34:52 +03:00
Andrew Murray
e6ffeac66f Updated image comparison 2021-10-19 16:08:23 +11:00
Hugo van Kemenade
cb5c8f6f86 Remove unused left_old variable 2021-10-18 11:28:14 +03:00
Hugo van Kemenade
606b5ae1e5 Remove support for FreeType 2.7 and older 2021-10-18 09:29:53 +03:00
nulano
19f4c6fd23 don't use bitmap glyphs when drawing text with stroker 2021-10-14 08:19:04 +01:00
Andrew Murray
a39cb04f3e Consider I;16 pixel size when drawing text 2021-07-09 21:23:43 +10:00
Andrew Murray
362d504011 Raise an error if textbbox is used without a FreeTypeFont 2021-05-25 20:45:38 +10:00
Andrew Murray
8bc19ac78c Do not alter pixels outside mask when drawing text on an image with transparency 2021-04-29 23:08:25 +10:00
Eric Soroos
ba65f0b08e Fix Memory DOS in ImageFont
* A corrupt or specially crafted TTF font could have font metrics that
  lead to unreasonably large sizes when rendering text in
  font. ImageFont.py did not check the image size before allocating
  memory for it.
* Found with oss-fuzz
* This dates from the PIL fork
2021-04-01 17:17:27 +03:00
Ondrej Baranovič
14671f715f
Merge branch 'master' into sbix 2021-03-07 20:05:25 +01:00
Hugo van Kemenade
a95fee0475
Merge pull request #5215 from radarhere/license
Document license for several fonts
2021-03-07 11:41:56 +02:00
Andrew Murray
8fb5fd7f63 Updated tests for changed helper imports 2021-02-22 12:14:49 +11:00
nulano
c709aa3d28 minor test formatting cleanup 2021-02-22 12:03:01 +11:00
nulano
61ee8ec03c document and add tests for SBIX color font support 2021-02-22 12:00:20 +11:00
Andrew Murray
3495b319bd Replaced various instances of assert_image_similar with assert_image_similar_tofile 2021-02-21 22:22:29 +11:00
Andrew Murray
a5c251029c Replaced various instances of assert_image_equal with assert_image_equal_tofile 2021-02-21 22:15:56 +11:00
Andrew Murray
b39977e1c2 Document license for several fonts 2021-01-21 21:33:35 +11:00
Andrew Murray
83d82ae150
Merge pull request #5098 from hugovk/deprecate-freetype
Deprecate FreeType 2.7
2020-12-20 13:35:41 +11:00
Hugo van Kemenade
27bf17009c Deprecate FreeType 2.7, to be removed in Pillow 9 (2022-01-02) 2020-12-17 10:28:06 +02:00
nulano
db35e6404e remove FreeType<2.7 metrics in test_imagefont 2020-12-12 15:29:41 +01:00
nulano
86993df834 remove duplicate values 2020-11-25 07:38:13 +00:00
nulano
74048f9b4f remove FT 2.3 from tests 2020-11-25 07:27:11 +00:00
nulano
c277ff4304 remove old PyPy compatibility code 2020-10-12 16:14:51 +01:00
nulano
b49ebad5f5 Merge remote-tracking branch 'upstream/master' into anchor-part3 2020-10-12 16:14:00 +01:00
nulano
cb3f6c09e7 add spaces between pytest.mark.parametrize parameters 2020-10-12 16:08:16 +01:00
Hugo van Kemenade
c1a9f889f3
Merge pull request #4964 from nulano/pypy 2020-10-12 17:59:55 +03:00
nulano
90e8255ba4 Merge remote-tracking branch 'upstream/master' into anchor-part3
# Conflicts:
#	Tests/test_imagefontctl.py
2020-10-12 15:50:45 +01:00
nulano
c06bb8044d remove PyPy3-7.1.x compatibility code 2020-10-12 02:08:50 +01:00
nulano
b5fe0e7986 add helper.skip_unless_feature_version 2020-10-11 22:26:11 +01:00
nulano
d84185579e move bitmap font tests to test_imagefont 2020-10-11 21:45:10 +01:00
nulano
b85fabca70
Apply suggestions from code review
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2020-10-11 22:25:16 +02:00
nulano
1551e120ae add textlength and textbbox to ImageDraw 2020-10-09 01:02:51 +01:00
nulano
395aa946a9 add getbbox and getlength, with tests
Squashed commits:

[ec9ec31b] add tests for invalid anchor
(cherry picked from commit 9e50a6a47f79876ee56942152047f03fff03c49b)

[386a9170] fix lint and docs
(cherry picked from commit 2d0d5282fcfc3ee332a41e60b865ee766445cc3d)

[29f5d4c9] restore and document previous getsize behaviour
see discussion in issue 4789
(cherry picked from commit 9fbc94571ce0ed42fdd11e99f343a1613c9dc6d3)

[0ffd51a0] add getbbox and getlength, with tests
(cherry picked from commit c5f63737476a998c81e589e5819d21ca69bb7b46)
2020-10-09 00:56:58 +01:00
nulano
786eaf11e2 downgrade NotoColorEmoji to minimize size 2020-10-07 13:31:05 +01:00
nulano
28d313305a fix tests 2020-10-07 05:29:18 +01:00
nulano
55db572467 add tests for opaque COLR and CBDT fonts 2020-10-07 05:29:18 +01:00
nulano
7d284b72ab
f-strings!
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2020-09-22 22:19:04 +01:00
nulano
0838d8ea62 add tests for multiline text with anchor 2020-09-22 14:58:21 +02:00
nulano
3fc1be06e6 add and fix tests for text anchors 2020-09-22 11:31:43 +02:00
Hugo van Kemenade
93d011efb5
Merge pull request #4910 from nulano/anchor-part1 2020-09-19 13:41:15 +03:00
Andrew Murray
c196af6ddb Fixed loading profile with non-ASCII path on Windows 2020-09-13 13:53:58 +10:00
nulano
d1edf86953 tests cleanup 2020-09-09 05:35:55 +02:00
nulano
ee1cc6ad7c remove use of FT_Set_Transform 2020-09-09 02:14:49 +02:00
nulano
54e067779b fix and add tests
(cherry picked from commit 0b711f10d0490863976699c051f2027b6799d501) (+1 squashed commits)

Squashed commits:

[9d4e6c17] fix tests
2020-09-09 02:12:21 +02:00
Hugo van Kemenade
dd87dd50c0 Update to isort 5 with Black profile support 2020-08-08 22:39:29 +03:00
Hugo van Kemenade
304d3c1080 Replace distutils.version with packaging.version.parse, distutils will eventually be removed from stdlib 2020-07-16 14:57:39 +03:00
Hugo van Kemenade
b4e7202dcb
Merge pull request #4698 from nulano/skips 2020-06-27 14:19:49 +03:00
Hugo van Kemenade
1bc67c9f0f
Merge pull request #4700 from nulano/features-version 2020-06-21 21:36:46 +03:00
nulano
12ddff729b
Merge branch 'master' into skips 2020-06-21 18:05:27 +01:00
Hugo van Kemenade
390b34c231
Merge pull request #4664 from nulano/ft-getsize-mode 2020-06-21 18:53:03 +03:00
nulano
a324f4a466 add version to features info block 2020-06-21 18:58:39 +10:00
Hugo van Kemenade
b9a087d482
Merge pull request #4566 from radarhere/text
Consider transparency when pasting text on an RGBA image
2020-06-20 15:02:59 +03:00
nulano
12cd02bd2d use xfail for failing tests 2020-06-14 19:38:21 +02:00
Andrew Murray
7d1f5ba91b Removed test skips for MinGW 2020-06-14 23:08:21 +10:00
Andrew Murray
05932c4cbc Updated harfbuzz to 2.6.7 2020-06-14 22:23:19 +10:00
nulano
2dd9324df2 add mono color text test 2020-06-01 22:18:38 +02:00
nulano
d2f90d6cac fix freetype and raqm on MSYS 2020-05-23 23:16:06 +02:00
Andrew Murray
e10cab42f1 Consider transparency when drawing text on an RGBA image 2020-04-19 20:56:17 +10:00
Hugo
dda6145fce Since Python 3.3 IOError and WindowsError have been merged into OSError 2020-04-10 12:57:29 +03:00
Andrew Murray
30a2d694cf Converted unittest mock to pytest monkeypatch 2020-03-29 10:43:44 +11:00
Andrew Murray
b602f365ae Removed PillowTestCase helper class 2020-03-28 12:51:28 +11:00
Andrew Murray
7859f81828 Use pytest to skip tests 2020-03-23 07:05:40 +11:00
Hugo
699a9dadf1 Convert asserts 2020-02-22 18:07:04 +02:00
Andrew Murray
8482919a37 Converted most assert statements to pytest 2020-02-23 00:06:21 +11:00
Jon Dufresne
4f185329f4 Streamline test skipping based on supported features
This adds a new test decorator: skip_unless_feature(). The argument is
the same as passed to features.check(). If the feature is not supported,
the test will be skipped.

This removes several kinds of boilerplate copied and pasted around tests
so test feature checking is handled and displayed more consistently.

Refs #4193
2020-02-18 13:07:01 -08:00
Jon Dufresne
1a3ebafdd2 Replace SimplePatcher with builtin unittest.mock module
The class more or less duplicates the features of the mock module. Can
avoid the duplication by using the stdlib.
2020-02-17 10:06:19 -08:00
Hugo
a4bf9fa036 Convert most PillowTestCase methods to pytest 2020-02-02 12:26:01 +02:00
Andrew Murray
c0048ad7de Use context managers 2019-11-26 07:03:23 +11:00
Hugo van Kemenade
37be3b0dda
Merge pull request #4145 from nulano/ucs4-pypy
Fix Unicode support for PyPy
2019-11-24 13:51:27 +02:00
Jon Dufresne
33dabf986f Import unittest from stdlib rather than helper.py
The unittest in helper.py has not offered an interesting abstraction
since dbe9f85c7d so import from the more
typical stdlib location.
2019-11-20 18:42:52 -08:00
nulano
837d8ae984 fix support for extended unicode characters in PyPy 2019-11-20 17:02:44 +00:00
Andrew Murray
4140cd807b
Merge branch 'master' into rm-2.7 2019-10-12 18:03:58 +11:00
Hugo
865b17d5cf Remove Python 2-compatibility code 2019-10-07 16:23:22 +03:00
Hugo
538d9e2e5d Upgrade Python syntax with pyupgrade --py3-plus 2019-10-07 14:30:59 +03:00
nulano
cf1f8b0498 Tests.helper cleanup 2019-09-25 11:58:02 +02:00
Andrew Murray
f93a5d0972 Added text stroking 2019-07-29 06:40:03 +10:00
Hugo van Kemenade
1ab5670eb1
Introduce isort to automate import ordering and formatting (#3954)
Introduce isort to automate import ordering and formatting
2019-07-16 23:02:31 +03:00
Jon Dufresne
d50445ff30 Introduce isort to automate import ordering and formatting
Similar to the recent adoption of Black. isort is a Python utility to
sort imports alphabetically and automatically separate into sections. By
using isort, contributors can quickly and automatically conform to the
projects style without thinking. Just let the tool do it.

Uses the configuration recommended by the Black to avoid conflicts of
style.

Rewrite TestImageQt.test_deprecated to no rely on import order.
2019-07-06 16:11:35 -07:00
nulano
0b0dc1112e Merge branch 'master' into revert-3931-update-freetype-epsilon
# Conflicts:
#	Tests/test_imagefont.py
2019-07-02 22:49:45 +02:00
nulano
d7c69ea2b4 skip test_unicode_extended on Python 2.x 2019-07-02 11:14:09 +02:00
nulano
22ce5cc0c7
Revert "Update epsilon for FreeType 2.10 with eg. Unicode width 16" 2019-07-02 11:08:48 +02:00