Package com.sirenian.hellbound.domain

Examples of com.sirenian.hellbound.domain.Segments


  }
 
  public void shouldAbsorbSegmentsFromOtherGlyphsAndKillThem() {
    Mock glyphListener = mock(GlyphListener.class);
        LivingGlyph glyph = new LivingGlyph(GlyphType.O, CollisionDetector.NULL, 4);
        Segments originalSegments = glyph.getSegments();

    Junk junk = new Junk(9, 13);
        glyphListener.expects("reportGlyphMovement").with(new Matcher[] {eq(GlyphType.JUNK), eq(Segments.EMPTY), eq(Segments.EMPTY)});
    glyphListener.expects("reportGlyphMovement").with(new Matcher[] {eq(GlyphType.JUNK), eq(Segments.EMPTY), eq(originalSegments)});
View Full Code Here


   
    public void shouldRemoveCompletedLinesWhenAbsorbingOtherGlyphsThenMoveAnySegmentsAboveLineDown() {
        Junk junk = new Junk(4, 13);
       
        LivingGlyph glyphToCheckThatOnlyWholeLinesAreRemoved = new LivingGlyph(GlyphType.T, CollisionDetector.NULL, 2);
        Segments expectedSegments = glyphToCheckThatOnlyWholeLinesAreRemoved.getSegments();
       
        LivingGlyph glyphForWholeLine = new LivingGlyph(GlyphType.I, new CollisionDetector(){
            public boolean collides(Segments segments) {
                return false;
            }}, 1);
       
        glyphForWholeLine.requestRotateLeft(); // now takes up whole row for width 4

        glyphForWholeLine.requestMoveDown();
        glyphForWholeLine.requestMoveDown();
        glyphForWholeLine.requestMoveDown();
        glyphForWholeLine.requestMoveDown(); // get it out of the way of the T
       
        junk.absorb(glyphToCheckThatOnlyWholeLinesAreRemoved);
        junk.absorb(glyphForWholeLine);
       
        ensureThat(junk.getSegments(), eq(expectedSegments.movedDown())); // absorbs whole row
       
        verifyMocks();
    }
View Full Code Here


public class GlyphBehaviour extends UsingMiniMock {
 
    public void shouldExposeSegments() {
        Segments segments = new Glyph(GlyphType.O, GlyphType.O.getSegments(0)).getSegments();
        ensureThat(segments, eq(GlyphType.O.getSegments(0)));
    }
View Full Code Here

        ensureThat(segments, eq(GlyphType.O.getSegments(0)));
    }
   
  public void shouldNotifyListenersOfMovement() throws Exception {
     
    Segments segments1 = new Segments(new Segment[] {new Segment(0, 0)});
    Segments segments2 = new Segments(new Segment[] {new Segment(0, 1)});
   
    Glyph glyph = new Glyph(GlyphType.O, GlyphType.O.getSegments(0));
   
    Mock listener1 = mock(GlyphListener.class);
    Mock listener2 = mock(GlyphListener.class);
View Full Code Here

 

  public void shouldConfirmIfAnySegmentsOverlapWithGivenSegments() {
    Glyph glyph = new Glyph(GlyphType.O, GlyphType.O.getSegments(0));
   
    ensureThat(!glyph.overlaps(new Segments(new Segment[]{new Segment(-1, -1)})));
    ensureThat(glyph.overlaps(GlyphType.T.getSegments(0)));
  }
View Full Code Here

  private LivingGlyph glyph;

  private void setUp() {
    listener = new VerifiableGlyphListener();
   
    CollisionDetector detector = new StubCollisionDetector(new Segments(
        new Segment(3, 5),
        new Segment(4, 5),
        new Segment(5, 5),
        new Segment(6, 5)
    ));
View Full Code Here

 

  public void shouldDropUntilInCollision() {
    setUp();

    Segments firstSegments = listener.toLastSegments();
   
    glyph.drop();
   
    Segments secondSegments = listener.toLastSegments();
    Segments expectedSegments = firstSegments.movedDown().movedDown().movedDown();
    ensureThat(secondSegments, eq(expectedSegments));
  }
View Full Code Here

        detector,
        4);
   
    glyph.addListener(listener);
   
    Segments firstSegments = listener.toLastSegments();
   
    ensureThat(!glyph.requestMoveDown());
        ensureThat(!glyph.requestMoveRight());
        ensureThat(!glyph.requestMoveLeft());
        ensureThat(!glyph.requestRotateLeft());
        ensureThat(!glyph.requestRotateRight());
   
    Segments secondSegments = listener.toLastSegments();
   
    ensureThat(firstSegments, eq(secondSegments));
  }
View Full Code Here

        glyph = new LivingGlyph(
                GlyphType.O,
                detector,
                4);
       
        Segments latestSegments = glyph.getSegments();
       
        ensureThat(glyph.requestMoveDown());       
        ensureThat(glyph.getSegments(), eq(latestSegments.movedDown()));
        latestSegments = latestSegments.movedDown();

        ensureThat(glyph.requestMoveRight());
        ensureThat(glyph.getSegments(), eq(latestSegments.movedRight()));
        latestSegments = latestSegments.movedRight();

        ensureThat(glyph.requestMoveLeft());
        ensureThat(glyph.getSegments(), eq(latestSegments.movedLeft()));
       
        glyph = new LivingGlyph(
                GlyphType.O,
                detector,
                4);
View Full Code Here

        ensureThat(glyph.getSegments(), eq(GlyphType.O.getSegments(0).movedRight(4)));
    }
   
    public void shouldReduceSegmentsToEmptyIfKilled() {
        setUp();
        Segments originalSegments = glyph.getSegments();
       
        glyph.kill();
       
        ensureThat(glyph.getSegments(), eq(Segments.EMPTY));
        ensureThat(listener.fromLastSegments(), eq(originalSegments));
View Full Code Here

TOP

Related Classes of com.sirenian.hellbound.domain.Segments

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.