Beispiel #1
0
def test_str_repr(t):
  "Pixmap __str__ and __repr__ work"
  c = Pixmap(42, 43, t)
  assert "42x43" in str(c)
  assert "42x43" in repr(c)
  assert t.name in str(c)
  assert t.name in repr(c)
Beispiel #2
0
def test_subpixmap_vs_blit(t):
  "Compare Subpixmap and Blit of a rectangle"
  c = PixmapRand(31, 21, t)
  c2a = c.sub_pixmap(5, 7, 15, 9)
  c2b = Pixmap(15, 9, t)
  c.blit(5, 7, c2b, 0, 0, w=15, h=9)
  assert c2a == c2b
Beispiel #3
0
def test_blit_with_offset_and_rotation(t):
  "Blit with various shifts and rotation"
  c1 = PixmapRand(19, 17, t)
  for r in range(4):
    for i in [0,1,2]:
      c2 = Pixmap(51-i, 25+i, t)
      c1.blit(2+i, 3+i, c2, 1+i, 4-i, w=2+3*i, h=13-i)
    c1.rotate_cw()
Beispiel #4
0
def test_check_attributes(t):
  "Pixmap attributes"
  c = Pixmap(13, 15, t.type)
  assert c.w == 13
  assert c.h == 15
  assert c._bit_endian == t.bit_endian
  assert c.bpp == t.size
  assert c._free_pixels
Beispiel #5
0
def test_gfx_submodule_loads():
  "gfx is present in a Pixmap"
  c = Pixmap(1, 1, core.C.PIXEL_RGB888)
  assert c.gfx
Beispiel #6
0
def test_all_methods_are_known():
  "All methods of gfx submodule have known param types in this test"
  c = Pixmap(1, 1, core.C.PIXEL_RGB888)
  for name in dir(c.gfx):
    if name[0] != '_' and name not in ['C', 'ctx']:
      assert name in gfx_params
Beispiel #7
0
def test_gfx_submodule_has_C():
  "gfx contains C"
  c = Pixmap(1, 1, core.C.PIXEL_RGB888)
  assert c.gfx.C
  assert gfx.C
Beispiel #8
0
def test_create_by_number(t):
  "Allocation by pixeltype number"
  c = Pixmap(3, 5, t)
Beispiel #9
0
def test_create_by_pixeltype(t):
  "Allocate Pixmap by pixeltype"
  c = Pixmap(13, 15, t.type)