/usr/lib/python2.7/dist-packages/chaco/tests/border_test_case.py is in python-chaco 4.4.1-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | """ Needed Tests
Component.draw_border() tests
--------------------
DONE *. draw_border output should match a similar draw_rect output
"""
import nose
import unittest
from numpy import array, alltrue, ravel
# Chaco imports
from chaco.api import Plot, PlotGraphicsContext
class DrawBorderTestCase(unittest.TestCase):
def assertRavelEqual(self, x, y):
self.assert_(alltrue(ravel(x) == ravel(y)), "\n%s\n !=\n%s" % (x, y))
def test_draw_border_simple(self):
""" Borders should have the correct height and width.
"""
size = (5,5)
container = Plot(padding=1, border_visible=True)
container.outer_bounds = list(size)
gc = PlotGraphicsContext(size)
gc.render_component(container)
desired = array(((255, 255, 255, 255, 255, 255),
(255, 0, 0, 0, 0, 255),
(255, 0, 255, 255, 0, 255),
(255, 0, 255, 255, 0, 255),
(255, 0, 0, 0, 0, 255),
(255, 255, 255, 255, 255, 255)))
actual = gc.bmp_array[:,:,0]
self.assertRavelEqual(actual, desired)
if __name__ == "__main__":
unittest.main()
|