- Revision
- 648
- Author
- sirenian
- Date
- 2007-01-03 05:12:18 -0600 (Wed, 03 Jan 2007)
Log Message
[EK] New Story: The Player Loses the Game
Added Paths
- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/TheGameShouldBeOver.java
- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/TheGlyphShouldBecomeJunkAndTheNextGlyphShouldAppearOverlappingIt.java
- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/TheJunkIsAlmostToTheTop.java
- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/ThereIsNoSpaceForTheNextGlyph.java
- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/stories/ThePlayerLosesTheGame.java
Removed Paths
Diff
Deleted: trunk/examples/hellbound/src/stories/com/sirenian/hellbound/outcomes/TheGlyphSegmentsShouldBecomeJunk.java (647 => 648)
--- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/outcomes/TheGlyphSegmentsShouldBecomeJunk.java 2007-01-03 10:49:47 UTC (rev 647) +++ trunk/examples/hellbound/src/stories/com/sirenian/hellbound/outcomes/TheGlyphSegmentsShouldBecomeJunk.java 2007-01-03 11:12:18 UTC (rev 648) @@ -1,29 +0,0 @@ -package com.sirenian.hellbound.outcomes; - -import java.awt.Color; - -import org.jbehave.core.Ensure; -import org.jbehave.core.story.domain.World; - -import com.sirenian.hellbound.Hellbound; -import com.sirenian.hellbound.domain.Segment; -import com.sirenian.hellbound.domain.Segments; -import com.sirenian.hellbound.domain.glyph.GlyphType; -import com.sirenian.hellbound.gui.RenderedPit; - - -public class TheGlyphSegmentsShouldBecomeJunk extends HellboundOutcome { - public void verifyAnyTimeIn(World world) { - Segments expectedSegments = new Segments( - new Segment(2, 11), - new Segment(3, 11), - new Segment(4, 11), - new Segment(3, 12) - ); - Color expectedColor = Hellbound.COLORMAP.getColorFor(GlyphType.JUNK); - - RenderedPit pit = getPit(world); - Ensure.that(pit, contains(expectedSegments, expectedColor)); - } - -}
Deleted: trunk/examples/hellbound/src/stories/com/sirenian/hellbound/outcomes/TheNextGlyphShouldAppear.java (647 => 648)
--- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/outcomes/TheNextGlyphShouldAppear.java 2007-01-03 10:49:47 UTC (rev 647) +++ trunk/examples/hellbound/src/stories/com/sirenian/hellbound/outcomes/TheNextGlyphShouldAppear.java 2007-01-03 11:12:18 UTC (rev 648) @@ -1,9 +0,0 @@ -package com.sirenian.hellbound.outcomes; - -import org.jbehave.core.story.domain.World; - - -public class TheNextGlyphShouldAppear extends HellboundOutcome { - public void verifyAnyTimeIn(World world) { - } -}
Added: trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/TheGameShouldBeOver.java (0 => 648)
--- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/TheGameShouldBeOver.java (rev 0) +++ trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/TheGameShouldBeOver.java 2007-01-03 11:12:18 UTC (rev 648) @@ -0,0 +1,26 @@ +package com.sirenian.hellbound.scenarios; + +import javax.swing.JLabel; + +import org.jbehave.core.Ensure; +import org.jbehave.core.story.domain.World; +import org.jbehave.threaded.swing.WindowWrapper; + +import com.sirenian.hellbound.gui.ComponentNames; +import com.sirenian.hellbound.outcomes.HellboundOutcome; +import com.sirenian.hellbound.stories.WorldKey; + +public class TheGameShouldBeOver extends HellboundOutcome { + + protected void verifyAnyTimeIn(World world) { + WindowWrapper windowWrapper = (WindowWrapper) world.get(WorldKey.WINDOW_WRAPPER); + JLabel messageLabel = null; + try { + messageLabel = (JLabel) windowWrapper.findComponent(ComponentNames.GAME_MESSAGE); + } catch (Exception e) { + throw new RuntimeException(e); + } + Ensure.that(messageLabel.getText(), eq("Game over, man! Game over!")); + } + +}
Added: trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/TheGlyphShouldBecomeJunkAndTheNextGlyphShouldAppearOverlappingIt.java (0 => 648)
--- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/TheGlyphShouldBecomeJunkAndTheNextGlyphShouldAppearOverlappingIt.java (rev 0) +++ trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/TheGlyphShouldBecomeJunkAndTheNextGlyphShouldAppearOverlappingIt.java 2007-01-03 11:12:18 UTC (rev 648) @@ -0,0 +1,11 @@ +package com.sirenian.hellbound.scenarios; + +import com.sirenian.hellbound.outcomes.ThePitShouldLookLike; + +public class TheGlyphShouldBecomeJunkAndTheNextGlyphShouldAppearOverlappingIt + extends ThePitShouldLookLike { + + public TheGlyphShouldBecomeJunkAndTheNextGlyphShouldAppearOverlappingIt(String asciiRepresentation) { + super(asciiRepresentation); + } +}
Added: trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/TheJunkIsAlmostToTheTop.java (0 => 648)
--- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/TheJunkIsAlmostToTheTop.java (rev 0) +++ trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/TheJunkIsAlmostToTheTop.java 2007-01-03 11:12:18 UTC (rev 648) @@ -0,0 +1,35 @@ +package com.sirenian.hellbound.scenarios; + +import com.sirenian.hellbound.events.ThePlayerPressesTheDropKey; +import com.sirenian.hellbound.events.TimePasses; +import com.sirenian.hellbound.outcomes.ThePitShouldLookLike; + +public class TheJunkIsAlmostToTheTop extends HellboundScenario { + + protected void specifySteps() { + given(new TheFirstGlyphIsDisplayedOnTheBoard()); + when(new ThePlayerPressesTheDropKey()); + when(new TimePasses()); + when(new ThePlayerPressesTheDropKey()); + when(new TimePasses()); + when(new ThePlayerPressesTheDropKey()); + when(new TimePasses()); + when(new ThePlayerPressesTheDropKey()); + when(new TimePasses()); + then(new ThePitShouldLookLike( // sanity check + "..ZZ..." + NL + + "...ZZ.." + NL + + "......." + NL + + "......." + NL + + "...X..." + NL + + "...X..." + NL + + "..XX..." + NL + + "...XX.." + NL + + "..XX..." + NL + + "..XX..." + NL + + "...XX.." + NL + + "..XXX.." + NL + + "...X..." + NL)); + } + +}
Added: trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/ThereIsNoSpaceForTheNextGlyph.java (0 => 648)
--- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/ThereIsNoSpaceForTheNextGlyph.java (rev 0) +++ trunk/examples/hellbound/src/stories/com/sirenian/hellbound/scenarios/ThereIsNoSpaceForTheNextGlyph.java 2007-01-03 11:12:18 UTC (rev 648) @@ -0,0 +1,29 @@ +package com.sirenian.hellbound.scenarios; + +import com.sirenian.hellbound.events.ThePlayerPressesTheDropKey; +import com.sirenian.hellbound.events.TimePasses; + +public class ThereIsNoSpaceForTheNextGlyph extends HellboundScenario { + + protected void specifySteps() { + given(new TheJunkIsAlmostToTheTop()); + when(new ThePlayerPressesTheDropKey()); + when(new TimePasses()); + then(new TheGlyphShouldBecomeJunkAndTheNextGlyphShouldAppearOverlappingIt( + "..L...." + NL + + "..L...." + NL + + "..LL..." + NL + + "...XX.." + NL + + "...X..." + NL + + "...X..." + NL + + "..XX..." + NL + + "...XX.." + NL + + "..XX..." + NL + + "..XX..." + NL + + "...XX.." + NL + + "..XXX.." + NL + + "...X..." + NL)); + then(new TheGameShouldBeOver()); + } + +}
Added: trunk/examples/hellbound/src/stories/com/sirenian/hellbound/stories/ThePlayerLosesTheGame.java (0 => 648)
--- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/stories/ThePlayerLosesTheGame.java (rev 0) +++ trunk/examples/hellbound/src/stories/com/sirenian/hellbound/stories/ThePlayerLosesTheGame.java 2007-01-03 11:12:18 UTC (rev 648) @@ -0,0 +1,16 @@ +package com.sirenian.hellbound.stories; + +import org.jbehave.core.story.domain.Narrative; + +import com.sirenian.hellbound.scenarios.ThereIsNoSpaceForTheNextGlyph; + +public class ThePlayerLosesTheGame extends HellboundStory{ + + public ThePlayerLosesTheGame() { + super(new Narrative("game player", "to lose the game", "the game is a challenge")); + } + + public void specify() { + addScenario(new ThereIsNoSpaceForTheNextGlyph()); + } +}
To unsubscribe from this list please visit:
