[jewel] JEWEL-751 Add Explicit API mode to JPS build

Enables Kotlin's Explicit API mode for the Jewel JPS builds
(excluding the samples and the ui-test modules), to align
with the settings in the Gradle build.

closes https://github.com/JetBrains/intellij-community/pull/2926

(cherry picked from commit e61a16c1e90e8ed1958d0b5b474383098c0127cb)


(cherry picked from commit 88d9c89f5a1b4fe6a244ddccc991969be976d068)

IJ-MR-155570

GitOrigin-RevId: 3976e54cd7413426347b6480f7ba6d4c080c7e62
This commit is contained in:
Ivan Morgillo
2025-01-16 16:03:28 +01:00
committed by intellij-monorepo-bot
parent e00dcb4794
commit f51f3c30d8
29 changed files with 832 additions and 827 deletions

View File

@@ -40,6 +40,7 @@ ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled
ktlint_standard_try-catch-finally-spacing = disabled
ktlint_standard_wrapping = disabled
trim_trailing_whitespace = false
[gradlew.bat]
end_of_line = crlf

View File

@@ -4,7 +4,7 @@
<facet type="kotlin-language" name="Kotlin">
<configuration version="5" platform="JVM 17" allPlatforms="JVM [17]" useProjectSettings="false">
<compilerSettings>
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions" />
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions -Xexplicit-api=strict" />
</compilerSettings>
<compilerArguments>
<stringArguments>

View File

@@ -4,7 +4,7 @@
<facet type="kotlin-language" name="Kotlin">
<configuration version="5" platform="JVM 17" allPlatforms="JVM [17]" useProjectSettings="false">
<compilerSettings>
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions" />
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions -Xexplicit-api=strict" />
</compilerSettings>
<compilerArguments>
<stringArguments>

View File

