From 3a147161307dd8189243fba8d1c2283a6bba1122 Mon Sep 17 00:00:00 2001 From: Adam NAILI Date: Thu, 1 Feb 2018 22:07:24 +0100 Subject: Clearing TODOs --- .../wallj/controller/DisplayControllerTest.java | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/test/java/fr/umlv/java/wallj/controller/DisplayControllerTest.java (limited to 'src/test/java/fr/umlv') diff --git a/src/test/java/fr/umlv/java/wallj/controller/DisplayControllerTest.java b/src/test/java/fr/umlv/java/wallj/controller/DisplayControllerTest.java new file mode 100644 index 0000000..bcd4de9 --- /dev/null +++ b/src/test/java/fr/umlv/java/wallj/controller/DisplayControllerTest.java @@ -0,0 +1,44 @@ +package fr.umlv.java.wallj.controller; + +import fr.umlv.java.wallj.board.Board; +import fr.umlv.java.wallj.board.TileVec2; +import fr.umlv.java.wallj.context.Context; +import fr.umlv.java.wallj.context.Game; +import fr.umlv.java.wallj.context.ScreenManager; +import fr.umlv.java.wallj.block.Block; +import fr.umlv.java.wallj.block.BlockFactory; +import fr.umlv.java.wallj.block.BlockType; +import fr.umlv.zen5.Application; +import org.junit.jupiter.api.Test; + +import java.awt.*; +import java.util.Collections; +import java.util.LinkedList; + +public class DisplayControllerTest { + @Test + void TestDisplay() throws java.lang.InterruptedException { + + Application.run(Color.WHITE, applicationContext -> { + for (; ; ) { + applicationContext.renderFrame(graphics2D -> { + Board.Builder builder = new Board.Builder(51, 51); + TileVec2 t0 = TileVec2.of(50, 50); + builder.setBlockTypeAt(t0, BlockType.WALL); + LinkedList boards = new LinkedList<>(); + boards.add(builder.build()); + Game game = new Game(boards); + ScreenManager screenManager = new ScreenManager(applicationContext, graphics2D); + try { + Thread.sleep(50); + } catch (Exception e) { + System.exit(-1); + } + Context context = new Context(game, Collections.emptyList(), screenManager.clearScreen()); + Block block = BlockFactory.build(BlockType.BOMB, t0); + block.update(context); + }); + } + }); + } +} -- cgit v1.2.3