@@ -63,9 +63,6 @@ def gui_generateTilePositions( | |||||
return c | 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) | positions = gui_aux_cellPositions(c.playfieldSize) | ||||
ps = [] | ps = [] | ||||
@@ -25,3 +25,24 @@ def test_gui_generateTextureDescriptions( | |||||
#} | #} | ||||
return "ERR: 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" | |||||
#} |
@@ -52,6 +52,7 @@ print(cli_test_reportVictory()) | |||||
print(test_gui_aux_cellPositions()) | print(test_gui_aux_cellPositions()) | ||||
print(test_gui_generateTextureDescriptions()) | print(test_gui_generateTextureDescriptions()) | ||||
print(test_gui_generateTilePositions()) | |||||
ctrl = ctx_Controller(memory_createContext()) | ctrl = ctx_Controller(memory_createContext()) | ||||
ctrl.registerFunctions([ | ctrl.registerFunctions([ | ||||