Exemplo n.º 1
0
 @Test
 public void addAbsorberTest() {
   assertTrue(model.getAbsorber() == null);
   model.addAbsorber("absorb", 0, 0, 20, 20);
   model.addAbsorber("absorb", 0, 20, 60, 80);
   assertFalse(model.getAbsorber() == null);
   assertTrue(model.getAbsorber().getXTopLeft() == 0);
   assertTrue(model.getAbsorber().getYTopLeft() == 20);
   assertTrue(model.getAbsorber().getXBottomRight() == 60);
   assertTrue(model.getAbsorber().getYBottomRight() == 80);
 }
Exemplo n.º 2
0
 @Test
 public void objectNameTest() {
   assertTrue(model.getObjectTypeForKeyConnection("sBump") == null);
   model.addSquareBumper(40, 0, 0, "sBump");
   assertTrue(model.getObjectTypeForKeyConnection("sBump") == null);
   model.addFlipper(60, 60, false, "flipper");
   model.addAbsorber("absorb", 0, 180, 200, 200);
   assertEquals(model.getObjectTypeForKeyConnection("flipper"), "Flipper");
   assertEquals(model.getObjectTypeForKeyConnection("absorb"), "Absorber");
 }
Exemplo n.º 3
0
 @Test
 public void deleteElementTest() {
   assertFalse(model.deleteElement(0, 0));
   model.addSquareBumper(0, 0, 0, "sBump");
   assertTrue(model.deleteElement(0, 0));
   model.addFlipper(0, 0, true, "flipper");
   assertTrue(model.deleteElement(0, 0));
   model.addAbsorber("absorb", 0, 0, 20, 20);
   assertTrue(model.deleteElement(0, 0));
   model.addBall("b1", 10, 10, 50, 50);
   assertTrue(model.deleteElement(0, 0));
 }
Exemplo n.º 4
0
 @Test
 public void moveBallTest() {
   model.addSquareBumper(40, 0, 0, "sBump");
   model.addFlipper(60, 60, false, "flipper");
   model.addAbsorber("absorb", 0, 180, 200, 200);
   model.addBall("b1", 10, 10, 50, 50);
   model.moveModel();
   assertTrue(model.getBalls().get(0).getX() != 10);
   assertTrue(model.getBalls().get(0).getY() != 10);
   model.reset();
   assertTrue(model.getBalls().get(0).getX() == 10);
   assertTrue(model.getBalls().get(0).getX() == 10);
 }
Exemplo n.º 5
0
 @Test
 public void moveElementTest() {
   assertFalse(model.moveElement(0, 0, 60, 60));
   model.addSquareBumper(40, 0, 0, "sBump");
   model.addFlipper(0, 0, true, "flipper");
   model.addAbsorber("absorb", 0, 40, 100, 60);
   model.addBall("b1", 70, 10, 50, 50);
   assertFalse(model.moveElement(40, 0, 0, 0));
   assertFalse(model.moveElement(0, 0, 20, 0));
   assertTrue(model.moveElement(40, 0, 80, 0));
   assertTrue(model.moveElement(0, 40, 0, 80));
   assertTrue(model.moveElement(0, 0, 0, 40));
   assertTrue(model.moveElement(60, 0, 10, 10));
 }