Research portable Memory game | Исследовать портируемую игру Память
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

50 рядки
1.3KB

  1. from gui import *
  2. from gui_TextureDescription import *
  3. from memory_Context import *
  4. def test_gui_generateTextureDescriptions(
  5. ) -> str:
  6. c = memory_createContext()
  7. c.tileImage = "res/img.png"
  8. c.tileImageCount = 3
  9. c.tileImageHeight = 35
  10. c.tileImageWidth = 20
  11. c.recentField = "tileImageWidth"
  12. c = gui_generateTextureDescriptions(c)
  13. if (
  14. c.recentField == "textureDescriptions" and
  15. len(c.textureDescriptions) == 3 and
  16. c.textureDescriptions[0].fileName == "res/img.png" and
  17. c.textureDescriptions[0].height == 35 and
  18. c.textureDescriptions[0].width == 20 and
  19. c.textureDescriptions[0].x == 0 and
  20. c.textureDescriptions[1].x == 20 and
  21. c.textureDescriptions[2].x == 40
  22. ):
  23. return "OK: gui_generateTextureDescriptions"
  24. #}
  25. return "ERR: gui_generateTextureDescriptions"
  26. #}
  27. def test_gui_generateTilePositions(
  28. ) -> str:
  29. c = memory_createContext()
  30. c.cellSize = 10
  31. c.playfieldSize = 2
  32. c.cellPositions = gui_aux_cellGridPositions(c.playfieldSize)
  33. c.windowHeight = 200
  34. c.windowWidth = 200
  35. c.recentField = "windowWidth"
  36. c = gui_generateTilePositions(c)
  37. if (
  38. c.recentField == "tilePositions" and
  39. len(c.tilePositions) == 4 and
  40. c.tilePositions[0][0] == 140
  41. ):
  42. return "OK: gui_generateTilePositions"
  43. #}
  44. return "ERR: gui_generateTilePositions"
  45. #}