diff --git a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/bar3d_shaded[-120-30].png b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/bar3d_shaded[-120-30].png new file mode 100644 index 000000000000..d7b564f7bfcf Binary files /dev/null and b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/bar3d_shaded[-120-30].png differ diff --git a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/bar3d_shaded.png b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/bar3d_shaded[-60-30].png similarity index 99% rename from lib/mpl_toolkits/tests/baseline_images/test_mplot3d/bar3d_shaded.png rename to lib/mpl_toolkits/tests/baseline_images/test_mplot3d/bar3d_shaded[-60-30].png index 074b810d2764..8ec0ed785dd4 100644 Binary files a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/bar3d_shaded.png and b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/bar3d_shaded[-60-30].png differ diff --git a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/bar3d_shaded[120--30].png b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/bar3d_shaded[120--30].png new file mode 100644 index 000000000000..0c8cd2089e4c Binary files /dev/null and b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/bar3d_shaded[120--30].png differ diff --git a/lib/mpl_toolkits/tests/test_mplot3d.py b/lib/mpl_toolkits/tests/test_mplot3d.py index d8ced829628f..f9a31d746a05 100644 --- a/lib/mpl_toolkits/tests/test_mplot3d.py +++ b/lib/mpl_toolkits/tests/test_mplot3d.py @@ -9,6 +9,17 @@ import numpy as np +@pytest.fixture +def baseline_images(request, extension): + # strip the leading test_, and the file extension from the parameters + name = request.node.name + if name.startswith('test_'): + name = name[5:] + name = name.replace('[{}-'.format(extension), '[') + name = name.replace('[]', '') + return [name] + + @image_comparison(baseline_images=['bar3d'], remove_text=True) def test_bar3d(): fig = plt.figure() @@ -21,12 +32,13 @@ def test_bar3d(): ax.bar(xs, ys, zs=z, zdir='y', align='edge', color=cs, alpha=0.8) +@pytest.mark.parametrize('azim, elev', [(-60, 30), (-120, 30), (120, -30)]) @image_comparison( - baseline_images=['bar3d_shaded'], + baseline_images=None, remove_text=True, extensions=['png'] ) -def test_bar3d_shaded(): +def test_bar3d_shaded(baseline_images, azim, elev): fig = plt.figure() ax = fig.add_subplot(111, projection='3d') x = np.arange(4) @@ -35,6 +47,7 @@ def test_bar3d_shaded(): x2d, y2d = x2d.ravel(), y2d.ravel() z = x2d + y2d ax.bar3d(x2d, y2d, x2d * 0, 1, 1, z, shade=True) + ax.view_init(azim=azim, elev=elev) fig.canvas.draw()