From 9618c40af668c27dedd83fcc101a99f9573c1b09 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Mon, 26 Feb 2018 02:42:50 -0500
Subject: [PATCH 4/7] Increase tolerance for new FreeType.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
lib/cartopy/tests/mpl/test_gridliner.py | 10 +++++++++-
lib/cartopy/tests/mpl/test_ticks.py | 5 +++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/lib/cartopy/tests/mpl/test_gridliner.py b/lib/cartopy/tests/mpl/test_gridliner.py
index 9fbeba7..3412b2f 100644
--- a/lib/cartopy/tests/mpl/test_gridliner.py
+++ b/lib/cartopy/tests/mpl/test_gridliner.py
@@ -17,7 +17,10 @@
from __future__ import (absolute_import, division, print_function)
+from distutils.version import LooseVersion
+
from matplotlib.backends.backend_agg import FigureCanvasAgg
+import matplotlib.ft2font
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
try:
@@ -111,10 +114,15 @@ elif MPL_VERSION >= '1.5':
grid_label_image = 'gridliner_labels_1.5'
else:
grid_label_image = 'gridliner_labels_pre_mpl_1.5'
+if (MPL_VERSION >= '1.5' and
+ LooseVersion(matplotlib.ft2font.__freetype_version__) >= '2.7'):
+ grid_label_tolerance = 20.3
+else:
+ grid_label_tolerance = 0
@pytest.mark.natural_earth
-@ImageTesting([grid_label_image])
+@ImageTesting([grid_label_image], tolerance=grid_label_tolerance)
def test_grid_labels():
plt.figure(figsize=(8, 10))
diff --git a/lib/cartopy/tests/mpl/test_ticks.py b/lib/cartopy/tests/mpl/test_ticks.py
index 1397f19..33e2b09 100644
--- a/lib/cartopy/tests/mpl/test_ticks.py
+++ b/lib/cartopy/tests/mpl/test_ticks.py
@@ -17,8 +17,10 @@
from __future__ import (absolute_import, division, print_function)
+from distutils.version import LooseVersion
import math
+import matplotlib.ft2font
import matplotlib.pyplot as plt
import matplotlib.ticker
import pytest
@@ -59,6 +61,9 @@ elif '2.0.0' <= MPL_VERSION < '2.0.1':
ticks_tolerance = 9
else:
ticks_tolerance = 0.5
+if (MPL_VERSION >= '1.5' and
+ LooseVersion(matplotlib.ft2font.__freetype_version__) >= '2.7'):
+ ticks_tolerance = max(ticks_tolerance, 6.67)
@pytest.mark.natural_earth
--
2.14.3