Skip to content

Commit ea242c9

Browse files
committed
Ensure the platform is initialized to avoid NPEs
- Soem internals of JavaFX seem to have changed, ensuing that, at least on Mac OS, there is a NPE the first time CodeAre tries to animate it's text. Forcing this initialization prevents that.
1 parent 81d1e59 commit ea242c9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/test/kotlin/net/sourceforge/pmd/util/fxdesigner/util/codearea/CoordinateMappingTest.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import io.kotest.matchers.shouldBe
99
import io.kotest.assertions.throwables.shouldThrow
1010
import net.sourceforge.pmd.util.fxdesigner.util.codearea.PmdCoordinatesSystem.*
1111
import org.fxmisc.richtext.CodeArea
12+
import javafx.application.Platform
1213

1314
class CoordinateMappingTest : FunSpec({
1415

@@ -18,6 +19,11 @@ class CoordinateMappingTest : FunSpec({
1819
fun CodeArea.fromPmd(line: Int, column: Int): Int =
1920
getOffsetFromPmdPosition(this, line, column)
2021

22+
beforeSpec() {
23+
// Ensure the platform is initialized to avoid NPEs
24+
Platform.startup({ });
25+
}
26+
2127
test("Map normal text") {
2228

2329
val codeArea = CodeArea("fof foo")

0 commit comments

Comments
 (0)