8000 Agg snapping fixes (for the last time...?) :) by mdboom · Pull Request #1800 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Agg snapping fixes (for the last time...?) :) #1800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 7, 2013
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add a test based on @pelson's example in #1591.
  • Loading branch information
mdboom committed Mar 1, 2013
commit 8fe199ba8fdd470d51d9635151a9071686e9d046
31 changes: 31 additions & 0 deletions lib/matplotlib/tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,37 @@ def test_image_shift():
extent=(tMin, tMax, 1, 100))
ax.set_aspect('auto')

@cleanup
def test_image_edges():
f = plt.figure(figsize=[1, 1])
ax = f.add_axes([0, 0, 1, 1], frameon=False)

data = np.tile(np.arange(12), 15).reshape(20, 9)

im = ax.imshow(data, origin='upper',
extent=[-10, 10, -10, 10], interpolation='none',
cmap='gray'
)

x = y = 2
ax.set_xlim([-x, x])
ax.set_ylim([-y, y])

ax.set_xticks([])
ax.set_yticks([])

buf = io.BytesIO()
f.savefig(buf, facecolor=(0, 1, 0))

buf.seek(0)

im = plt.imread(buf)
r, g, b, a = sum(im[:, 0])
r, g, b, a = sum(im[:, -1])

assert g != 100, 'Expected a non-green edge - but sadly, it was.'


if __name__=='__main__':
import nose
nose.runmodule(argv=['-s','--with-doctest'], exit=False)
0