Skip to content

Commit 7d0a042

Browse files
committed
Reuse kt icons across tests
1 parent 9e7b773 commit 7d0a042

13 files changed

Lines changed: 246 additions & 342 deletions

File tree

sdk/generator/xml/src/commonTest/kotlin/io/github/composegears/valkyrie/sdk/generator/xml/IrToXmlGeneratorTest.kt

Lines changed: 197 additions & 164 deletions
Large diffs are not rendered by default.

sdk/intellij/psi/imagevector/src/test/kotlin/io/github/composegears/valkyrie/sdk/intellij/psi/imagevector/KtFileToImageVectorParserTest.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.Exp
1010
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedAllPathParams
1111
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedClipPathGradient
1212
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedComposeColor
13-
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedEmptyImageVector
1413
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedEmptyPaths
1514
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedIconWithGroup
1615
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedLinearGradient
1716
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedLinearGradientWithStroke
1817
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedRadialGradient
1918
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedSinglePath
19+
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedWithoutPathImageVector
2020
import io.github.composegears.valkyrie.sdk.intellij.testfixtures.KotlinCodeInsightTest
2121
import io.github.composegears.valkyrie.sdk.ir.compose.toComposeImageVector
2222
import org.jetbrains.kotlin.psi.KtFile
@@ -29,21 +29,21 @@ import org.junit.jupiter.params.provider.EnumSource
2929
class KtFileToImageVectorParserTest(private val parseType: ParseType) : KotlinCodeInsightTest() {
3030

3131
@Test
32-
fun `empty image vector`() = runInEdtAndGet {
32+
fun `without path image vector`() = runInEdtAndGet {
3333
val ktFile = parseType.toKtFile(
34-
pathToLazy = "lazy/EmptyImageVector.kt",
35-
pathToBacking = "backing/EmptyImageVector.kt",
34+
pathToLazy = "imagevector/kt/lazy/WithoutPath.kt",
35+
pathToBacking = "imagevector/kt/backing/WithoutPath.kt",
3636
)
3737
val imageVector = ImageVectorPsiParser.parseToIrImageVector(ktFile)?.toComposeImageVector()
3838

39-
assertThat(imageVector).isEqualTo(ExpectedEmptyImageVector)
39+
assertThat(imageVector).isEqualTo(ExpectedWithoutPathImageVector)
4040
}
4141

4242
@Test
4343
fun `empty paths`() = runInEdtAndGet {
4444
val ktFile = parseType.toKtFile(
45-
pathToLazy = "lazy/EmptyPaths.kt",
46-
pathToBacking = "backing/EmptyPaths.kt",
45+
pathToLazy = "imagevector/kt/lazy/EmptyPaths.kt",
46+
pathToBacking = "imagevector/kt/backing/EmptyPaths.kt",
4747
)
4848
val imageVector = ImageVectorPsiParser.parseToIrImageVector(ktFile)?.toComposeImageVector()
4949

@@ -53,8 +53,8 @@ class KtFileToImageVectorParserTest(private val parseType: ParseType) : KotlinCo
5353
@Test
5454
fun `parse all path params`() = runInEdtAndGet {
5555
val ktFile = parseType.toKtFile(
56-
pathToLazy = "lazy/AllPathParams.kt",
57-
pathToBacking = "backing/AllPathParams.kt",
56+
pathToLazy = "imagevector/kt/lazy/AllPathParams.kt",
57+
pathToBacking = "imagevector/kt/backing/AllPathParams.kt",
5858
)
5959
val imageVector = ImageVectorPsiParser.parseToIrImageVector(ktFile)?.toComposeImageVector()
6060

sdk/intellij/psi/imagevector/src/test/kotlin/io/github/composegears/valkyrie/sdk/intellij/psi/imagevector/expected/AllPathParams.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ val ExpectedAllPathParams = ImageVector.Builder(
1515
defaultHeight = 24.dp,
1616
viewportWidth = 18f,
1717
viewportHeight = 18f,
18+
autoMirror = true,
1819
).apply {
1920
path(
2021
name = "path_name",

sdk/intellij/psi/imagevector/src/test/kotlin/io/github/composegears/valkyrie/sdk/intellij/psi/imagevector/expected/EmptyImageVector.kt renamed to sdk/intellij/psi/imagevector/src/test/kotlin/io/github/composegears/valkyrie/sdk/intellij/psi/imagevector/expected/ExpectedWithoutPathImageVector.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected
33
import androidx.compose.ui.graphics.vector.ImageVector
44
import androidx.compose.ui.unit.dp
55

6-
val ExpectedEmptyImageVector = ImageVector.Builder(
7-
name = "EmptyImageVector",
6+
val ExpectedWithoutPathImageVector = ImageVector.Builder(
7+
name = "WithoutPath",
88
defaultWidth = 24.dp,
99
defaultHeight = 24.dp,
1010
viewportWidth = 18f,
Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +0,0 @@
1-
package io.github.composegears.valkyrie.icons
2-
3-
import androidx.compose.ui.graphics.Color
4-
import androidx.compose.ui.graphics.PathFillType
5-
import androidx.compose.ui.graphics.SolidColor
6-
import androidx.compose.ui.graphics.StrokeCap
7-
import androidx.compose.ui.graphics.StrokeJoin
8-
import androidx.compose.ui.graphics.vector.ImageVector
9-
import androidx.compose.ui.graphics.vector.path
10-
import androidx.compose.ui.unit.dp
11-
12-
val ValkyrieIcons.AllPathParams: ImageVector
13-
get() {
14-
if (_AllPathParams != null) {
15-
return _AllPathParams!!
16-
}
17-
_AllPathParams = ImageVector.Builder(
18-
name = "AllPathParams",
19-
defaultWidth = 24.dp,
20-
defaultHeight = 24.dp,
21-
viewportWidth = 18f,
22-
viewportHeight = 18f
23-
).apply {
24-
path(
25-
name = "path_name",
26-
fill = SolidColor(Color(0xFF232F34)),
27-
fillAlpha = 0.5f,
28-
stroke = SolidColor(Color(0xFF232F34)),
29-
strokeAlpha = 0.5f,
30-
strokeLineWidth = 1f,
31-
strokeLineCap = StrokeCap.Round,
32-
strokeLineJoin = StrokeJoin.Round,
33-
strokeLineMiter = 3f,
34-
pathFillType = PathFillType.EvenOdd
35-
) {
36-
moveTo(6.75f, 12.127f)
37-
moveToRelative(1f, -2f)
38-
lineTo(3.623f, 9f)
39-
lineToRelative(-5.49f, 1.3f)
40-
horizontalLineTo(1.4f)
41-
horizontalLineToRelative(-6f)
42-
verticalLineTo(95.06f)
43-
verticalLineToRelative(10.0f)
44-
curveTo(11.76f, 1.714f, 11.755f, 1.715f, 11.768f, 1.714f)
45-
curveToRelative(3.236f, 0.224f, 7.033f, 0f, 7.033f, 0f)
46-
reflectiveCurveTo(11.957f, 41.979f, 0.013f, 44.716f)
47-
reflectiveCurveToRelative(6.586f, 6.584f, 9.823f, 6.805f)
48-
quadTo(20.306f, 6.477f, 20.306f, 6.508f)
49-
quadToRelative(0.04f, -0.3f, 0.06f, -0.61f)
50-
reflectiveQuadTo(5f, 3f)
51-
reflectiveQuadToRelative(4f, 1f)
52-
arcTo(0.75f, 0.75f, 0f, isMoreThanHalf = false, isPositiveArc = false, 3f, 5.092f)
53-
arcTo(0.75f, 0.75f, 0f, true, false, 3f, 5.092f)
54-
arcToRelative(0.763f, 0.763f, 0f, isMoreThanHalf = false, isPositiveArc = true, -0.55f, -0.066f)
55-
arcToRelative(0.763f, 0.763f, 0f, false, true, -0.55f, -0.066f)
56-
close()
57-
}
58-
}.build()
59-
60-
return _AllPathParams!!
61-
}
62-
63-
@Suppress("ObjectPropertyName")
64-
private var _AllPathParams: ImageVector? = null
Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +0,0 @@
1-
package io.github.composegears.valkyrie.icons
2-
3-
import androidx.compose.ui.graphics.vector.ImageVector
4-
import androidx.compose.ui.unit.dp
5-
6-
val ValkyrieIcons.EmptyImageVector: ImageVector
7-
get() {
8-
if (_EmptyImageVector != null) {
9-
return _EmptyImageVector!!
10-
}
11-
_EmptyImageVector = ImageVector.Builder(
12-
name = "EmptyImageVector",
13-
defaultWidth = 24.dp,
14-
defaultHeight = 24.dp,
15-
viewportWidth = 18f,
16-
viewportHeight = 18f,
17-
).build()
18-
19-
return _EmptyImageVector!!
20-
}
21-
22-
@Suppress("ObjectPropertyName")
23-
private var _EmptyImageVector: ImageVector? = null
Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +0,0 @@
1-
package io.github.composegears.valkyrie.icons
2-
3-
import androidx.compose.ui.graphics.Color
4-
import androidx.compose.ui.graphics.PathFillType
5-
import androidx.compose.ui.graphics.SolidColor
6-
import androidx.compose.ui.graphics.StrokeCap
7-
import androidx.compose.ui.graphics.StrokeJoin
8-
import androidx.compose.ui.graphics.vector.ImageVector
9-
import androidx.compose.ui.graphics.vector.path
10-
import androidx.compose.ui.unit.dp
11-
12-
val ValkyrieIcons.AllPathParams: ImageVector by lazy(LazyThreadSafetyMode.NONE) {
13-
ImageVector.Builder(
14-
name = "AllPathParams",
15-
defaultWidth = 24.dp,
16-
defaultHeight = 24.dp,
17-
viewportWidth = 18f,
18-
viewportHeight = 18f,
19-
).apply {
20-
path(
21-
name = "path_name",
22-
fill = SolidColor(Color(0xFF232F34)),
23-
fillAlpha = 0.5f,
24-
stroke = SolidColor(Color(0xFF232F34)),
25-
strokeAlpha = 0.5f,
26-
strokeLineWidth = 1f,
27-
strokeLineCap = StrokeCap.Round,
28-
strokeLineJoin = StrokeJoin.Round,
29-
strokeLineMiter = 3f,
30-
pathFillType = PathFillType.EvenOdd,
31-
) {
32-
moveTo(6.75f, 12.127f)
33-
moveToRelative(1f, -2f)
34-
lineTo(3.623f, 9f)
35-
lineToRelative(-5.49f, 1.3f)
36-
horizontalLineTo(1.4f)
37-
horizontalLineToRelative(-6f)
38-
verticalLineTo(95.06f)
39-
verticalLineToRelative(10.0f)
40-
curveTo(11.76f, 1.714f, 11.755f, 1.715f, 11.768f, 1.714f)
41-
curveToRelative(3.236f, 0.224f, 7.033f, 0f, 7.033f, 0f)
42-
reflectiveCurveTo(11.957f, 41.979f, 0.013f, 44.716f)
43-
reflectiveCurveToRelative(6.586f, 6.584f, 9.823f, 6.805f)
44-
quadTo(20.306f, 6.477f, 20.306f, 6.508f)
45-
quadToRelative(0.04f, -0.3f, 0.06f, -0.61f)
46-
reflectiveQuadTo(5f, 3f)
47-
reflectiveQuadToRelative(4f, 1f)
48-
arcTo(0.75f, 0.75f, 0f, isMoreThanHalf = false, isPositiveArc = false, 3f, 5.092f)
49-
arcTo(0.75f, 0.75f, 0f, true, false, 3f, 5.092f)
50-
arcToRelative(0.763f, 0.763f, 0f, isMoreThanHalf = false, isPositiveArc = true, -0.55f, -0.066f)
51-
arcToRelative(0.763f, 0.763f, 0f, false, true, -0.55f, -0.066f)
52-
close()
53-
}
54-
}.build()
55-
}
Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +0,0 @@
1-
package io.github.composegears.valkyrie.icons
2-
3-
import androidx.compose.ui.graphics.vector.ImageVector
4-
import androidx.compose.ui.unit.dp
5-
6-
val ValkyrieIcons.EmptyImageVector: ImageVector by lazy(LazyThreadSafetyMode.NONE) {
7-
ImageVector.Builder(
8-
name = "EmptyImageVector",
9-
defaultWidth = 24.dp,
10-
defaultHeight = 24.dp,
11-
viewportWidth = 18f,
12-
viewportHeight = 18f,
13-
).build()
14-
}

sdk/test/sharedTestResources/imagevector/kt/backing/AllPathParams.kt

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,25 @@ val ValkyrieIcons.AllPathParams: ImageVector
3535
pathFillType = PathFillType.EvenOdd
3636
) {
3737
moveTo(6.75f, 12.127f)
38+
moveToRelative(1f, -2f)
3839
lineTo(3.623f, 9f)
39-
lineTo(2.558f, 10.057f)
40-
lineTo(6.75f, 14.25f)
41-
lineTo(15.75f, 5.25f)
42-
lineTo(14.693f, 4.192f)
43-
lineTo(6.75f, 12.127f)
40+
lineToRelative(-5.49f, 1.3f)
41+
horizontalLineTo(1.4f)
42+
horizontalLineToRelative(-6f)
43+
verticalLineTo(95.06f)
44+
verticalLineToRelative(10f)
45+
curveTo(11.76f, 1.714f, 11.755f, 1.715f, 11.768f, 1.714f)
46+
curveToRelative(3.236f, 0.224f, 7.033f, 0f, 7.033f, 0f)
47+
reflectiveCurveTo(11.957f, 41.979f, 0.013f, 44.716f)
48+
reflectiveCurveToRelative(6.586f, 6.584f, 9.823f, 6.805f)
49+
quadTo(20.306f, 6.477f, 20.306f, 6.508f)
50+
quadToRelative(0.04f, -0.3f, 0.06f, -0.61f)
51+
reflectiveQuadTo(5f, 3f)
52+
reflectiveQuadToRelative(4f, 1f)
53+
arcTo(0.75f, 0.75f, 0f, isMoreThanHalf = false, isPositiveArc = false, 3f, 5.092f)
54+
arcTo(0.75f, 0.75f, 0f, isMoreThanHalf = true, isPositiveArc = false, 3f, 5.092f)
55+
arcToRelative(0.763f, 0.763f, 0f, isMoreThanHalf = false, isPositiveArc = true, -0.55f, -0.066f)
56+
arcToRelative(0.763f, 0.763f, 0f, isMoreThanHalf = false, isPositiveArc = true, -0.55f, -0.066f)
4457
close()
4558
}
4659
}.build()

sdk/intellij/psi/imagevector/src/test/resources/backing/EmptyPaths.kt renamed to sdk/test/sharedTestResources/imagevector/kt/backing/EmptyPaths.kt

File renamed without changes.

0 commit comments

Comments
 (0)