from gui import *
from gui_TextureDescription import *
from memory_Context import *

def test_gui_generateTextureDescriptions(
) -> str:
  c = memory_createContext()
  c.tileImage = "res/img.png"
  c.tileImageCount = 3
  c.tileImageHeight = 35
  c.tileImageWidth = 20
  c.recentField = "tileImageWidth"
  c = gui_generateTextureDescriptions(c)
  if (
    c.recentField == "textureDescriptions" and
    len(c.textureDescriptions) == 3 and
    c.textureDescriptions[0].fileName == "res/img.png" and
    c.textureDescriptions[0].height == 35 and
    c.textureDescriptions[0].width == 20 and
    c.textureDescriptions[0].x == 0 and
    c.textureDescriptions[1].x == 20 and
    c.textureDescriptions[2].x == 40
  ):
    return "OK: gui_generateTextureDescriptions"
  #}
  return "ERR: gui_generateTextureDescriptions"
#}

def test_gui_generateTilePositions(
) -> str:
  c = memory_createContext()

  c.cellSize = 10
  c.playfieldSize = 2
  c.cellPositions = gui_aux_cellGridPositions(c.playfieldSize)
  c.windowHeight = 200
  c.windowWidth = 200
  c.recentField = "windowWidth"

  c = gui_generateTilePositions(c)
  if (
    c.recentField == "tilePositions" and
    len(c.tilePositions) == 4 and
    c.tilePositions[0][0] == 140
  ):
    return "OK: gui_generateTilePositions"
  #}
  return "ERR: gui_generateTilePositions"
#}
