Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create sharedTestResources #303

Merged
merged 1 commit into from
Nov 20, 2024
Merged
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 @@ -4,7 +4,7 @@ import assertk.assertThat
import assertk.assertions.isEqualTo
import org.junit.jupiter.api.Test

class FormatterTest {
class FloatFormatterTest {

@Test
fun `formatValue for floats`() {
Expand Down
8 changes: 8 additions & 0 deletions components/generator/iconpack/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ plugins {
alias(libs.plugins.kotlin.jvm)
}

sourceSets {
test {
resources {
srcDir("$rootDir/components/sharedTestResources")
}
}
}

dependencies {
implementation(projects.components.extensions)
implementation(projects.components.generator.common)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class IcoPackWithIndentTest {
@Test
fun `generate nested indent 1 packs`() {
val result = IconPackGenerator.create(config = createConfig(indentSize = 1))
val expected = getResourceText("kt/IconPack.nested.indent1.kt")
val expected = getResourceText("iconpack/IconPack.nested.indent1.kt")

assertThat(result.content).isEqualTo(expected)
assertThat(result.name).isEqualTo("ValkyrieIcons")
Expand All @@ -31,7 +31,7 @@ class IcoPackWithIndentTest {
@Test
fun `generate nested indent 2 packs`() {
val result = IconPackGenerator.create(config = createConfig(indentSize = 2))
val expected = getResourceText("kt/IconPack.nested.indent2.kt")
val expected = getResourceText("iconpack/IconPack.nested.indent2.kt")

assertThat(result.content).isEqualTo(expected)
assertThat(result.name).isEqualTo("ValkyrieIcons")
Expand All @@ -40,7 +40,7 @@ class IcoPackWithIndentTest {
@Test
fun `generate nested indent 3 packs`() {
val result = IconPackGenerator.create(config = createConfig(indentSize = 3))
val expected = getResourceText("kt/IconPack.nested.indent3.kt")
val expected = getResourceText("iconpack/IconPack.nested.indent3.kt")

assertThat(result.content).isEqualTo(expected)
assertThat(result.name).isEqualTo("ValkyrieIcons")
Expand All @@ -49,7 +49,7 @@ class IcoPackWithIndentTest {
@Test
fun `generate nested indent 6 packs`() {
val result = IconPackGenerator.create(config = createConfig(indentSize = 6))
val expected = getResourceText("kt/IconPack.nested.indent6.kt")
val expected = getResourceText("iconpack/IconPack.nested.indent6.kt")

assertThat(result.content).isEqualTo(expected)
assertThat(result.name).isEqualTo("ValkyrieIcons")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class IconPackGeneratorTest {
fun `generate icon pack`() {
val result = IconPackGenerator.create(config = createConfig())

val expected = getResourceText("kt/IconPack.kt")
val expected = getResourceText("iconpack/IconPack.kt")

assertThat(result.content).isEqualTo(expected)
assertThat(result.name).isEqualTo("ValkyrieIcons")
Expand All @@ -35,7 +35,7 @@ class IconPackGeneratorTest {
config = createConfig(useExplicitMode = true),
)

val expected = getResourceText("kt/IconPack.explicit.kt")
val expected = getResourceText("iconpack/IconPack.explicit.kt")

assertThat(result.content).isEqualTo(expected)
assertThat(result.name).isEqualTo("ValkyrieIcons")
Expand All @@ -47,7 +47,7 @@ class IconPackGeneratorTest {
config = createConfig(nestedPacks = listOf("Filled", "Colored")),
)

val expected = getResourceText("kt/IconPack.nested.kt")
val expected = getResourceText("iconpack/IconPack.nested.kt")

assertThat(result.content).isEqualTo(expected)
assertThat(result.name).isEqualTo("ValkyrieIcons")
Expand All @@ -62,7 +62,7 @@ class IconPackGeneratorTest {
),
)

val expected = getResourceText("kt/IconPack.nested.explicit.kt")
val expected = getResourceText("iconpack/IconPack.nested.explicit.kt")

assertThat(result.content).isEqualTo(expected)
assertThat(result.name).isEqualTo("ValkyrieIcons")
Expand Down
8 changes: 8 additions & 0 deletions components/generator/imagevector/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ plugins {
alias(libs.plugins.kotlin.jvm)
}

sourceSets {
test {
resources {
srcDir("$rootDir/components/sharedTestResources")
}
}
}

dependencies {
implementation(projects.components.extensions)
implementation(projects.components.generator.common)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CustomPackageTest {
@ParameterizedTest
@EnumSource(value = OutputFormat::class)
fun `flat package without icon pack`(outputFormat: OutputFormat) {
val icon = getResourcePath("xml/ic_flat_package.xml")
val icon = getResourcePath("imagevector/xml/ic_flat_package.xml")
val parserOutput = SvgXmlParser.toIrImageVector(icon)
val output = ImageVectorGenerator.convert(
vector = parserOutput.irImageVector,
Expand All @@ -27,8 +27,8 @@ class CustomPackageTest {
).content

val expected = outputFormat.toResourceText(
pathToBackingProperty = "kt/backing/FlatPackage.kt",
pathToLazyProperty = "kt/lazy/FlatPackage.kt",
pathToBackingProperty = "imagevector/kt/backing/FlatPackage.kt",
pathToLazyProperty = "imagevector/kt/lazy/FlatPackage.kt",
)
assertThat(parserOutput.iconType).isEqualTo(XML)
assertThat(output).isEqualTo(expected)
Expand All @@ -37,7 +37,7 @@ class CustomPackageTest {
@ParameterizedTest
@EnumSource(value = OutputFormat::class)
fun `flat package with icon pack`(outputFormat: OutputFormat) {
val icon = getResourcePath("xml/ic_flat_package.xml")
val icon = getResourcePath("imagevector/xml/ic_flat_package.xml")
val parserOutput = SvgXmlParser.toIrImageVector(icon)
val output = ImageVectorGenerator.convert(
vector = parserOutput.irImageVector,
Expand All @@ -50,8 +50,8 @@ class CustomPackageTest {
).content

val expected = outputFormat.toResourceText(
pathToBackingProperty = "kt/backing/FlatPackage.pack.kt",
pathToLazyProperty = "kt/lazy/FlatPackage.pack.kt",
pathToBackingProperty = "imagevector/kt/backing/FlatPackage.pack.kt",
pathToLazyProperty = "imagevector/kt/lazy/FlatPackage.pack.kt",
)
assertThat(parserOutput.iconType).isEqualTo(XML)
assertThat(output).isEqualTo(expected)
Expand All @@ -60,7 +60,7 @@ class CustomPackageTest {
@ParameterizedTest
@EnumSource(value = OutputFormat::class)
fun `flat package with nested icon pack`(outputFormat: OutputFormat) {
val icon = getResourcePath("xml/ic_flat_package.xml")
val icon = getResourcePath("imagevector/xml/ic_flat_package.xml")
val parserOutput = SvgXmlParser.toIrImageVector(icon)
val output = ImageVectorGenerator.convert(
vector = parserOutput.irImageVector,
Expand All @@ -74,8 +74,8 @@ class CustomPackageTest {
).content

val expected = outputFormat.toResourceText(
pathToBackingProperty = "kt/backing/FlatPackage.pack.nested.kt",
pathToLazyProperty = "kt/lazy/FlatPackage.pack.nested.kt",
pathToBackingProperty = "imagevector/kt/backing/FlatPackage.pack.nested.kt",
pathToLazyProperty = "imagevector/kt/lazy/FlatPackage.pack.nested.kt",
)
assertThat(parserOutput.iconType).isEqualTo(XML)
assertThat(output).isEqualTo(expected)
Expand All @@ -84,7 +84,7 @@ class CustomPackageTest {
@ParameterizedTest
@EnumSource(value = OutputFormat::class)
fun `different icon pack package`(outputFormat: OutputFormat) {
val icon = getResourcePath("xml/ic_without_path.xml")
val icon = getResourcePath("imagevector/xml/ic_without_path.xml")
val parserOutput = SvgXmlParser.toIrImageVector(icon)
val output = ImageVectorGenerator.convert(
vector = parserOutput.irImageVector,
Expand All @@ -100,8 +100,8 @@ class CustomPackageTest {
).content

val expected = outputFormat.toResourceText(
pathToBackingProperty = "kt/backing/WithoutPath.pack.package.kt",
pathToLazyProperty = "kt/lazy/WithoutPath.pack.package.kt",
pathToBackingProperty = "imagevector/kt/backing/WithoutPath.pack.package.kt",
pathToLazyProperty = "imagevector/kt/lazy/WithoutPath.pack.package.kt",
)
assertThat(parserOutput.iconType).isEqualTo(XML)
assertThat(output).isEqualTo(expected)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ExplicitModeTest {
@ParameterizedTest
@EnumSource(value = OutputFormat::class)
fun `generation with explicit mode`(outputFormat: OutputFormat) {
val icon = getResourcePath("xml/ic_without_path.xml")
val icon = getResourcePath("imagevector/xml/ic_without_path.xml")
val parserOutput = SvgXmlParser.toIrImageVector(icon)
val output = ImageVectorGenerator.convert(
vector = parserOutput.irImageVector,
Expand All @@ -27,8 +27,8 @@ class ExplicitModeTest {
).content

val expected = outputFormat.toResourceText(
pathToBackingProperty = "kt/backing/WithoutPath.explicit.kt",
pathToLazyProperty = "kt/lazy/WithoutPath.explicit.kt",
pathToBackingProperty = "imagevector/kt/backing/WithoutPath.explicit.kt",
pathToLazyProperty = "imagevector/kt/lazy/WithoutPath.explicit.kt",
)
assertThat(parserOutput.iconType).isEqualTo(XML)
assertThat(output).isEqualTo(expected)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ImageVectorWithIndentTest {
@ParameterizedTest
@EnumSource(value = OutputFormat::class)
fun `generation without icon pack with indent 1`(outputFormat: OutputFormat) {
val icon = getResourcePath("xml/ic_without_path.xml")
val icon = getResourcePath("imagevector/xml/ic_without_path.xml")
val parserOutput = SvgXmlParser.toIrImageVector(icon)
val output = ImageVectorGenerator.convert(
vector = parserOutput.irImageVector,
Expand All @@ -27,8 +27,8 @@ class ImageVectorWithIndentTest {
).content

val expected = outputFormat.toResourceText(
pathToBackingProperty = "kt/backing/WithoutPath.indent1.kt",
pathToLazyProperty = "kt/lazy/WithoutPath.indent1.kt",
pathToBackingProperty = "imagevector/kt/backing/WithoutPath.indent1.kt",
pathToLazyProperty = "imagevector/kt/lazy/WithoutPath.indent1.kt",
)
assertThat(parserOutput.iconType).isEqualTo(XML)
assertThat(output).isEqualTo(expected)
Expand All @@ -37,7 +37,7 @@ class ImageVectorWithIndentTest {
@ParameterizedTest
@EnumSource(value = OutputFormat::class)
fun `generation without icon pack with indent 2`(outputFormat: OutputFormat) {
val icon = getResourcePath("xml/ic_without_path.xml")
val icon = getResourcePath("imagevector/xml/ic_without_path.xml")
val parserOutput = SvgXmlParser.toIrImageVector(icon)
val output = ImageVectorGenerator.convert(
vector = parserOutput.irImageVector,
Expand All @@ -49,8 +49,8 @@ class ImageVectorWithIndentTest {
).content

val expected = outputFormat.toResourceText(
pathToBackingProperty = "kt/backing/WithoutPath.indent2.kt",
pathToLazyProperty = "kt/lazy/WithoutPath.indent2.kt",
pathToBackingProperty = "imagevector/kt/backing/WithoutPath.indent2.kt",
pathToLazyProperty = "imagevector/kt/lazy/WithoutPath.indent2.kt",
)
assertThat(parserOutput.iconType).isEqualTo(XML)
assertThat(output).isEqualTo(expected)
Expand All @@ -59,7 +59,7 @@ class ImageVectorWithIndentTest {
@ParameterizedTest
@EnumSource(value = OutputFormat::class)
fun `generation without icon pack with indent 3`(outputFormat: OutputFormat) {
val icon = getResourcePath("xml/ic_without_path.xml")
val icon = getResourcePath("imagevector/xml/ic_without_path.xml")
val parserOutput = SvgXmlParser.toIrImageVector(icon)
val output = ImageVectorGenerator.convert(
vector = parserOutput.irImageVector,
Expand All @@ -71,8 +71,8 @@ class ImageVectorWithIndentTest {
).content

val expected = outputFormat.toResourceText(
pathToBackingProperty = "kt/backing/WithoutPath.indent3.kt",
pathToLazyProperty = "kt/lazy/WithoutPath.indent3.kt",
pathToBackingProperty = "imagevector/kt/backing/WithoutPath.indent3.kt",
pathToLazyProperty = "imagevector/kt/lazy/WithoutPath.indent3.kt",
)
assertThat(parserOutput.iconType).isEqualTo(XML)
assertThat(output).isEqualTo(expected)
Expand All @@ -81,7 +81,7 @@ class ImageVectorWithIndentTest {
@ParameterizedTest
@EnumSource(value = OutputFormat::class)
fun `generation without icon pack with indent 6`(outputFormat: OutputFormat) {
val icon = getResourcePath("xml/ic_without_path.xml")
val icon = getResourcePath("imagevector/xml/ic_without_path.xml")
val parserOutput = SvgXmlParser.toIrImageVector(icon)
val output = ImageVectorGenerator.convert(
vector = parserOutput.irImageVector,
Expand All @@ -93,8 +93,8 @@ class ImageVectorWithIndentTest {
).content

val expected = outputFormat.toResourceText(
pathToBackingProperty = "kt/backing/WithoutPath.indent6.kt",
pathToLazyProperty = "kt/lazy/WithoutPath.indent6.kt",
pathToBackingProperty = "imagevector/kt/backing/WithoutPath.indent6.kt",
pathToLazyProperty = "imagevector/kt/lazy/WithoutPath.indent6.kt",
)
assertThat(parserOutput.iconType).isEqualTo(XML)
assertThat(output).isEqualTo(expected)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ImageVectorWithPreviewTest {
@ParameterizedTest
@EnumSource(value = OutputFormat::class)
fun `preview generation without icon pack`(outputFormat: OutputFormat) {
val icon = getResourcePath("xml/ic_without_path.xml")
val icon = getResourcePath("imagevector/xml/ic_without_path.xml")
val parserOutput = SvgXmlParser.toIrImageVector(icon)
val output = ImageVectorGenerator.convert(
vector = parserOutput.irImageVector,
Expand All @@ -27,8 +27,8 @@ class ImageVectorWithPreviewTest {
).content

val expected = outputFormat.toResourceText(
pathToBackingProperty = "kt/backing/WithoutPath.preview.kt",
pathToLazyProperty = "kt/lazy/WithoutPath.preview.kt",
pathToBackingProperty = "imagevector/kt/backing/WithoutPath.preview.kt",
pathToLazyProperty = "imagevector/kt/lazy/WithoutPath.preview.kt",
)
assertThat(parserOutput.iconType).isEqualTo(XML)
assertThat(output).isEqualTo(expected)
Expand All @@ -37,7 +37,7 @@ class ImageVectorWithPreviewTest {
@ParameterizedTest
@EnumSource(value = OutputFormat::class)
fun `preview generation with icon pack`(outputFormat: OutputFormat) {
val icon = getResourcePath("xml/ic_without_path.xml")
val icon = getResourcePath("imagevector/xml/ic_without_path.xml")
val parserOutput = SvgXmlParser.toIrImageVector(icon)
val output = ImageVectorGenerator.convert(
vector = parserOutput.irImageVector,
Expand All @@ -50,8 +50,8 @@ class ImageVectorWithPreviewTest {
).content

val expected = outputFormat.toResourceText(
pathToBackingProperty = "kt/backing/WithoutPath.pack.preview.kt",
pathToLazyProperty = "kt/lazy/WithoutPath.pack.preview.kt",
pathToBackingProperty = "imagevector/kt/backing/WithoutPath.pack.preview.kt",
pathToLazyProperty = "imagevector/kt/lazy/WithoutPath.pack.preview.kt",
)
assertThat(parserOutput.iconType).isEqualTo(XML)
assertThat(output).isEqualTo(expected)
Expand All @@ -60,7 +60,7 @@ class ImageVectorWithPreviewTest {
@ParameterizedTest
@EnumSource(value = OutputFormat::class)
fun `preview generation with nested pack`(outputFormat: OutputFormat) {
val icon = getResourcePath("xml/ic_without_path.xml")
val icon = getResourcePath("imagevector/xml/ic_without_path.xml")
val parserOutput = SvgXmlParser.toIrImageVector(icon)
val output = ImageVectorGenerator.convert(
vector = parserOutput.irImageVector,
Expand All @@ -74,8 +74,8 @@ class ImageVectorWithPreviewTest {
).content

val expected = outputFormat.toResourceText(
pathToBackingProperty = "kt/backing/WithoutPath.pack.nested.preview.kt",
pathToLazyProperty = "kt/lazy/WithoutPath.pack.nested.preview.kt",
pathToBackingProperty = "imagevector/kt/backing/WithoutPath.pack.nested.preview.kt",
pathToLazyProperty = "imagevector/kt/lazy/WithoutPath.pack.nested.preview.kt",
)
assertThat(parserOutput.iconType).isEqualTo(XML)
assertThat(output).isEqualTo(expected)
Expand Down
Loading