aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/base/base-test-utils/src/main/kotlin/renderers/TestPage.kt28
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt13
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt22
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/GroupWrappingTest.kt8
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt16
-rw-r--r--plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt24
-rw-r--r--plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt8
-rw-r--r--plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt34
-rw-r--r--plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt16
9 files changed, 94 insertions, 75 deletions
diff --git a/plugins/base/base-test-utils/src/main/kotlin/renderers/TestPage.kt b/plugins/base/base-test-utils/src/main/kotlin/renderers/TestPage.kt
index 0dae8ce6..09ea6083 100644
--- a/plugins/base/base-test-utils/src/main/kotlin/renderers/TestPage.kt
+++ b/plugins/base/base-test-utils/src/main/kotlin/renderers/TestPage.kt
@@ -11,16 +11,8 @@ import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder
import org.jetbrains.dokka.base.signatures.KotlinSignatureProvider
import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter
-class TestPage(callback: PageContentBuilder.DocumentableContentBuilder.() -> Unit) : RootPageNode(), ContentPage {
- override val dri: Set<DRI> = setOf(DRI.topLevel)
- override val documentable: Documentable? = null
- override val embeddedResources: List<String> = emptyList()
- override val name: String
- get() = "testPage"
- override val children: List<PageNode>
- get() = emptyList()
-
- override val content: ContentNode = PageContentBuilder(
+fun testPage(callback: PageContentBuilder.DocumentableContentBuilder.() -> Unit): RawTestPage {
+ val content = PageContentBuilder(
EmptyCommentConverter,
KotlinSignatureProvider(EmptyCommentConverter, DokkaConsoleLogger),
DokkaConsoleLogger
@@ -30,15 +22,27 @@ class TestPage(callback: PageContentBuilder.DocumentableContentBuilder.() -> Uni
block = callback
)
+ return RawTestPage(content)
+}
+
+class RawTestPage(
+ override val content: ContentNode,
+ override val name: String = "testPage",
+ override val dri: Set<DRI> = setOf(DRI.topLevel),
+ override val documentable: Documentable? = null,
+ override val embeddedResources: List<String> = emptyList(),
+ override val children: List<PageNode> = emptyList(),
+): RootPageNode(), ContentPage {
override fun modified(
name: String,
content: ContentNode,
dri: Set<DRI>,
embeddedResources: List<String>,
children: List<PageNode>
- ) = this
+ ): ContentPage = this
+
+ override fun modified(name: String, children: List<PageNode>): RootPageNode = this
- override fun modified(name: String, children: List<PageNode>) = this
}
internal object EmptyCommentConverter : CommentsToContentConverter {
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index e10672a6..ddcbc7e9 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -346,15 +346,14 @@ open class HtmlRenderer(
override fun FlowContent.buildResource(
node: ContentEmbeddedResource,
pageContext: ContentPage
- ) { // TODO: extension point there
- return if (node.isImage()) {
+ ) = // TODO: extension point there
+ if (node.isImage()) {
//TODO: add imgAttrs parsing
val imgAttrs = node.extra.allOfType<SimpleAttr>().joinAttr()
img(src = node.address, alt = node.altText)
} else {
println("Unrecognized resource type: $node")
}
- }
private fun FlowContent.buildRow(
node: ContentGroup,
@@ -393,9 +392,9 @@ open class HtmlRenderer(
}
it.filter { it !is ContentLink }.takeIf { it.isNotEmpty() }?.let {
- if(pageContext is ModulePage || pageContext is MultimoduleRootPage){
+ if (pageContext is ModulePage || pageContext is MultimoduleRootPage) {
it.forEach {
- span(classes = if(it.dci.kind == ContentKind.Comment) "brief-comment" else "") {
+ span(classes = if (it.dci.kind == ContentKind.Comment) "brief-comment" else "") {
it.build(this, pageContext, sourceSetRestriction)
}
}
@@ -522,7 +521,7 @@ open class HtmlRenderer(
override fun FlowContent.buildNavigation(page: PageNode) =
div(classes = "breadcrumbs") {
val path = locationProvider.ancestors(page).filterNot { it is RendererSpecificPage }.asReversed()
- if(path.isNotEmpty()){
+ if (path.isNotEmpty()) {
buildNavigationElement(path.first(), page)
path.drop(1).forEach { node ->
text("/")
@@ -691,7 +690,7 @@ open class HtmlRenderer(
div {
id = "logo"
}
- if(page !is MultimoduleRootPage) {
+ if (page !is MultimoduleRootPage) {
div {
id = "paneSearch"
}
diff --git a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt
index b4de5aed..ad0d421e 100644
--- a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt
+++ b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt
@@ -4,7 +4,7 @@ import org.jetbrains.dokka.base.renderers.html.HtmlRenderer
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.pages.ContentDivergentGroup
import org.junit.jupiter.api.Test
-import renderers.TestPage
+import renderers.testPage
import utils.Div
import utils.Span
import utils.match
@@ -13,7 +13,7 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
@Test
fun simpleWrappingCase() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test")) {
instance(setOf(DRI("test", "Test")), setOf(js)) {
divergent {
@@ -28,7 +28,7 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
@Test
fun noPlatformHintCase() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test"), implicitlySourceSetHinted = false) {
instance(setOf(DRI("test", "Test")), setOf(js)) {
divergent {
@@ -43,7 +43,7 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
@Test
fun divergentBetweenSourceSets() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test")) {
instance(setOf(DRI("test", "Test")), setOf(js)) {
divergent {
@@ -69,7 +69,7 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
@Test
fun divergentInOneSourceSet() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test")) {
instance(setOf(DRI("test", "Test")), setOf(js)) {
divergent {
@@ -95,7 +95,7 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
@Test
fun divergentInAndBetweenSourceSets() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test")) {
instance(setOf(DRI("test", "Test")), setOf(native)) {
divergent {
@@ -131,7 +131,7 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
@Test
fun divergentInAndBetweenSourceSetsWithGrouping() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test")) {
instance(setOf(DRI("test", "Test")), setOf(native)) {
divergent {
@@ -184,7 +184,7 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
@Test
fun divergentSameBefore() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test")) {
instance(setOf(DRI("test", "Test")), setOf(native)) {
before {
@@ -219,7 +219,7 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
@Test
fun divergentSameAfter() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test")) {
instance(setOf(DRI("test", "Test")), setOf(native)) {
divergent {
@@ -251,7 +251,7 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
@Test
fun divergentGroupedByBeforeAndAfter() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test")) {
instance(setOf(DRI("test", "Test")), setOf(native)) {
before {
@@ -290,7 +290,7 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
@Test
fun divergentDifferentBeforeAndAfter() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test")) {
instance(setOf(DRI("test", "Test")), setOf(native)) {
before {
diff --git a/plugins/base/src/test/kotlin/renderers/html/GroupWrappingTest.kt b/plugins/base/src/test/kotlin/renderers/html/GroupWrappingTest.kt
index c0c03998..244163ec 100644
--- a/plugins/base/src/test/kotlin/renderers/html/GroupWrappingTest.kt
+++ b/plugins/base/src/test/kotlin/renderers/html/GroupWrappingTest.kt
@@ -12,7 +12,7 @@ class GroupWrappingTest : HtmlRenderingOnlyTestBase() {
@Test
fun notWrapped() {
- val page = TestPage {
+ val page = testPage {
group {
text("a")
text("b")
@@ -27,7 +27,7 @@ class GroupWrappingTest : HtmlRenderingOnlyTestBase() {
@Test
fun paragraphWrapped() {
- val page = TestPage {
+ val page = testPage {
group(styles = setOf(TextStyle.Paragraph)) {
text("a")
text("b")
@@ -42,7 +42,7 @@ class GroupWrappingTest : HtmlRenderingOnlyTestBase() {
@Test
fun blockWrapped() {
- val page = TestPage {
+ val page = testPage {
group(styles = setOf(TextStyle.Block)) {
text("a")
text("b")
@@ -57,7 +57,7 @@ class GroupWrappingTest : HtmlRenderingOnlyTestBase() {
@Test
fun nested() {
- val page = TestPage {
+ val page = testPage {
group(styles = setOf(TextStyle.Block)) {
text("a")
group(styles = setOf(TextStyle.Block)) {
diff --git a/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt b/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt
index 6be3839d..633a59a7 100644
--- a/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt
+++ b/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt
@@ -4,7 +4,7 @@ import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.base.renderers.html.HtmlRenderer
import org.jetbrains.dokka.pages.TextStyle
import org.junit.jupiter.api.Test
-import renderers.TestPage
+import renderers.testPage
import testApi.testRunner.defaultSourceSet
import utils.Div
import utils.match
@@ -33,7 +33,7 @@ class SourceSetDependentHintTest : HtmlRenderingOnlyTestBase() {
@Test
fun platformIndependentCase() {
- val page = TestPage {
+ val page = testPage {
sourceSetDependentHint(sourceSets = setOf(pl1, pl2, pl3), styles = setOf(TextStyle.Block)) {
text("a")
text("b")
@@ -47,7 +47,7 @@ class SourceSetDependentHintTest : HtmlRenderingOnlyTestBase() {
@Test
fun completelyDivergentCase() {
- val page = TestPage {
+ val page = testPage {
sourceSetDependentHint(sourceSets = setOf(pl1, pl2, pl3), styles = setOf(TextStyle.Block)) {
text("a", sourceSets = setOf(pl1))
text("b", sourceSets = setOf(pl2))
@@ -61,7 +61,7 @@ class SourceSetDependentHintTest : HtmlRenderingOnlyTestBase() {
@Test
fun overlappingCase() {
- val page = TestPage {
+ val page = testPage {
sourceSetDependentHint(sourceSets = setOf(pl1, pl2), styles = setOf(TextStyle.Block)) {
text("a", sourceSets = setOf(pl1))
text("b", sourceSets = setOf(pl1, pl2))
@@ -75,7 +75,7 @@ class SourceSetDependentHintTest : HtmlRenderingOnlyTestBase() {
@Test
fun caseThatCanBeSimplified() {
- val page = TestPage {
+ val page = testPage {
sourceSetDependentHint(sourceSets = setOf(pl1, pl2), styles = setOf(TextStyle.Block)) {
text("a", sourceSets = setOf(pl1, pl2))
text("b", sourceSets = setOf(pl1))
@@ -89,7 +89,7 @@ class SourceSetDependentHintTest : HtmlRenderingOnlyTestBase() {
@Test
fun caseWithGroupBreakingSimplification() {
- val page = TestPage {
+ val page = testPage {
sourceSetDependentHint(sourceSets = setOf(pl1, pl2), styles = setOf(TextStyle.Block)) {
group(styles = setOf(TextStyle.Block)) {
text("a", sourceSets = setOf(pl1, pl2))
@@ -105,7 +105,7 @@ class SourceSetDependentHintTest : HtmlRenderingOnlyTestBase() {
@Test
fun caseWithGroupNotBreakingSimplification() {
- val page = TestPage {
+ val page = testPage {
sourceSetDependentHint(sourceSets = setOf(pl1, pl2)) {
group {
text("a", sourceSets = setOf(pl1, pl2))
@@ -121,7 +121,7 @@ class SourceSetDependentHintTest : HtmlRenderingOnlyTestBase() {
@Test
fun partiallyUnifiedCase() {
- val page = TestPage {
+ val page = testPage {
sourceSetDependentHint(sourceSets = setOf(pl1, pl2, pl3), styles = setOf(TextStyle.Block)) {
text("a", sourceSets = setOf(pl1))
text("a", sourceSets = setOf(pl2))
diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt
index ab1378d5..a205aa2f 100644
--- a/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt
+++ b/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt
@@ -6,7 +6,7 @@ import org.jetbrains.dokka.gfm.CommonmarkRenderer
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.pages.ContentDivergentGroup
import org.junit.jupiter.api.Test
-import renderers.TestPage
+import renderers.testPage
import testApi.testRunner.defaultSourceSet
import java.io.File
@@ -32,7 +32,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() {
@Test
fun simpleWrappingCase() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test")) {
instance(setOf(DRI("test", "Test")), setOf(js)) {
divergent {
@@ -48,7 +48,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() {
@Test
fun noPlatformHintCase() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test"), implicitlySourceSetHinted = false) {
instance(setOf(DRI("test", "Test")), setOf(js)) {
divergent {
@@ -64,7 +64,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() {
@Test
fun divergentBetweenSourceSets() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test")) {
instance(setOf(DRI("test", "Test")), setOf(js)) {
divergent {
@@ -90,7 +90,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() {
@Test
fun divergentInOneSourceSet() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test")) {
instance(setOf(DRI("test", "Test")), setOf(js)) {
divergent {
@@ -116,7 +116,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() {
@Test
fun divergentInAndBetweenSourceSets() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test")) {
instance(setOf(DRI("test", "Test")), setOf(native)) {
divergent {
@@ -152,7 +152,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() {
@Test
fun divergentInAndBetweenSourceSetsWithGrouping() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test")) {
instance(setOf(DRI("test", "Test")), setOf(native)) {
divergent {
@@ -200,7 +200,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() {
@Test
fun divergentSameBefore() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test")) {
instance(setOf(DRI("test", "Test")), setOf(native)) {
before {
@@ -227,7 +227,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() {
@Test
fun divergentSameAfter() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test")) {
instance(setOf(DRI("test", "Test")), setOf(native)) {
divergent {
@@ -254,7 +254,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() {
@Test
fun divergentGroupedByBeforeAndAfter() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test")) {
instance(setOf(DRI("test", "Test")), setOf(native)) {
before {
@@ -287,7 +287,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() {
@Test
fun divergentDifferentBeforeAndAfter() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test")) {
instance(setOf(DRI("test", "Test")), setOf(native)) {
before {
@@ -320,7 +320,7 @@ class DivergentTest : GfmRenderingOnlyTestBase() {
@Test
fun divergentInAndBetweenSourceSetsWithGroupingAncCommonParts() {
- val page = TestPage {
+ val page = testPage {
divergentGroup(ContentDivergentGroup.GroupID("test")) {
instance(setOf(DRI("test", "Test")), setOf(native)) {
divergent {
diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt
index 42839282..53bee558 100644
--- a/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt
+++ b/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt
@@ -9,7 +9,7 @@ class GroupWrappingTest : GfmRenderingOnlyTestBase() {
@Test
fun notWrapped() {
- val page = TestPage {
+ val page = testPage {
group {
text("a")
text("b")
@@ -24,7 +24,7 @@ class GroupWrappingTest : GfmRenderingOnlyTestBase() {
@Test
fun paragraphWrapped() {
- val page = TestPage {
+ val page = testPage {
group(styles = setOf(TextStyle.Paragraph)) {
text("a")
text("b")
@@ -39,7 +39,7 @@ class GroupWrappingTest : GfmRenderingOnlyTestBase() {
@Test
fun blockWrapped() {
- val page = TestPage {
+ val page = testPage {
group(styles = setOf(TextStyle.Block)) {
text("a")
text("b")
@@ -54,7 +54,7 @@ class GroupWrappingTest : GfmRenderingOnlyTestBase() {
@Test
fun nested() {
- val page = TestPage {
+ val page = testPage {
group(styles = setOf(TextStyle.Block)) {
text("a")
group(styles = setOf(TextStyle.Block)) {
diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt
index 7464c079..9055fbc3 100644
--- a/plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt
+++ b/plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt
@@ -2,15 +2,16 @@ package renderers.gfm
import org.jetbrains.dokka.gfm.CommonmarkRenderer
import org.junit.jupiter.api.Test
-import renderers.TestPage
-import org.jetbrains.dokka.base.translators.documentables.*
-import org.jetbrains.dokka.pages.TextStyle
+import renderers.testPage
+import org.jetbrains.dokka.links.DRI
+import org.jetbrains.dokka.pages.*
+import renderers.RawTestPage
class SimpleElementsTest : GfmRenderingOnlyTestBase() {
@Test
fun header() {
- val page = TestPage {
+ val page = testPage {
header(1, "The Hobbit or There and Back Again")
}
val expect = "//[testPage](test-page.md)\n\n\n\n# The Hobbit or There and Back Again \n"
@@ -20,7 +21,7 @@ class SimpleElementsTest : GfmRenderingOnlyTestBase() {
@Test
fun link() {
- val page = TestPage {
+ val page = testPage {
link("They are not all accounted for, the lost Seeing Stones.", "http://www.google.com")
}
val expect = "//[testPage](test-page.md)\n\n[They are not all accounted for, the lost Seeing Stones.](http://www.google.com)"
@@ -30,7 +31,7 @@ class SimpleElementsTest : GfmRenderingOnlyTestBase() {
@Test
fun bold() {
- val page = TestPage {
+ val page = testPage {
text("That there’s some good in this world, Mr. Frodo… and it’s worth fighting for.", styles = setOf(TextStyle.Bold))
}
val expect = "//[testPage](test-page.md)\n\n**That there’s some good in this world, Mr. Frodo… and it’s worth fighting for.**"
@@ -40,7 +41,7 @@ class SimpleElementsTest : GfmRenderingOnlyTestBase() {
@Test
fun italic() {
- val page = TestPage {
+ val page = testPage {
text("Even the smallest person can change the course of the future.", styles = setOf(TextStyle.Italic))
}
val expect = "//[testPage](test-page.md)\n\n*Even the smallest person can change the course of the future.*"
@@ -50,7 +51,7 @@ class SimpleElementsTest : GfmRenderingOnlyTestBase() {
@Test
fun italicAndBold() {
- val page = TestPage {
+ val page = testPage {
text("There is no curse in Elvish, Entish, or the tongues of Men for this treachery.", styles = setOf(TextStyle.Bold, TextStyle.Italic))
}
val expect = "//[testPage](test-page.md)\n\n***There is no curse in Elvish, Entish, or the tongues of Men for this treachery.***"
@@ -60,11 +61,26 @@ class SimpleElementsTest : GfmRenderingOnlyTestBase() {
@Test
fun strikethrough() {
- val page = TestPage {
+ val page = testPage {
text("A day may come when the courage of men fails… but it is not THIS day", styles = setOf(TextStyle.Strikethrough))
}
val expect = "//[testPage](test-page.md)\n\n~~A day may come when the courage of men fails… but it is not THIS day~~"
CommonmarkRenderer(context).render(page)
assert(renderedContent == expect)
}
+
+ @Test
+ fun images(){
+ val image = ContentEmbeddedResource(
+ children = emptyList(),
+ address = "https://www.google.pl/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png",
+ altText = "This is a google logo",
+ dci = DCI(setOf(DRI.topLevel), ContentKind.Main),
+ sourceSets = emptySet()
+ )
+ val page = RawTestPage(content = image)
+ val expect = "//[testPage](test-page.md)\n\n![This is a google logo](https://www.google.pl/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png)"
+ CommonmarkRenderer(context).render(page)
+ assert(renderedContent == expect)
+ }
} \ No newline at end of file
diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt
index 999d7954..0d845a98 100644
--- a/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt
+++ b/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt
@@ -5,7 +5,7 @@ import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.gfm.CommonmarkRenderer
import org.jetbrains.dokka.pages.TextStyle
import org.junit.jupiter.api.Test
-import renderers.TestPage
+import renderers.testPage
import testApi.testRunner.defaultSourceSet
import java.io.File
@@ -32,7 +32,7 @@ class SourceSetDependentHintTest : GfmRenderingOnlyTestBase() {
@Test
fun platformIndependentCase() {
- val page = TestPage {
+ val page = testPage {
sourceSetDependentHint(sourceSets = setOf(pl1, pl2, pl3), styles = setOf(TextStyle.Block)) {
text("a")
text("b")
@@ -46,7 +46,7 @@ class SourceSetDependentHintTest : GfmRenderingOnlyTestBase() {
@Test
fun completelyDivergentCase() {
- val page = TestPage {
+ val page = testPage {
sourceSetDependentHint(sourceSets = setOf(pl1, pl2, pl3), styles = setOf(TextStyle.Block)) {
text("a", sourceSets = setOf(pl1))
text("b", sourceSets = setOf(pl2))
@@ -60,7 +60,7 @@ class SourceSetDependentHintTest : GfmRenderingOnlyTestBase() {
@Test
fun overlappingCase() {
- val page = TestPage {
+ val page = testPage {
sourceSetDependentHint(sourceSets = setOf(pl1, pl2), styles = setOf(TextStyle.Block)) {
text("a", sourceSets = setOf(pl1))
text("b", sourceSets = setOf(pl1, pl2))
@@ -74,7 +74,7 @@ class SourceSetDependentHintTest : GfmRenderingOnlyTestBase() {
@Test
fun caseThatCanBeSimplified() {
- val page = TestPage {
+ val page = testPage {
sourceSetDependentHint(sourceSets = setOf(pl1, pl2), styles = setOf(TextStyle.Block)) {
text("a", sourceSets = setOf(pl1, pl2))
text("b", sourceSets = setOf(pl1))
@@ -88,7 +88,7 @@ class SourceSetDependentHintTest : GfmRenderingOnlyTestBase() {
@Test
fun caseWithGroupBreakingSimplification() {
- val page = TestPage {
+ val page = testPage {
sourceSetDependentHint(sourceSets = setOf(pl1, pl2), styles = setOf(TextStyle.Block)) {
group(styles = setOf(TextStyle.Block)) {
text("a", sourceSets = setOf(pl1, pl2))
@@ -104,7 +104,7 @@ class SourceSetDependentHintTest : GfmRenderingOnlyTestBase() {
@Test
fun caseWithGroupNotBreakingSimplification() {
- val page = TestPage {
+ val page = testPage {
sourceSetDependentHint(sourceSets = setOf(pl1, pl2)) {
group {
text("a", sourceSets = setOf(pl1, pl2))
@@ -120,7 +120,7 @@ class SourceSetDependentHintTest : GfmRenderingOnlyTestBase() {
@Test
fun partiallyUnifiedCase() {
- val page = TestPage {
+ val page = testPage {
sourceSetDependentHint(sourceSets = setOf(pl1, pl2, pl3), styles = setOf(TextStyle.Block)) {
text("a", sourceSets = setOf(pl1))
text("a", sourceSets = setOf(pl2))