Example #1
0
 @Test
 public void setColorTest() {
   List<BlockColor> l = new ArrayList<BlockColor>();
   ZoneModel zm = new ZoneModel();
   zm.setColors(l);
   assertEquals(zm.getColors(), l);
 }
Example #2
0
 @Test
 public void spawnCountStartZoneTest() {
   ZoneModel zm = new ZoneModel();
   zm.setType(Type.CORRIDOR);
   zm.setStartZone(true);
   assertEquals(zm.getSpawnCount(), 4);
 }
Example #3
0
 @Test
 public void BlockColorsCorridorTest() {
   List<BlockColor> l = new ArrayList<BlockColor>();
   l.add(BlockColor.BLUE);
   l.add(BlockColor.BLUE);
   ZoneModel zm = new ZoneModel();
   zm.setType(Type.CORRIDOR);
   zm.setColors(l);
   assertNotEquals(zm.getColors(), l);
 }
Example #4
0
 @Test
 public void BlockColorsRoomTest() {
   List<BlockColor> l = new ArrayList<BlockColor>();
   l.add(BlockColor.BLUE);
   l.add(BlockColor.BLUE);
   ZoneModel zm = new ZoneModel();
   zm.setType(Type.ROOM);
   zm.setColors(l);
   assertEquals(zm.getColors(), l);
 }
Example #5
0
 public void zoneModelChanged(ZoneModelEvent event) {
   if ((!isStuck()) && model.containsPoint(index)) {
     add(unstickButton);
     revalidate();
     repaint();
   } else if (isStuck() && !model.containsPoint(index)) {
     remove(unstickButton);
     revalidate();
     repaint();
   }
 }
Example #6
0
 @Test
 public void calcRowTest() {
   Rectangle r = new Rectangle(100.0, 100.0, 100.0, 100.0);
   Zone z = new Zone();
   z.setBoundingbox(r);
   assertTrue(ZoneModel.calcRow(z) == 9);
 }
Example #7
0
  Spacer(ZoneModel model, int index, SpacerHandle knobHandle) {
    this.model = model;
    this.index = index;
    this.knobHandle = knobHandle;

    knobPainter = new KnobPainter(this);

    setOpaque(false);
    setCursor(SliderCursor);

    initKeyMaps();

    Icon icon = getIcon("unstick");
    Icon pressedIcon = getIcon("unstickPressed");
    Icon highlightIcon = getIcon("unstickHighlight");
    unstickButton = new JButton(icon);
    unstickButton.setSize(icon.getIconWidth(), icon.getIconHeight());
    unstickButton.setPressedIcon(pressedIcon);
    unstickButton.setRolloverEnabled(true);
    unstickButton.setRolloverIcon(highlightIcon);
    unstickButton.setBorder(null);
    unstickButton.putClientProperty(SubstanceLookAndFeel.BUTTON_PAINT_NEVER_PROPERTY, Boolean.TRUE);
    unstickButton.setBorderPainted(false);
    unstickButton.setRolloverEnabled(true);
    unstickButton.setOpaque(false);
    unstickButton.setCursor(ClickCursor);
    unstickButton.setFocusable(false);
    unstickButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            Spacer.this.model.removePoint(Spacer.this.index);
          }
        });
    if (model.containsPoint(index)) {
      add(unstickButton);
    }
    model.addZoneModelListener(this);

    setFocusable(true);
    addFocusListener(this);
    addMouseListener(this);
  }
Example #8
0
 @Test
 public void constructorTestNode() {
   Node n = new Node(Type.ROOM);
   n.setDir(DoorDirection.NORTH);
   ZoneModel zm = new ZoneModel(n);
   assertEquals(zm.getType(), Type.ROOM);
   assertTrue(zm.hasDoor(0));
   n.setDir(DoorDirection.EAST);
   zm = new ZoneModel(n);
   assertTrue(zm.hasDoor(1));
   n.setDir(DoorDirection.SOUTH);
   zm = new ZoneModel(n);
   assertTrue(zm.hasDoor(2));
   n.setDir(DoorDirection.WEST);
   zm = new ZoneModel(n);
   assertTrue(zm.hasDoor(3));
   n.setType(Type.CORRIDOR);
   zm = new ZoneModel(n);
   assertFalse(zm.hasDoor(0));
   assertFalse(zm.hasDoor(1));
   assertFalse(zm.hasDoor(2));
   assertFalse(zm.hasDoor(3));
 }
Example #9
0
 @Test(expected = NullPointerException.class)
 public void setColorNullTest() {
   ZoneModel zm = new ZoneModel();
   zm.setColors(null);
 }
Example #10
0
 @Test
 public void constructorTest() {
   Zone z = new Zone();
   ZoneModel zm = new ZoneModel(z);
   assertEquals(zm.getType(), Type.ROOM);
 }
Example #11
0
 @Test
 public void testGenerateName5() {
   zone = new ZoneModel();
   zone.generateNameFromPosition(100, 702);
   assertEquals(Zone.CORRIDOR_NAME + "AAA101", zone.getName());
 }
Example #12
0
 @Test
 public void testGenerateName4() {
   zone = new ZoneModel();
   zone.generateNameFromPosition(28, 28);
   assertEquals(Zone.CORRIDOR_NAME + "AC29", zone.getName());
 }
Example #13
0
 @Test
 public void testGenerateName2() {
   zone = new ZoneModel();
   zone.generateNameFromPosition(5, 25);
   assertEquals(Zone.CORRIDOR_NAME + "Z6", zone.getName());
 }
Example #14
0
 @Test
 public void getZoneTest() {
   Zone z = new Zone();
   ZoneModel zm = new ZoneModel(z);
   assertEquals(zm.getZone(), z);
 }
Example #15
0
 @Test
 public void spawnCountCorridorTest() {
   ZoneModel zm = new ZoneModel();
   zm.setType(Type.CORRIDOR);
   assertEquals(zm.getSpawnCount(), 0);
 }
Example #16
0
 void updateModel() {
   double value = ComponentScaler.componentToScale(this, SpacerHeight / 2);
   model.setPoint(index, value);
 }