@@ -8,6 +8,7 @@ import androidx.compose.ui.focus.FocusManager
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.test.assertIsFocused
import androidx.compose.ui.test.junit4.ComposeContentTestRule
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import kotlinx.coroutines.runBlocking
@@ -17,11 +18,12 @@ import org.junit.Assert.assertNull
import org.junit.Rule
import org.junit.Test
class ProvideDataTest {
@JvmField @Rule val rule = createComposeRule()
public class ProvideDataTest {
@JvmField @Rule
public val rule: ComposeContentTestRule = createComposeRule()
@Test
fun `one component`() {
public fun `one component`() {
runBlocking {
val sink = TestDataSink()
val rootDataProviderModifier = RootDataProviderModifier()
@@ -46,7 +48,7 @@ class ProvideDataTest {
}
@Test
fun `component hierarchy`() {
public fun `component hierarchy`() {
runBlocking {
val rootDataProviderModifier = RootDataProviderModifier()
var focusManager: FocusManager? = null

View File

@@ -4,7 +4,7 @@
<facet type="kotlin-language" name="Kotlin">
<configuration version="5" platform="JVM 17" allPlatforms="JVM [17]" useProjectSettings="false">
<compilerSettings>
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions" />
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions -Xexplicit-api=strict" />
</compilerSettings>
<compilerArguments>
<stringArguments>

View File

@@ -4,7 +4,7 @@
<facet type="kotlin-language" name="Kotlin">
<configuration version="5" platform="JVM 17" allPlatforms="JVM [17]" useProjectSettings="false">
<compilerSettings>
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions" />
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions -Xexplicit-api=strict" />
</compilerSettings>
<compilerArguments>
<stringArguments>

View File

@@ -4,7 +4,7 @@
<facet type="kotlin-language" name="Kotlin">
<configuration version="5" platform="JVM 17" allPlatforms="JVM [17]" useProjectSettings="false">
<compilerSettings>
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions" />
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions -Xexplicit-api=strict" />
</compilerSettings>
<compilerArguments>
<stringArguments>

View File

@@ -4,7 +4,7 @@
<facet type="kotlin-language" name="Kotlin">
<configuration version="5" platform="JVM 17" allPlatforms="JVM [17]" useProjectSettings="false">
<compilerSettings>
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions" />
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions -Xexplicit-api=strict" />
</compilerSettings>
<compilerArguments>
<stringArguments>

View File

@@ -8,11 +8,11 @@ import org.jetbrains.jewel.markdown.MarkdownBlock.Paragraph
import org.jetbrains.jewel.markdown.processing.MarkdownProcessor
import org.junit.Test
class MarkdownProcessorDocumentParsingExtraTest {
public class MarkdownProcessorDocumentParsingExtraTest {
private val processor = MarkdownProcessor()
@Test
fun `should parse spec sample 22b correctly (Backslash escapes)`() {
public fun `should parse spec sample 22b correctly (Backslash escapes)`() {
val parsed = processor.processMarkdownDocument("[](/bar\\* \"ti\\*tle\")")
/*
@@ -23,7 +23,7 @@ class MarkdownProcessorDocumentParsingExtraTest {
}
@Test
fun `should parse spec sample 461b correctly {Emphasis and strong emphasis}`() {
public fun `should parse spec sample 461b correctly {Emphasis and strong emphasis}`() {
val parsed = processor.processMarkdownDocument("*_foo *bar*_*")
/*
@@ -34,7 +34,7 @@ class MarkdownProcessorDocumentParsingExtraTest {
}
@Test
fun `should parse spec sample 461c correctly {Emphasis and strong emphasis}`() {
public fun `should parse spec sample 461c correctly {Emphasis and strong emphasis}`() {
val parsed = processor.processMarkdownDocument("**foo *bar***")
/*
@@ -45,7 +45,7 @@ class MarkdownProcessorDocumentParsingExtraTest {
}
@Test
fun `should parse spec sample 461d correctly {Emphasis and strong emphasis}`() {
public fun `should parse spec sample 461d correctly {Emphasis and strong emphasis}`() {
val parsed = processor.processMarkdownDocument("*_foo *bar* a_*")
/*
@@ -58,7 +58,7 @@ class MarkdownProcessorDocumentParsingExtraTest {
}
@Test
fun `should parse spec sample 461e correctly {Emphasis and strong emphasis}`() {
public fun `should parse spec sample 461e correctly {Emphasis and strong emphasis}`() {
val parsed = processor.processMarkdownDocument("**foo *bar* a**")
/*
@@ -69,7 +69,7 @@ class MarkdownProcessorDocumentParsingExtraTest {
}
@Test
fun `should parse spec sample 461f correctly {Emphasis and strong emphasis}`() {
public fun `should parse spec sample 461f correctly {Emphasis and strong emphasis}`() {
val parsed = processor.processMarkdownDocument("*_*foo *bar* a*_*")
/*

View File

@@ -15,7 +15,7 @@ import org.jetbrains.jewel.markdown.MarkdownBlock.Paragraph
import org.jetbrains.jewel.markdown.MarkdownBlock.ThematicBreak
import org.junit.Assert.assertTrue
fun List<MarkdownBlock>.assertEquals(vararg expected: MarkdownBlock) {
public fun List<MarkdownBlock>.assertEquals(vararg expected: MarkdownBlock) {
val differences = findDifferences(expected.toList(), indentSize = 0)
assertTrue(
"The following differences were found:\n\n" + "${differences.joinToString("\n").replace('\t', '→')}\n\n",
@@ -23,7 +23,7 @@ fun List<MarkdownBlock>.assertEquals(vararg expected: MarkdownBlock) {
)
}
fun List<MarkdownBlock>.findDifferences(expected: List<MarkdownBlock>, indentSize: Int): List<String> = buildList {
public fun List<MarkdownBlock>.findDifferences(expected: List<MarkdownBlock>, indentSize: Int): List<String> = buildList {
val indent = " ".repeat(indentSize)
val thisSize = this@findDifferences.size
if (expected.size != thisSize) {
@@ -166,24 +166,24 @@ private fun diffList(actual: ListBlock, expected: MarkdownBlock, indentSize: Int
}
}
fun paragraph(content: String) = Paragraph(InlineMarkdown.Text(content))
public fun paragraph(content: String): Paragraph = Paragraph(InlineMarkdown.Text(content))
fun heading(level: Int, vararg inlineContent: InlineMarkdown) = Heading(inlineContent = inlineContent, level = level)
public fun heading(level: Int, vararg inlineContent: InlineMarkdown): Heading = Heading(inlineContent = inlineContent, level = level)
fun indentedCodeBlock(content: String) = IndentedCodeBlock(content)
public fun indentedCodeBlock(content: String): IndentedCodeBlock = IndentedCodeBlock(content)
fun fencedCodeBlock(content: String, mimeType: MimeType? = null) = FencedCodeBlock(content, mimeType)
public fun fencedCodeBlock(content: String, mimeType: MimeType? = null): FencedCodeBlock = FencedCodeBlock(content, mimeType)
fun blockQuote(vararg contents: MarkdownBlock) = BlockQuote(contents.toList())
public fun blockQuote(vararg contents: MarkdownBlock): BlockQuote = BlockQuote(contents.toList())
fun unorderedList(vararg items: ListItem, isTight: Boolean = true, marker: String = "-") =
public fun unorderedList(vararg items: ListItem, isTight: Boolean = true, marker: String = "-"): UnorderedList =
UnorderedList(items.toList(), isTight, marker)
fun orderedList(vararg items: ListItem, isTight: Boolean = true, startFrom: Int = 1, delimiter: String = ".") =
public fun orderedList(vararg items: ListItem, isTight: Boolean = true, startFrom: Int = 1, delimiter: String = "."): OrderedList =
OrderedList(items.toList(), isTight, startFrom, delimiter)
fun listItem(vararg items: MarkdownBlock) = ListItem(*items)
public fun listItem(vararg items: MarkdownBlock): ListItem = ListItem(*items)
fun htmlBlock(content: String) = HtmlBlock(content)
public fun htmlBlock(content: String): HtmlBlock = HtmlBlock(content)
fun thematicBreak() = ThematicBreak
public fun thematicBreak(): ThematicBreak = ThematicBreak

View File

@@ -42,11 +42,11 @@ private val rawMarkdown =
@Suppress(
"LargeClass" // Detekt triggers on files > 600 lines
)
class MarkdownProcessorOptimizeEditsTest {
public class MarkdownProcessorOptimizeEditsTest {
private val htmlRenderer = HtmlRenderer.builder().build()
@Test
fun `first blocks stay the same`() {
public fun `first blocks stay the same`() {
val processor = MarkdownProcessor(markdownMode = MarkdownMode.EditorPreview(null))
val firstRun = processor.processWithQuickEdits(rawMarkdown)
val secondRun =
@@ -83,7 +83,7 @@ class MarkdownProcessorOptimizeEditsTest {
}
@Test
fun `first block edited`() {
public fun `first block edited`() {
val processor = MarkdownProcessor(markdownMode = MarkdownMode.EditorPreview(null))
val firstRun = processor.processWithQuickEdits(rawMarkdown)
val secondRun =
@@ -141,7 +141,7 @@ class MarkdownProcessorOptimizeEditsTest {
}
@Test
fun `last block edited`() {
public fun `last block edited`() {
val processor = MarkdownProcessor(markdownMode = MarkdownMode.EditorPreview(null))
val firstRun = processor.processWithQuickEdits(rawMarkdown)
val secondRun =
@@ -202,7 +202,7 @@ class MarkdownProcessorOptimizeEditsTest {
}
@Test
fun `middle block edited`() {
public fun `middle block edited`() {
val processor = MarkdownProcessor(markdownMode = MarkdownMode.EditorPreview(null))
val firstRun = processor.processWithQuickEdits(rawMarkdown)
val secondRun =
@@ -265,7 +265,7 @@ class MarkdownProcessorOptimizeEditsTest {
}
@Test
fun `blocks merged`() {
public fun `blocks merged`() {
val processor = MarkdownProcessor(markdownMode = MarkdownMode.EditorPreview(null))
val firstRun = processor.processWithQuickEdits(rawMarkdown)
val secondRun =
@@ -324,7 +324,7 @@ class MarkdownProcessorOptimizeEditsTest {
}
@Test
fun `blocks split`() {
public fun `blocks split`() {
val processor = MarkdownProcessor(markdownMode = MarkdownMode.EditorPreview(null))
val firstRun = processor.processWithQuickEdits(rawMarkdown)
val secondRun =
@@ -384,7 +384,7 @@ class MarkdownProcessorOptimizeEditsTest {
}
@Test
fun `blocks deleted`() {
public fun `blocks deleted`() {
val processor = MarkdownProcessor(markdownMode = MarkdownMode.EditorPreview(null))
val firstRun = processor.processWithQuickEdits(rawMarkdown)
val secondRun =
@@ -438,7 +438,7 @@ class MarkdownProcessorOptimizeEditsTest {
}
@Test
fun `blocks added`() {
public fun `blocks added`() {
val processor = MarkdownProcessor(markdownMode = MarkdownMode.EditorPreview(null))
val firstRun = processor.processWithQuickEdits(rawMarkdown)
val secondDocument =
@@ -505,7 +505,7 @@ class MarkdownProcessorOptimizeEditsTest {
}
@Test
fun `no changes`() {
public fun `no changes`() {
val processor = MarkdownProcessor(markdownMode = MarkdownMode.EditorPreview(null))
val firstRun = processor.processWithQuickEdits(rawMarkdown)
val secondRun = processor.processWithQuickEdits(rawMarkdown)
@@ -538,7 +538,7 @@ class MarkdownProcessorOptimizeEditsTest {
}
@Test
fun `empty line added`() {
public fun `empty line added`() {
val processor = MarkdownProcessor(markdownMode = MarkdownMode.EditorPreview(null))
val firstRun = processor.processWithQuickEdits(rawMarkdown)
val secondRun = processor.processWithQuickEdits("\n" + rawMarkdown)
@@ -573,7 +573,7 @@ class MarkdownProcessorOptimizeEditsTest {
/** Regression https://github.com/JetBrains/jewel/issues/344 */
@Test
fun `content if empty`() {
public fun `content if empty`() {
val processor = MarkdownProcessor(markdownMode = MarkdownMode.EditorPreview(null))
processor.processWithQuickEdits(rawMarkdown)
val secondRun = processor.processWithQuickEdits("")
@@ -587,7 +587,7 @@ class MarkdownProcessorOptimizeEditsTest {
}
@Test
fun `chained changes`() {
public fun `chained changes`() {
val processor = MarkdownProcessor(markdownMode = MarkdownMode.EditorPreview(null))
processor.processWithQuickEdits(
"""

View File

@@ -62,10 +62,10 @@ import org.junit.Assert.assertTrue
import org.junit.Test
@Suppress("LargeClass")
class ScrollingSynchronizerTest {
public class ScrollingSynchronizerTest {
@OptIn(ExperimentalTestApi::class)
@Test
fun headings() {
public fun headings() {
val markdown =
"""
# Heading 1
@@ -96,7 +96,7 @@ class ScrollingSynchronizerTest {
@OptIn(ExperimentalTestApi::class)
@Test
fun paragraphs() {
public fun paragraphs() {
val markdown =
"""
p1
@@ -128,7 +128,7 @@ class ScrollingSynchronizerTest {
@OptIn(ExperimentalTestApi::class)
@Test
fun `empty spaces`() {
public fun `empty spaces`() {
val markdown =
"""
# Heading 1
@@ -176,7 +176,7 @@ class ScrollingSynchronizerTest {
@OptIn(ExperimentalTestApi::class)
@Test
fun `unordered list`() {
public fun `unordered list`() {
val markdown =
"""
Items:
@@ -210,7 +210,7 @@ class ScrollingSynchronizerTest {
@OptIn(ExperimentalTestApi::class)
@Test
fun `ordered list`() {
public fun `ordered list`() {
val markdown =
"""
Items:
@@ -244,7 +244,7 @@ class ScrollingSynchronizerTest {
@OptIn(ExperimentalTestApi::class)
@Test
fun `fenced code block`() {
public fun `fenced code block`() {
val markdown =
"""
```kotlin
@@ -293,7 +293,7 @@ class ScrollingSynchronizerTest {
@OptIn(ExperimentalTestApi::class)
@Test
fun `indented code block`() {
public fun `indented code block`() {
val markdown =
"""
Here starts the indented code block.
@@ -342,7 +342,7 @@ class ScrollingSynchronizerTest {
@OptIn(ExperimentalTestApi::class)
@Test
fun `add a block`() {
public fun `add a block`() {
val firstRun =
"""
```kotlin
@@ -406,7 +406,7 @@ class ScrollingSynchronizerTest {
@OptIn(ExperimentalTestApi::class)
@Test
fun `remove a block`() {
public fun `remove a block`() {
val firstRun =
"""
**CHANGE**
@@ -470,7 +470,7 @@ class ScrollingSynchronizerTest {
@OptIn(ExperimentalTestApi::class)
@Test
fun `change a block`() {
public fun `change a block`() {
val firstRun =
"""
```kotlin
@@ -538,7 +538,7 @@ class ScrollingSynchronizerTest {
@OptIn(ExperimentalTestApi::class)
@Test
fun `merge code blocks`() {
public fun `merge code blocks`() {
val firstRun =
"""
```kotlin
@@ -890,7 +890,7 @@ class ScrollingSynchronizerTest {
)
}
companion object {
public companion object {
private const val CODE_TEXT_SIZE = 10
}
}

View File

@@ -4,7 +4,7 @@
<facet type="kotlin-language" name="Kotlin">
<configuration version="5" platform="JVM 17" allPlatforms="JVM [17]" useProjectSettings="false">
<compilerSettings>
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions" />
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions -Xexplicit-api=strict" />
</compilerSettings>
<compilerArguments>
<stringArguments>

View File

@@ -6,10 +6,10 @@ import org.jetbrains.jewel.markdown.processing.MarkdownProcessor
import org.junit.Assert.assertTrue
import org.junit.Test
class AutolinkProcessorExtensionTest {
public class AutolinkProcessorExtensionTest {
// testing a simple case to assure wiring up our AutolinkProcessorExtension works correctly
@Test
fun `https text gets processed into a link`() {
public fun `https text gets processed into a link`() {
val processor = MarkdownProcessor(listOf(AutolinkProcessorExtension))
val rawMarkDown = "https://commonmark.org"
val processed = processor.processMarkdownDocument(rawMarkDown)

View File

@@ -4,7 +4,7 @@
<facet type="kotlin-language" name="Kotlin">
<configuration version="5" platform="JVM 17" allPlatforms="JVM [17]" useProjectSettings="false">
<compilerSettings>
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions" />
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions -Xexplicit-api=strict" />
</compilerSettings>
<compilerArguments>
<stringArguments>

View File

@@ -15,17 +15,17 @@ import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
class GitHubAlertBlockExtensionTest {
public class GitHubAlertBlockExtensionTest {
private val parser = Parser.builder().extensions(listOf(GitHubAlertProcessorExtension.parserExtension)).build()
private val renderer =
TextContentRenderer.builder().extensions(listOf(GitHubAlertProcessorExtension.textRendererExtension)).build()
@Test
fun `should parse note alert`() {
public fun `should parse note alert`() {
val rawMarkdown =
"""
|> [!NOTE]
|> [!NOTE]
|> Highlights information that users should take into account, even when skimming.
"""
.trimMargin()
@@ -56,11 +56,11 @@ class GitHubAlertBlockExtensionTest {
}
@Test
fun `should parse tip alert`() {
public fun `should parse tip alert`() {
val parsed =
parser.parse(
"""
|> [!TIP]
|> [!TIP]
|> Optional information to help a user be more successful.
"""
.trimMargin()
@@ -90,11 +90,11 @@ class GitHubAlertBlockExtensionTest {
}
@Test
fun `should parse important alert`() {
public fun `should parse important alert`() {
val parsed =
parser.parse(
"""
|> [!IMPORTANT]
|> [!IMPORTANT]
|> Crucial information necessary for users to succeed.
"""
.trimMargin()
@@ -127,11 +127,11 @@ class GitHubAlertBlockExtensionTest {
}
@Test
fun `should parse warning alert`() {
public fun `should parse warning alert`() {
val parsed =
parser.parse(
"""
|> [!WARNING]
|> [!WARNING]
|> Critical content demanding immediate user attention due to potential risks.
"""
.trimMargin()
@@ -161,11 +161,11 @@ class GitHubAlertBlockExtensionTest {
}
@Test
fun `should parse caution alert`() {
public fun `should parse caution alert`() {
val parsed =
parser.parse(
"""
|> [!CAUTION]
|> [!CAUTION]
|> Negative potential consequences of an action.
"""
.trimMargin()
@@ -195,11 +195,11 @@ class GitHubAlertBlockExtensionTest {
}
@Test
fun `should parse lowercase note alert`() {
public fun `should parse lowercase note alert`() {
val parsed =
parser.parse(
"""
|> [!note]
|> [!note]
|> Highlights information that users should take into account, even when skimming.
"""
.trimMargin()
@@ -229,11 +229,11 @@ class GitHubAlertBlockExtensionTest {
}
@Test
fun `should parse lowercase tip alert`() {
public fun `should parse lowercase tip alert`() {
val parsed =
parser.parse(
"""
|> [!tip]
|> [!tip]
|> Optional information to help a user be more successful.
"""
.trimMargin()
@@ -263,11 +263,11 @@ class GitHubAlertBlockExtensionTest {
}
@Test
fun `should parse lowercase important alert`() {
public fun `should parse lowercase important alert`() {
val parsed =
parser.parse(
"""
|> [!important]
|> [!important]
|> Crucial information necessary for users to succeed.
"""
.trimMargin()
@@ -300,11 +300,11 @@ class GitHubAlertBlockExtensionTest {
}
@Test
fun `should parse lowercase warning alert`() {
public fun `should parse lowercase warning alert`() {
val parsed =
parser.parse(
"""
|> [!warning]
|> [!warning]
|> Critical content demanding immediate user attention due to potential risks.
"""
.trimMargin()
@@ -334,11 +334,11 @@ class GitHubAlertBlockExtensionTest {
}
@Test
fun `should parse lowercase caution alert`() {
public fun `should parse lowercase caution alert`() {
val parsed =
parser.parse(
"""
|> [!caution]
|> [!caution]
|> Negative potential consequences of an action.
"""
.trimMargin()
@@ -368,11 +368,11 @@ class GitHubAlertBlockExtensionTest {
}
@Test
fun `should trim trailing and leading empty lines`() {
public fun `should trim trailing and leading empty lines`() {
val parsed =
parser.parse(
"""
|> [!CAUTION]
|> [!CAUTION]
|>
|> Negative potential consequences of an action.
|>
@@ -404,11 +404,11 @@ class GitHubAlertBlockExtensionTest {
}
@Test
fun `should parse malformed entry as blockquote - space after exclamation mark`() {
public fun `should parse malformed entry as blockquote - space after exclamation mark`() {
val parsed =
parser.parse(
"""
|> [! CAUTION]
|> [! CAUTION]
|> Negative potential consequences of an action.
"""
.trimMargin()
@@ -427,12 +427,12 @@ class GitHubAlertBlockExtensionTest {
}
@Test
fun `should parse malformed entry as blockquote - type not on first line`() {
public fun `should parse malformed entry as blockquote - type not on first line`() {
val parsed =
parser.parse(
"""
|>
|> [! CAUTION]
|> [! CAUTION]
|> Negative potential consequences of an action.
"""
.trimMargin()
@@ -451,11 +451,11 @@ class GitHubAlertBlockExtensionTest {
}
@Test
fun `should parse malformed entry as blockquote - space before exclamation mark`() {
public fun `should parse malformed entry as blockquote - space before exclamation mark`() {
val parsed =
parser.parse(
"""
|> [ !CAUTION]
|> [ !CAUTION]
|> Negative potential consequences of an action.
"""
.trimMargin()
@@ -474,11 +474,11 @@ class GitHubAlertBlockExtensionTest {
}
@Test
fun `should parse malformed entry as blockquote - space after type`() {
public fun `should parse malformed entry as blockquote - space after type`() {
val parsed =
parser.parse(
"""
|> [!CAUTION ]
|> [!CAUTION ]
|> Negative potential consequences of an action.
"""
.trimMargin()
@@ -497,7 +497,7 @@ class GitHubAlertBlockExtensionTest {
}
@Test
fun `should parse malformed entry as blockquote - missing newline`() {
public fun `should parse malformed entry as blockquote - missing newline`() {
val parsed =
parser.parse(
"""

View File

@@ -4,7 +4,7 @@
<facet type="kotlin-language" name="Kotlin">
<configuration version="5" platform="JVM 17" allPlatforms="JVM [17]" useProjectSettings="false">
<compilerSettings>
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions" />
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions -Xexplicit-api=strict" />
</compilerSettings>
<compilerArguments>
<stringArguments>

View File

@@ -56,10 +56,10 @@ public class GfmTableStyling(
override fun toString(): String {
return "GfmTableStyling(" +
"colors=$colors, " +
"metrics=$metrics, " +
"headerBaseFontWeight=$headerBaseFontWeight" +
")"
"colors=$colors, " +
"metrics=$metrics, " +
"headerBaseFontWeight=$headerBaseFontWeight" +
")"
}
public companion object
@@ -96,11 +96,11 @@ public class GfmTableColors(
override fun toString(): String {
return "GfmTableColors(" +
"borderColor=$borderColor, " +
"rowBackgroundColor=$rowBackgroundColor, " +
"alternateRowBackgroundColor=$alternateRowBackgroundColor, " +
"rowBackgroundStyle=$rowBackgroundStyle" +
")"
"borderColor=$borderColor, " +
"rowBackgroundColor=$rowBackgroundColor, " +
"alternateRowBackgroundColor=$alternateRowBackgroundColor, " +
"rowBackgroundStyle=$rowBackgroundStyle" +
")"
}
public companion object
@@ -151,11 +151,11 @@ public class GfmTableMetrics(
override fun toString(): String {
return "GfmTableMetrics(" +
"borderWidth=$borderWidth, " +
"cellPadding=$cellPadding, " +
"defaultCellContentAlignment=$defaultCellContentAlignment, " +
"headerDefaultCellContentAlignment=$headerDefaultCellContentAlignment" +
")"
"borderWidth=$borderWidth, " +
"cellPadding=$cellPadding, " +
"defaultCellContentAlignment=$defaultCellContentAlignment, " +
"headerDefaultCellContentAlignment=$headerDefaultCellContentAlignment" +
")"
}
public companion object

View File

@@ -4,7 +4,7 @@
<facet type="kotlin-language" name="Kotlin">
<configuration version="5" platform="JVM 17" allPlatforms="JVM [17]" useProjectSettings="false">
<compilerSettings>
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions" />
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions -Xexplicit-api=strict" />
</compilerSettings>
<compilerArguments>
<stringArguments>

View File

@@ -4,7 +4,7 @@
<facet type="kotlin-language" name="Kotlin">
<configuration version="5" platform="JVM 17" allPlatforms="JVM [17]" useProjectSettings="false">
<compilerSettings>
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions" />
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions -Xexplicit-api=strict" />
</compilerSettings>
<compilerArguments>
<stringArguments>

View File

@@ -354,6 +354,7 @@ public final class org/jetbrains/jewel/samples/showcase/views/ComposableSingleto
public final class org/jetbrains/jewel/samples/showcase/views/KeyBinding {
public static final field $stable I
public static final field Companion Lorg/jetbrains/jewel/samples/showcase/views/KeyBinding$Companion;
public fun <init> ()V
public fun <init> (Ljava/util/Set;Ljava/util/Set;Ljava/util/Set;)V
public synthetic fun <init> (Ljava/util/Set;Ljava/util/Set;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
@@ -365,8 +366,12 @@ public final class org/jetbrains/jewel/samples/showcase/views/KeyBinding {
public fun toString ()Ljava/lang/String;
}
public final class org/jetbrains/jewel/samples/showcase/views/KeyBinding$Companion {
}
public final class org/jetbrains/jewel/samples/showcase/views/ViewInfo {
public static final field $stable I
public static final field Companion Lorg/jetbrains/jewel/samples/showcase/views/ViewInfo$Companion;
public fun <init> (Ljava/lang/String;Lorg/jetbrains/jewel/ui/icon/IconKey;Lorg/jetbrains/jewel/samples/showcase/views/KeyBinding;Lkotlin/jvm/functions/Function2;)V
public synthetic fun <init> (Ljava/lang/String;Lorg/jetbrains/jewel/ui/icon/IconKey;Lorg/jetbrains/jewel/samples/showcase/views/KeyBinding;Lkotlin/jvm/functions/Function2;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun equals (Ljava/lang/Object;)Z
@@ -378,6 +383,9 @@ public final class org/jetbrains/jewel/samples/showcase/views/ViewInfo {
public fun toString ()Ljava/lang/String;
}
public final class org/jetbrains/jewel/samples/showcase/views/ViewInfo$Companion {
}
public final class org/jetbrains/jewel/samples/showcase/views/ViewInfoKt {
public static final fun forCurrentOs (Lorg/jetbrains/jewel/samples/showcase/views/KeyBinding;)Ljava/util/Set;
}

View File

@@ -4,7 +4,7 @@
<facet type="kotlin-language" name="Kotlin">
<configuration version="5" platform="JVM 17" allPlatforms="JVM [17]" useProjectSettings="false">
<compilerSettings>
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions" />
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=androidx.compose.ui.ExperimentalComposeUiApi -Xcontext-receivers -opt-in=androidx.compose.foundation.ExperimentalFoundationApi -opt-in=org.jetbrains.jewel.foundation.ExperimentalJewelApi -opt-in=org.jetbrains.jewel.foundation.InternalJewelApi -P plugin:poko-compiler-plugin:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions plugin:poko:pokoAnnotation=org/jetbrains/jewel/foundation/GenerateDataFunctions -Xexplicit-api=strict" />
</compilerSettings>
<compilerArguments>
<stringArguments>

View File

@@ -149,7 +149,8 @@ public class ScrollbarMetrics(public val thumbCornerSize: CornerSize, public val
return result
}
override fun toString(): String = "ScrollbarMetrics(thumbCornerSize=$thumbCornerSize, minThumbLength=$minThumbLength)"
override fun toString(): String =
"ScrollbarMetrics(thumbCornerSize=$thumbCornerSize, minThumbLength=$minThumbLength)"
public companion object
}

View File

@@ -99,7 +99,8 @@ public class SplitButtonMetrics(public val dividerMetrics: DividerMetrics, publi
return result
}
override fun toString(): String = "SplitButtonMetrics(dividerMetrics=$dividerMetrics, dividerPadding=$dividerPadding)"
override fun toString(): String =
"SplitButtonMetrics(dividerMetrics=$dividerMetrics, dividerPadding=$dividerPadding)"
public companion object
}

View File

@@ -38,13 +38,8 @@ public class TextFieldStyle(
return result
}
override fun toString(): String {
return "TextFieldStyle(" +
"colors=$colors, " +
"metrics=$metrics, " +
"iconButtonStyle=$iconButtonStyle" +
")"
}
override fun toString(): String =
"TextFieldStyle(colors=$colors, metrics=$metrics, iconButtonStyle=$iconButtonStyle)"
public companion object
}

View File

@@ -27,11 +27,7 @@ private class KeyBasedReplacementPainterSvgPatchHint(val map: Map<String, Color>
override fun hashCode(): Int = map.hashCode()
override fun toString(): String {
return "KeyBasedReplacementPainterSvgPatchHint(" +
"map=$map" +
")"
}
override fun toString(): String = "KeyBasedReplacementPainterSvgPatchHint(map=$map)"
}
private fun Element.patchPalette(replacementColors: Map<String, Color>) {

View File

@@ -6,11 +6,12 @@ import androidx.compose.ui.test.junit4.createComposeRule
import kotlinx.coroutines.runBlocking
import org.junit.Rule
open class BasicJewelUiTest {
@get:Rule val composeRule = createComposeRule()
public open class BasicJewelUiTest {
@get:Rule
public val composeRule: ComposeContentTestRule = createComposeRule()
@Suppress("ImplicitUnitReturnType")
protected fun runComposeTest(composable: @Composable () -> Unit, block: suspend ComposeContentTestRule.() -> Unit) =
protected fun runComposeTest(composable: @Composable () -> Unit, block: suspend ComposeContentTestRule.() -> Unit): Unit =
runBlocking {
composeRule.setContent(composable)
composeRule.block()

View File

@@ -27,9 +27,9 @@ import org.junit.Assert.assertEquals
import org.junit.Test
@Suppress("ImplicitUnitReturnType")
class PainterHintTest : BasicJewelUiTest() {
public class PainterHintTest : BasicJewelUiTest() {
@Test
fun `empty hint should be ignored`() =
public fun `empty hint should be ignored`(): Unit =
runComposeTest({
OverrideDarkMode(isDark = false) {
val provider = rememberResourcePainterProvider("icons/github.svg", PainterHintTest::class.java)
@@ -88,21 +88,21 @@ class PainterHintTest : BasicJewelUiTest() {
TestPainterProviderScope(Density(density), path)
@Test
fun `dark painter hint should append suffix when isDark is true`() {
public fun `dark painter hint should append suffix when isDark is true`() {
val basePath = "icons/github.svg"
val patchedPath = testScope(basePath).applyPathHints(Dark(true))
assertEquals("icons/github_dark.svg", patchedPath)
}
@Test
fun `dark painter hint should not append suffix when isDark is false`() {
public fun `dark painter hint should not append suffix when isDark is false`() {
val basePath = "icons/github.svg"
val patchedPath = testScope(basePath).applyPathHints(Dark(false))
assertEquals(basePath, patchedPath)
}
@Test
fun `override painter hint should replace path entirely`() {
public fun `override painter hint should replace path entirely`() {
val basePath = "icons/github.svg"
val patchedPath =
testScope(basePath).applyPathHints(PathOverride(mapOf("icons/github.svg" to "icons/search.svg")))
@@ -110,7 +110,7 @@ class PainterHintTest : BasicJewelUiTest() {
}
@Test
fun `override painter hint should not replace path when not matched`() {
public fun `override painter hint should not replace path when not matched`() {
val basePath = "icons/github.svg"
val patchedPath =
testScope(basePath).applyPathHints(PathOverride(mapOf("icons/settings.svg" to "icons/search.svg")))
@@ -118,49 +118,49 @@ class PainterHintTest : BasicJewelUiTest() {
}
@Test
fun `selected painter hint should append suffix when selected is true`() {
public fun `selected painter hint should append suffix when selected is true`() {
val basePath = "icons/checkbox.svg"
val patchedPath = testScope(basePath).applyPathHints(Selected(true))
assertEquals("icons/checkboxSelected.svg", patchedPath)
}
@Test
fun `selected painter hint should not append suffix when selected is false`() {
public fun `selected painter hint should not append suffix when selected is false`() {
val basePath = "icons/checkbox.svg"
val patchedPath = testScope(basePath).applyPathHints(Selected(false))
assertEquals(basePath, patchedPath)
}
@Test
fun `size painter hint should append suffix`() {
public fun `size painter hint should append suffix`() {
val basePath = "icons/github.svg"
val patchedPath = testScope(basePath).applyPathHints(Size(20))
assertEquals("icons/github@20x20.svg", patchedPath)
}
@Test
fun `highDpi painter hint should append suffix when isHiDpi is true`() {
public fun `highDpi painter hint should append suffix when isHiDpi is true`() {
val basePath = "icons/github.png"
val patchedPath = testScope(basePath, 2f).applyPathHints(HiDpi())
assertEquals("icons/github@2x.png", patchedPath)
}
@Test
fun `highDpi painter hint should not append suffix when isHiDpi is false`() {
public fun `highDpi painter hint should not append suffix when isHiDpi is false`() {
val basePath = "icons/github.png"
val patchedPath = testScope(basePath, 1f).applyPathHints(HiDpi())
assertEquals(basePath, patchedPath)
}
@Test
fun `size painter hint should not append suffix for bitmap`() {
public fun `size painter hint should not append suffix for bitmap`() {
val basePath = "icons/github.png"
val patchedPath = testScope(basePath).applyPathHints(Size(20))
assertEquals(basePath, patchedPath)
}
@Test
fun `size painter hint should throw with wrong width or height`() {
public fun `size painter hint should throw with wrong width or height`() {
val basePath = "icons/github.svg"
Assert.assertThrows(IllegalArgumentException::class.java) { testScope(basePath).applyPathHints(Size(-1, 20)) }
@@ -169,7 +169,7 @@ class PainterHintTest : BasicJewelUiTest() {
}
@Test
fun `stateful painter hint should append Disabled suffix when enabled is false`() {
public fun `stateful painter hint should append Disabled suffix when enabled is false`() {
val basePath = "icons/checkbox.svg"
val state = CheckboxState.of(toggleableState = ToggleableState.Off)
val patchedPath = testScope(basePath).applyPathHints(Stateful(state.copy(enabled = false)))
@@ -181,7 +181,7 @@ class PainterHintTest : BasicJewelUiTest() {
}
@Test
fun `stateful painter hint disabled state takes higher priority over other states`() {
public fun `stateful painter hint disabled state takes higher priority over other states`() {
val basePath = "icons/checkbox.svg"
val state = CheckboxState.of(toggleableState = ToggleableState.Off)
val patchedPath =
@@ -191,7 +191,7 @@ class PainterHintTest : BasicJewelUiTest() {
}
@Test
fun `stateful painter hint should append Focused suffix when focused is true`() {
public fun `stateful painter hint should append Focused suffix when focused is true`() {
val basePath = "icons/checkbox.svg"
val state = CheckboxState.of(toggleableState = ToggleableState.Off)
val patchedPath = testScope(basePath).applyPathHints(Stateful(state.copy(focused = true)))
@@ -199,7 +199,7 @@ class PainterHintTest : BasicJewelUiTest() {
}
@Test
fun `stateful painter hint focused state takes higher priority over pressed and hovered states`() {
public fun `stateful painter hint focused state takes higher priority over pressed and hovered states`() {
val basePath = "icons/checkbox.svg"
val state = CheckboxState.of(toggleableState = ToggleableState.Off)
val patchedPath =
@@ -208,7 +208,7 @@ class PainterHintTest : BasicJewelUiTest() {
}
@Test
fun `stateful painter hint should append Pressed suffix when pressed is true`() {
public fun `stateful painter hint should append Pressed suffix when pressed is true`() {
val basePath = "icons/checkbox.svg"
val state = CheckboxState.of(toggleableState = ToggleableState.Off)
val patchedPath = testScope(basePath).applyPathHints(Stateful(state.copy(pressed = true)))
@@ -216,7 +216,7 @@ class PainterHintTest : BasicJewelUiTest() {
}
@Test
fun `stateful painter hint pressed state takes higher priority over hovered state`() {
public fun `stateful painter hint pressed state takes higher priority over hovered state`() {
val basePath = "icons/checkbox.svg"
val state = CheckboxState.of(toggleableState = ToggleableState.Off)
val patchedPath = testScope(basePath).applyPathHints(Stateful(state.copy(pressed = true, hovered = true)))
@@ -224,7 +224,7 @@ class PainterHintTest : BasicJewelUiTest() {
}
@Test
fun `stateful painter hint should append Hovered suffix when hovered is true`() {
public fun `stateful painter hint should append Hovered suffix when hovered is true`() {
val basePath = "icons/checkbox.svg"
val state = CheckboxState.of(toggleableState = ToggleableState.Off)
val patchedPath = testScope(basePath).applyPathHints(Stateful(state.copy(hovered = true)))
@@ -232,21 +232,21 @@ class PainterHintTest : BasicJewelUiTest() {
}
@Test
fun `stroke painter hint should append suffix when color is Specified`() {
public fun `stroke painter hint should append suffix when color is Specified`() {
val basePath = "icons/rerun.svg"
val patchedPath = testScope(basePath).applyPathHints(Stroke(Color.White))
assertEquals("icons/rerun_stroke.svg", patchedPath)
}
@Test
fun `stroke painter hint should not append suffix when color is Unspecified`() {
public fun `stroke painter hint should not append suffix when color is Unspecified`() {
val basePath = "icons/rerun.svg"
val patchedPath = testScope(basePath).applyPathHints(Stroke(Color.Unspecified))
assertEquals(basePath, patchedPath)
}
@Test
fun `palette painter hint should patch colors correctly in SVG`() {
public fun `palette painter hint should patch colors correctly in SVG`() {
val baseSvg =
"""
|<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">