Михаил Капелько 4 months ago
parent
commit
1f20308ff0
3 changed files with 22 additions and 3 deletions
  1. +0
    -3
      v5/gui.py
  2. +21
    -0
      v5/gui_test.py
  3. +1
    -0
      v5/main-gui.py

+ 0
- 3
v5/gui.py View File

@@ -63,9 +63,6 @@ def gui_generateTilePositions(
return c
#}

# Assume window size is an integer multiple of cell size.
widthInCells = c.windowWidth / c.cellSize
heightInCells = c.windowHeight / c.cellSize
positions = gui_aux_cellPositions(c.playfieldSize)

ps = []


+ 21
- 0
v5/gui_test.py View File

@@ -25,3 +25,24 @@ def test_gui_generateTextureDescriptions(
#}
return "ERR: gui_generateTextureDescriptions"
#}

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

c.cellSize = 10
c.playfieldSize = 2
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"
#}

+ 1
- 0
v5/main-gui.py View File

@@ -52,6 +52,7 @@ print(cli_test_reportVictory())

print(test_gui_aux_cellPositions())
print(test_gui_generateTextureDescriptions())
print(test_gui_generateTilePositions())

ctrl = ctx_Controller(memory_createContext())
ctrl.registerFunctions([


Loading…
Cancel
Save