예제 #1
0
 @Test
 public void addFlipperTest() {
   model.addFlipper(0, 0, true, "flipper");
   assertTrue(model.getFlippers().size() == 1);
   model.addFlipper(0, 0, true, "flipper");
   assertTrue(model.getFlippers().size() == 1);
   model.addFlipper(60, 0, true, "flipper");
   assertTrue(model.getFlippers().size() == 2);
 }
예제 #2
0
 @Test
 public void rotateElementTest() {
   assertFalse(model.rotateElement(0, 0));
   model.addTriangularBumper(0, 40, 0, "tBump");
   model.addFlipper(0, 0, true, "flipper");
   assertTrue(model.rotateElement(0, 40));
   assertTrue(model.getBumper("tBump").getRotation() == 1);
   assertTrue(model.rotateElement(0, 0));
 }
예제 #3
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");
 }
예제 #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));
 }
예제 #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);
 }
예제 #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));
 }