Skip to content

Commit

Permalink
Call Library.load() before calling native getCurrentSystemTheme fun…
Browse files Browse the repository at this point in the history
…ction. (#866)
  • Loading branch information
m-sasha committed Feb 7, 2024
1 parent 585f2dd commit a95eb8c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
11 changes: 7 additions & 4 deletions skiko/src/awtMain/kotlin/org/jetbrains/skiko/SystemTheme.awt.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package org.jetbrains.skiko

actual val currentSystemTheme: SystemTheme
get() = when (getCurrentSystemTheme()) {
0 -> SystemTheme.LIGHT
1 -> SystemTheme.DARK
else -> SystemTheme.UNKNOWN
get() {
Library.load()
return when (getCurrentSystemTheme()) {
0 -> SystemTheme.LIGHT
1 -> SystemTheme.DARK
else -> SystemTheme.UNKNOWN
}
}

// Common
Expand Down
13 changes: 13 additions & 0 deletions skiko/src/awtTest/kotlin/org/jetbrains/skiko/LibraryLoadedTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.jetbrains.skiko

import org.junit.Test

/**
* Verifies that the native Skiko library is correctly loaded in various scenarios.
*/
class LibraryLoadedTest {
@Test
fun getSystemTheme() {
currentSystemTheme
}
}

0 comments on commit a95eb8c

Please sign in to comment.