-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #308 from alyssaruth/party-mode-leaderboard
Simplify leaderboard for party mode
- Loading branch information
Showing
9 changed files
with
124 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/main/kotlin/dartzee/screen/stats/overall/SimplifiedLeaderboardScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package dartzee.screen.stats.overall | ||
|
||
import dartzee.game.GameType | ||
import dartzee.game.X01_PARTY_CONFIG | ||
import dartzee.screen.EmbeddedScreen | ||
import java.awt.BorderLayout | ||
|
||
class SimplifiedLeaderboardScreen : EmbeddedScreen() { | ||
private val tab = LeaderboardTotalScore(GameType.X01, X01_PARTY_CONFIG.toJson()) | ||
|
||
init { | ||
add(tab, BorderLayout.CENTER) | ||
} | ||
|
||
override fun getScreenName() = "Leaderboard" | ||
|
||
override fun initialise() { | ||
tab.buildTable() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/test/kotlin/dartzee/screen/stats/overall/TestSimplifiedLeaderboardScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package dartzee.screen.stats.overall | ||
|
||
import com.github.alyssaburlton.swingtest.findAll | ||
import com.github.alyssaburlton.swingtest.getChild | ||
import dartzee.core.bean.ScrollTable | ||
import dartzee.game.GameType | ||
import dartzee.game.X01_PARTY_CONFIG | ||
import dartzee.helper.AbstractTest | ||
import dartzee.helper.insertFinishedParticipant | ||
import dartzee.only | ||
import io.kotest.matchers.shouldBe | ||
import io.kotest.matchers.types.shouldBeInstanceOf | ||
import org.junit.jupiter.api.Test | ||
|
||
class TestSimplifiedLeaderboardScreen : AbstractTest() { | ||
@Test | ||
fun `Should show just one leaderboard of the right type`() { | ||
val leaderboard = SimplifiedLeaderboardScreen().findAll<AbstractLeaderboard>().only() | ||
leaderboard.shouldBeInstanceOf<LeaderboardTotalScore>() | ||
} | ||
|
||
@Test | ||
fun `Should populate the leaderboard`() { | ||
insertFinishedParticipant("Stuart", GameType.X01, 34, X01_PARTY_CONFIG.toJson()) | ||
|
||
val scrn = SimplifiedLeaderboardScreen() | ||
scrn.initialise() | ||
|
||
val leaderboard = scrn.getChild<LeaderboardTotalScore>() | ||
leaderboard.getChild<ScrollTable>().rowCount shouldBe 1 | ||
} | ||
} |