Author: Lars Wassermann <[email protected]>
Branch:
Changeset: r489:2c23bb7db0f1
Date: 2013-07-05 15:48 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/2c23bb7db0f1/
Log: added test for the offset computation for 1bit case
diff --git a/spyvm/test/test_model.py b/spyvm/test/test_model.py
--- a/spyvm/test/test_model.py
+++ b/spyvm/test/test_model.py
@@ -350,7 +350,6 @@
assert target.getword(0) == 0xffff0100
assert target.getword(1) == 0x7fff8000
[email protected]("socket.gethostname() == 'precise32'")
def test_display_bitmap():
# XXX: Patch SDLDisplay -> get_pixelbuffer() to circumvent
# double-free bug
@@ -359,7 +358,7 @@
return lltype.malloc(rffi.ULONGP.TO, self.width * self.height * 32,
flavor='raw')
display.SDLDisplay.get_pixelbuffer = get_pixelbuffer
d = display.SDLDisplay("test")
- d.set_video_mode(10, 10, 1)
+ d.set_video_mode(32, 10, 1)
target = model.W_DisplayBitmap.create(space, space.w_Array, 100, 1, d)
target.setword(0, r_uint(0xFF00))
@@ -377,6 +376,20 @@
for i in xrange(24, 32):
assert target.pixelbuffer[i] == 0xffffffff
+def test_display_offset_computation():
+
+ def get_pixelbuffer(self):
+ from rpython.rtyper.lltypesystem import lltype, rffi
+ return lltype.malloc(rffi.ULONGP.TO, self.width * self.height * 32,
flavor='raw')
+ display.SDLDisplay.get_pixelbuffer = get_pixelbuffer
+ d = display.SDLDisplay("test")
+ d.set_video_mode(18, 5, 1)
+
+ dbitmap = model.W_DisplayBitmap.create(space, space.w_Array, 5, 1, d)
+
+ assert dbitmap.compute_pos_and_line_end(0, 1) == (0, 18)
+ assert dbitmap.compute_pos_and_line_end(1, 1) == (18, 36)
+ assert dbitmap.size() == 5
@py.test.mark.skipif("socket.gethostname() == 'precise32'")
def test_weak_pointers():
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit