Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.Exp
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedAllPathParams
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedClipPathGradient
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedComposeColor
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedEmptyImageVector
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedEmptyPaths
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedIconWithGroup
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedLinearGradient
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedLinearGradientWithStroke
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedRadialGradient
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedSinglePath
import io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected.ExpectedWithoutPathImageVector
import io.github.composegears.valkyrie.sdk.intellij.testfixtures.KotlinCodeInsightTest
import io.github.composegears.valkyrie.sdk.ir.compose.toComposeImageVector
import org.jetbrains.kotlin.psi.KtFile
Expand All @@ -28,21 +28,21 @@ import org.junit.jupiter.params.provider.EnumSource
class KtFileToImageVectorParserTest(private val parseType: ParseType) : KotlinCodeInsightTest() {

@Test
fun `empty image vector`() = runInEdtAndGet {
fun `without path image vector`() = runInEdtAndGet {
val ktFile = parseType.toKtFile(
pathToLazy = "lazy/EmptyImageVector.kt",
pathToBacking = "backing/EmptyImageVector.kt",
pathToLazy = "imagevector/kt/lazy/WithoutPath.kt",
pathToBacking = "imagevector/kt/backing/WithoutPath.kt",
)
val imageVector = ImageVectorPsiParser.parseToIrImageVector(ktFile)?.toComposeImageVector()

assertThat(imageVector).isEqualTo(ExpectedEmptyImageVector)
assertThat(imageVector).isEqualTo(ExpectedWithoutPathImageVector)
}

@Test
fun `empty paths`() = runInEdtAndGet {
val ktFile = parseType.toKtFile(
pathToLazy = "lazy/EmptyPaths.kt",
pathToBacking = "backing/EmptyPaths.kt",
pathToLazy = "imagevector/kt/lazy/EmptyPaths.kt",
pathToBacking = "imagevector/kt/backing/EmptyPaths.kt",
)
val imageVector = ImageVectorPsiParser.parseToIrImageVector(ktFile)?.toComposeImageVector()

Expand All @@ -52,8 +52,8 @@ class KtFileToImageVectorParserTest(private val parseType: ParseType) : KotlinCo
@Test
fun `parse all path params`() = runInEdtAndGet {
val ktFile = parseType.toKtFile(
pathToLazy = "lazy/AllPathParams.kt",
pathToBacking = "backing/AllPathParams.kt",
pathToLazy = "imagevector/kt/lazy/AllPathParams.kt",
pathToBacking = "imagevector/kt/backing/AllPathParams.kt",
)
val imageVector = ImageVectorPsiParser.parseToIrImageVector(ktFile)?.toComposeImageVector()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ val ExpectedAllPathParams = ImageVector.Builder(
defaultHeight = 24.dp,
viewportWidth = 18f,
viewportHeight = 18f,
autoMirror = true,
).apply {
path(
name = "path_name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package io.github.composegears.valkyrie.sdk.intellij.psi.imagevector.expected
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp

val ExpectedEmptyImageVector = ImageVector.Builder(
name = "EmptyImageVector",
val ExpectedWithoutPathImageVector = ImageVector.Builder(
name = "WithoutPath",
defaultWidth = 24.dp,
defaultHeight = 24.dp,
viewportWidth = 18f,
viewportHeight = 18f,
).build()
).build()
Original file line number Diff line number Diff line change
@@ -1,64 +0,0 @@
package io.github.composegears.valkyrie.icons

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.StrokeJoin
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp

val ValkyrieIcons.AllPathParams: ImageVector
get() {
if (_AllPathParams != null) {
return _AllPathParams!!
}
_AllPathParams = ImageVector.Builder(
name = "AllPathParams",
defaultWidth = 24.dp,
defaultHeight = 24.dp,
viewportWidth = 18f,
viewportHeight = 18f
).apply {
path(
name = "path_name",
fill = SolidColor(Color(0xFF232F34)),
fillAlpha = 0.5f,
stroke = SolidColor(Color(0xFF232F34)),
strokeAlpha = 0.5f,
strokeLineWidth = 1f,
strokeLineCap = StrokeCap.Round,
strokeLineJoin = StrokeJoin.Round,
strokeLineMiter = 3f,
pathFillType = PathFillType.EvenOdd
) {
moveTo(6.75f, 12.127f)
moveToRelative(1f, -2f)
lineTo(3.623f, 9f)
lineToRelative(-5.49f, 1.3f)
horizontalLineTo(1.4f)
horizontalLineToRelative(-6f)
verticalLineTo(95.06f)
verticalLineToRelative(10.0f)
curveTo(11.76f, 1.714f, 11.755f, 1.715f, 11.768f, 1.714f)
curveToRelative(3.236f, 0.224f, 7.033f, 0f, 7.033f, 0f)
reflectiveCurveTo(11.957f, 41.979f, 0.013f, 44.716f)
reflectiveCurveToRelative(6.586f, 6.584f, 9.823f, 6.805f)
quadTo(20.306f, 6.477f, 20.306f, 6.508f)
quadToRelative(0.04f, -0.3f, 0.06f, -0.61f)
reflectiveQuadTo(5f, 3f)
reflectiveQuadToRelative(4f, 1f)
arcTo(0.75f, 0.75f, 0f, isMoreThanHalf = false, isPositiveArc = false, 3f, 5.092f)
arcTo(0.75f, 0.75f, 0f, true, false, 3f, 5.092f)
arcToRelative(0.763f, 0.763f, 0f, isMoreThanHalf = false, isPositiveArc = true, -0.55f, -0.066f)
arcToRelative(0.763f, 0.763f, 0f, false, true, -0.55f, -0.066f)
close()
}
}.build()

return _AllPathParams!!
}

@Suppress("ObjectPropertyName")
private var _AllPathParams: ImageVector? = null
Original file line number Diff line number Diff line change
@@ -1,23 +0,0 @@
package io.github.composegears.valkyrie.icons

import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp

val ValkyrieIcons.EmptyImageVector: ImageVector
get() {
if (_EmptyImageVector != null) {
return _EmptyImageVector!!
}
_EmptyImageVector = ImageVector.Builder(
name = "EmptyImageVector",
defaultWidth = 24.dp,
defaultHeight = 24.dp,
viewportWidth = 18f,
viewportHeight = 18f,
).build()

return _EmptyImageVector!!
}

@Suppress("ObjectPropertyName")
private var _EmptyImageVector: ImageVector? = null
Original file line number Diff line number Diff line change
@@ -1,55 +0,0 @@
package io.github.composegears.valkyrie.icons

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.StrokeJoin
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp

val ValkyrieIcons.AllPathParams: ImageVector by lazy(LazyThreadSafetyMode.NONE) {
ImageVector.Builder(
name = "AllPathParams",
defaultWidth = 24.dp,
defaultHeight = 24.dp,
viewportWidth = 18f,
viewportHeight = 18f,
).apply {
path(
name = "path_name",
fill = SolidColor(Color(0xFF232F34)),
fillAlpha = 0.5f,
stroke = SolidColor(Color(0xFF232F34)),
strokeAlpha = 0.5f,
strokeLineWidth = 1f,
strokeLineCap = StrokeCap.Round,
strokeLineJoin = StrokeJoin.Round,
strokeLineMiter = 3f,
pathFillType = PathFillType.EvenOdd,
) {
moveTo(6.75f, 12.127f)
moveToRelative(1f, -2f)
lineTo(3.623f, 9f)
lineToRelative(-5.49f, 1.3f)
horizontalLineTo(1.4f)
horizontalLineToRelative(-6f)
verticalLineTo(95.06f)
verticalLineToRelative(10.0f)
curveTo(11.76f, 1.714f, 11.755f, 1.715f, 11.768f, 1.714f)
curveToRelative(3.236f, 0.224f, 7.033f, 0f, 7.033f, 0f)
reflectiveCurveTo(11.957f, 41.979f, 0.013f, 44.716f)
reflectiveCurveToRelative(6.586f, 6.584f, 9.823f, 6.805f)
quadTo(20.306f, 6.477f, 20.306f, 6.508f)
quadToRelative(0.04f, -0.3f, 0.06f, -0.61f)
reflectiveQuadTo(5f, 3f)
reflectiveQuadToRelative(4f, 1f)
arcTo(0.75f, 0.75f, 0f, isMoreThanHalf = false, isPositiveArc = false, 3f, 5.092f)
arcTo(0.75f, 0.75f, 0f, true, false, 3f, 5.092f)
arcToRelative(0.763f, 0.763f, 0f, isMoreThanHalf = false, isPositiveArc = true, -0.55f, -0.066f)
arcToRelative(0.763f, 0.763f, 0f, false, true, -0.55f, -0.066f)
close()
}
}.build()
}
Original file line number Diff line number Diff line change
@@ -1,14 +0,0 @@
package io.github.composegears.valkyrie.icons

import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp

val ValkyrieIcons.EmptyImageVector: ImageVector by lazy(LazyThreadSafetyMode.NONE) {
ImageVector.Builder(
name = "EmptyImageVector",
defaultWidth = 24.dp,
defaultHeight = 24.dp,
viewportWidth = 18f,
viewportHeight = 18f,
).build()
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,25 @@ val ValkyrieIcons.AllPathParams: ImageVector
pathFillType = PathFillType.EvenOdd
) {
moveTo(6.75f, 12.127f)
moveToRelative(1f, -2f)
lineTo(3.623f, 9f)
lineTo(2.558f, 10.057f)
lineTo(6.75f, 14.25f)
lineTo(15.75f, 5.25f)
lineTo(14.693f, 4.192f)
lineTo(6.75f, 12.127f)
lineToRelative(-5.49f, 1.3f)
horizontalLineTo(1.4f)
horizontalLineToRelative(-6f)
verticalLineTo(95.06f)
verticalLineToRelative(10.0f)
curveTo(11.76f, 1.714f, 11.755f, 1.715f, 11.768f, 1.714f)
curveToRelative(3.236f, 0.224f, 7.033f, 0f, 7.033f, 0f)
reflectiveCurveTo(11.957f, 41.979f, 0.013f, 44.716f)
reflectiveCurveToRelative(6.586f, 6.584f, 9.823f, 6.805f)
quadTo(20.306f, 6.477f, 20.306f, 6.508f)
quadToRelative(0.04f, -0.3f, 0.06f, -0.61f)
reflectiveQuadTo(5f, 3f)
reflectiveQuadToRelative(4f, 1f)
arcTo(0.75f, 0.75f, 0f, isMoreThanHalf = false, isPositiveArc = false, 3f, 5.092f)
arcTo(0.75f, 0.75f, 0f, true, false, 3f, 5.092f)
arcToRelative(0.763f, 0.763f, 0f, isMoreThanHalf = false, isPositiveArc = true, -0.55f, -0.066f)
arcToRelative(0.763f, 0.763f, 0f, false, true, -0.55f, -0.066f)
close()
}
}.build()
Expand Down
23 changes: 18 additions & 5 deletions sdk/test/sharedTestResources/imagevector/kt/lazy/AllPathParams.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,25 @@ val ValkyrieIcons.AllPathParams: ImageVector by lazy(LazyThreadSafetyMode.NONE)
pathFillType = PathFillType.EvenOdd
) {
moveTo(6.75f, 12.127f)
moveToRelative(1f, -2f)
lineTo(3.623f, 9f)
lineTo(2.558f, 10.057f)
lineTo(6.75f, 14.25f)
lineTo(15.75f, 5.25f)
lineTo(14.693f, 4.192f)
lineTo(6.75f, 12.127f)
lineToRelative(-5.49f, 1.3f)
horizontalLineTo(1.4f)
horizontalLineToRelative(-6f)
verticalLineTo(95.06f)
verticalLineToRelative(10.0f)
curveTo(11.76f, 1.714f, 11.755f, 1.715f, 11.768f, 1.714f)
curveToRelative(3.236f, 0.224f, 7.033f, 0f, 7.033f, 0f)
reflectiveCurveTo(11.957f, 41.979f, 0.013f, 44.716f)
reflectiveCurveToRelative(6.586f, 6.584f, 9.823f, 6.805f)
quadTo(20.306f, 6.477f, 20.306f, 6.508f)
quadToRelative(0.04f, -0.3f, 0.06f, -0.61f)
reflectiveQuadTo(5f, 3f)
reflectiveQuadToRelative(4f, 1f)
arcTo(0.75f, 0.75f, 0f, isMoreThanHalf = false, isPositiveArc = false, 3f, 5.092f)
arcTo(0.75f, 0.75f, 0f, true, false, 3f, 5.092f)
arcToRelative(0.763f, 0.763f, 0f, isMoreThanHalf = false, isPositiveArc = true, -0.55f, -0.066f)
arcToRelative(0.763f, 0.763f, 0f, false, true, -0.55f, -0.066f)
close()
}
}.build()
Expand Down
Loading