Skip to content

Commit b72cff3

Browse files
committed
fixes
1 parent 60b1252 commit b72cff3

3 files changed

Lines changed: 27 additions & 20 deletions

File tree

src/test/kotlin/dartzee/screen/reporting/TestReportingGameTab.kt renamed to src/test/kotlin/dartzee/screen/reporting/ReportingGameTabTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import javax.swing.JLabel
3030
import javax.swing.JRadioButton
3131
import org.junit.jupiter.api.Test
3232

33-
class TestReportingGameTab : AbstractTest() {
33+
class ReportingGameTabTest : AbstractTest() {
3434
@Test
3535
fun `Should have the correct initial state`() {
3636
val scrn = ReportingGameTab()
@@ -228,7 +228,7 @@ class TestReportingGameTab : AbstractTest() {
228228
tab.getStartDateFilterPanel().cbDateTo.date = endDate
229229
tab.generateReportParameters().dtStartFrom shouldBe
230230
Timestamp.valueOf(startDate.atTime(0, 0))
231-
tab.generateReportParameters().dtStartTo shouldBe Timestamp.valueOf(endDate.atTime(0, 0))
231+
tab.generateReportParameters().dtStartTo shouldBe Timestamp.valueOf(endDate.atTime(23, 59))
232232
}
233233

234234
@Test
@@ -247,7 +247,7 @@ class TestReportingGameTab : AbstractTest() {
247247
tab.getFinishDateFilterPanel().cbDateTo.date = endDate
248248
val rpBetweenDates = tab.generateReportParameters()
249249
rpBetweenDates.dtFinishFrom shouldBe Timestamp.valueOf(startDate.atTime(0, 0))
250-
rpBetweenDates.dtFinishTo shouldBe Timestamp.valueOf(endDate.atTime(0, 0))
250+
rpBetweenDates.dtFinishTo shouldBe Timestamp.valueOf(endDate.atTime(23, 59))
251251
rpBetweenDates.unfinishedOnly shouldBe false
252252

253253
tab.clickChild<JRadioButton>(text = "Unfinished")

‎src/test/kotlin/dartzee/theme/ThemePanelTest.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ThemePanelTest : AbstractTest() {
4141
panel.background shouldBe Themes.HALLOWEEN.background
4242

4343
panel.nameLabel().text shouldBe "5. Halloween"
44-
panel.nameLabel().font shouldBe Themes.HALLOWEEN.font!!.deriveFont(34f)
44+
panel.nameLabel().font shouldBe Themes.HALLOWEEN.font!!.deriveFont(30f)
4545
panel.nameLabel().foreground shouldBe Themes.HALLOWEEN.fontColor
4646

4747
panel.descriptionLabel().text shouldContain Themes.HALLOWEEN.description
@@ -57,7 +57,7 @@ class ThemePanelTest : AbstractTest() {
5757
panel.background shouldBe null
5858

5959
panel.nameLabel().text shouldBe "1. Classic (none)"
60-
panel.nameLabel().font shouldBe ResourceCache.BASE_FONT.deriveFont(34f)
60+
panel.nameLabel().font shouldBe ResourceCache.BASE_FONT.deriveFont(30f)
6161
panel.nameLabel().foreground shouldBe Color.BLACK
6262

6363
panel.descriptionLabel().text shouldBe CLASSIC_THEME_DESC

‎src/test/kotlin/dartzee/theme/ThemeUtilsTest.kt‎

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ import dartzee.helper.insertPlayer
66
import dartzee.logging.CODE_AUDIO_ERROR
77
import dartzee.logging.Severity
88
import dartzee.preferences.Preferences
9+
import dartzee.screen.animation.IAnimation
10+
import dartzee.screen.animation.IAnimationTrigger
911
import dartzee.utils.InjectedThings
1012
import dartzee.utils.InjectedThings.preferenceService
1113
import dartzee.utils.ResourceCache
14+
import io.kotest.assertions.withClue
1215
import io.kotest.matchers.shouldBe
16+
import io.kotest.matchers.shouldNotBe
1317
import io.mockk.every
1418
import io.mockk.mockk
1519
import io.mockk.mockkStatic
@@ -21,7 +25,6 @@ import java.time.Month
2125
import javax.sound.sampled.AudioInputStream
2226
import javax.sound.sampled.AudioSystem
2327
import javax.swing.ImageIcon
24-
import org.junit.jupiter.api.Assertions.fail
2528
import org.junit.jupiter.api.Test
2629

2730
class ThemeUtilsTest : AbstractTest() {
@@ -59,24 +62,28 @@ class ThemeUtilsTest : AbstractTest() {
5962
@Test
6063
fun `all referenced animation resources should exist`() {
6164
themeMap().values.forEach { theme ->
62-
theme.animations.forEach { (trigger, animation) ->
63-
animation.getAllSounds().forEach { sound ->
64-
val result = javaClass.getResource("/wav/$sound.wav")
65-
if (result == null) {
66-
fail("Wav $sound not found for trigger $trigger and theme ${theme.name}")
67-
}
68-
}
69-
70-
animation.getAllImages().forEach { img ->
71-
val result = javaClass.getResource(img)
72-
if (result == null) {
73-
fail("Image $img not found for trigger $trigger and theme ${theme.name}")
74-
}
75-
}
65+
withClue("All assets should exist for ${theme.name}") {
66+
theme.animations.forEach(::assertAllAssetsExistForAnimations)
7667
}
7768
}
7869
}
7970

71+
private fun assertAllAssetsExistForAnimations(
72+
animationEntry: Map.Entry<IAnimationTrigger, IAnimation>
73+
) {
74+
val (trigger, animation) = animationEntry
75+
76+
animation.getAllSounds().forEach { sound ->
77+
val result = javaClass.getResource("/wav/$sound.wav")
78+
withClue("Wav $sound should exist for trigger $trigger") { result shouldNotBe null }
79+
}
80+
81+
animation.getAllImages().forEach { img ->
82+
val result = javaClass.getResource(img)
83+
withClue("Image $img should exist for trigger $trigger") { result shouldNotBe null }
84+
}
85+
}
86+
8087
@Test
8188
fun `themedIcon should return default icon if theme path not found (no override exists)`() {
8289
InjectedThings.now = LocalDate.of(2027, Month.JANUARY, 1)

0 commit comments

Comments
 (0)