Skip to content

Commit 842a5c4

Browse files
author
Zair Mubashar
committed
Added tests for CustomCell
1 parent ac6f471 commit 842a5c4

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

lib/matplotlib/tests/test_table.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
import numpy as np
88
from matplotlib.testing.decorators import image_comparison
99

10+
from matplotlib.table import CustomCell
11+
from matplotlib.path import Path
12+
from nose.tools import assert_equal
13+
1014

1115
@image_comparison(baseline_images=['table_zorder'],
1216
extensions=['png'],
@@ -98,3 +102,22 @@ def test_diff_cell_table():
98102
)
99103
ax.axis('off')
100104
plt.tight_layout()
105+
106+
107+
def test_customcell():
108+
types = ('horizontal', 'vertical', 'open', 'closed', 'T', 'R', 'B', 'L')
109+
codes = (
110+
(Path.MOVETO, Path.LINETO, Path.MOVETO, Path.LINETO, Path.MOVETO),
111+
(Path.MOVETO, Path.MOVETO, Path.LINETO, Path.MOVETO, Path.LINETO),
112+
(Path.MOVETO, Path.MOVETO, Path.MOVETO, Path.MOVETO, Path.MOVETO),
113+
(Path.MOVETO, Path.LINETO, Path.LINETO, Path.LINETO, Path.CLOSEPOLY),
114+
(Path.MOVETO, Path.MOVETO, Path.MOVETO, Path.LINETO, Path.MOVETO),
115+
(Path.MOVETO, Path.MOVETO, Path.LINETO, Path.MOVETO, Path.MOVETO),
116+
(Path.MOVETO, Path.LINETO, Path.MOVETO, Path.MOVETO, Path.MOVETO),
117+
(Path.MOVETO, Path.MOVETO, Path.MOVETO, Path.MOVETO, Path.LINETO),
118+
)
119+
120+
for t, c in zip(types, codes):
121+
cell = CustomCell((0, 0), visible_edges=t, width=1, height=1)
122+
code = tuple(s for _, s in cell.get_path().iter_segments())
123+
assert_equal(c, code)

0 commit comments

Comments
 (0)