Research portable Memory game | Исследовать портируемую игру Память
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

6 个月前
5 个月前
5 个月前
5 个月前
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. #}