app.cash.paparazzi.gradle.reporting.ClassTestResults.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of paparazzi-gradle-plugin Show documentation
Show all versions of paparazzi-gradle-plugin Show documentation
A Gradle plugin to set up the Paparazzi test library
The newest version!
package app.cash.paparazzi.gradle.reporting
import org.gradle.internal.FileUtils
import java.util.TreeSet
/**
* Test results for a given class.
*/
internal class ClassTestResults(
val id: Long,
val name: String,
private val displayName: String? = name,
val packageResults: PackageTestResults
) : CompositeTestResults(
packageResults
) {
private val results: MutableSet = TreeSet()
override val baseUrl: String = "classes/" + FileUtils.toSafeFileName(name) + ".html"
override val title: String
get() = if (name == displayName) "Class $name" else displayName!!
val reportName: String
get() =
if (displayName != null && displayName != name) {
displayName
} else {
simpleName
}
val simpleName: String
get() {
val simpleName = name.substringAfterLast(".")
if (simpleName == "") {
return name
}
return simpleName
}
val testResults: Collection
get() = results
fun addTest(testName: String, testDisplayName: String, duration: Long): TestResult? {
val test = TestResult(testName, testDisplayName, duration, this)
results += test
return addTest(test)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy