Esempio n. 1
0
def test_1wordobjectheader2():
    s = ints2str(joinbits([3, 1, 2, 3, 4], [2, 6, 4, 5, 12]))
    r = imagereader_mock(s * 3)
    assert (squeakimage.ImageChunk(1, 2, 3,
                                   4), 0) == r.read_1wordobjectheader()
    assert (squeakimage.ImageChunk(1, 2, 3,
                                   4), 4) == r.read_1wordobjectheader()
    assert (squeakimage.ImageChunk(1, 2, 3,
                                   4), 8) == r.read_1wordobjectheader()
Esempio n. 2
0
def test_read3wordheaderobject():
    size = 42
    s = ints2str(size << 2, 4200 + 0, joinbits([0, 1, 2, 3, 4], [2,6,4,5,12]))
    r = imagereader_mock(s + '\x00\x00\x19\x66' * (size - 1))
    chunk, pos = r.read_object()
    chunk0 = squeakimage.ImageChunk(space, size, 2, 4200, 4)
    chunk0.data = [6502] * (size - 1)
    assert pos == 8
    assert chunk0 == chunk
Esempio n. 3
0
def test_3wordobjectheader():
    s = ints2str(1701 << 2, 4200 + 0, joinbits([0, 1, 2, 3, 4], [2,6,4,5,12]))
    r = imagereader_mock(s)
    assert (squeakimage.ImageChunk(space, 1701, 2, 4200, 4), 8) == r.read_3wordobjectheader()
Esempio n. 4
0
def test_2wordobjectheader():
    s = ints2str(4200 + 1, joinbits([1, 1, 2, 3, 4], [2,6,4,5,12]))
    r = imagereader_mock(s)
    assert (squeakimage.ImageChunk(space, 1, 2, 4200, 4), 4) == r.read_2wordobjectheader()