From 1f20308ff0d9ff692378d26cc4e98730624535db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=9A=D0=B0=D0=BF?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BA=D0=BE?= Date: Fri, 28 Jun 2024 22:58:13 +0300 Subject: [PATCH] d --- v5/gui.py | 3 --- v5/gui_test.py | 21 +++++++++++++++++++++ v5/main-gui.py | 1 + 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/v5/gui.py b/v5/gui.py index 1d939f5..4311aad 100644 --- a/v5/gui.py +++ b/v5/gui.py @@ -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 = [] diff --git a/v5/gui_test.py b/v5/gui_test.py index 9fd268c..70c1cf9 100644 --- a/v5/gui_test.py +++ b/v5/gui_test.py @@ -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" +#} diff --git a/v5/main-gui.py b/v5/main-gui.py index f2edeff..76c84c6 100644 --- a/v5/main-gui.py +++ b/v5/main-gui.py @@ -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([