Ejemplo n.º 1
0
 @Test
 public void addBumpersTest() {
   model.addSquareBumper(0, 0, 0, "sBump");
   model.addCircularBumper(0, 20, 0, "cBump");
   model.addTriangularBumper(0, 40, 0, "tBump");
   assertFalse(model.getBumper("sBump") == null);
   assertTrue(model.getBumper("") == null);
   assertTrue(model.getBumper("sBump") instanceof SquareBumper);
   assertTrue(model.getBumper("cBump") instanceof CircularBumper);
   assertTrue(model.getBumper("tBump") instanceof TriangularBumper);
   model.addSquareBumper(0, 0, 0, "sBump");
   model.addCircularBumper(0, 20, 0, "cBump");
   model.addTriangularBumper(0, 40, 0, "tBump");
   assertTrue(model.getBumpers().size() == 3);
 }
Ejemplo 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");
 }
Ejemplo n.º 3
0
 @Test
 public void clearTest() {
   model.addSquareBumper(0, 0, 0, "sBump");
   model.addCircularBumper(0, 20, 0, "cBump");
   model.addTriangularBumper(0, 40, 0, "tBump");
   model.clear();
   assertTrue(model.getBumper("sBump") == null);
   assertTrue(model.getBumper("cBump") == null);
   assertTrue(model.getBumper("tBump") == null);
   assertTrue(model.getBumpers().size() == 0);
 }
Ejemplo n.º 4
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));
 }
Ejemplo n.º 5
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);
 }
Ejemplo n.º 6
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));
 }