mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-05 04:15:12 +00:00
Merge
This commit is contained in:
+8
-8
@@ -57,16 +57,16 @@ class KonsistClassNameTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Classes extending 'PreviewParameterProvider' name MUST end with 'Provider' and MUST contain provided class name`() {
|
||||
fun `Classes extending 'PreviewParameterProvider' name MUST end with 'PreviewParam' and MUST contain provided class name`() {
|
||||
Konsist.scopeFromProduction()
|
||||
.classes()
|
||||
.withAllParentsOf(PreviewParameterProvider::class)
|
||||
.withoutName(
|
||||
"AspectRatioProvider",
|
||||
"EditableAvatarViewUriProvider",
|
||||
"LoginModeViewErrorProvider",
|
||||
"OverlapRatioProvider",
|
||||
"TextFileContentProvider",
|
||||
"AspectRatioPreviewParam",
|
||||
"EditableAvatarViewUriPreviewParam",
|
||||
"LoginModeViewErrorPreviewParam",
|
||||
"OverlapRatioPreviewParam",
|
||||
"TextFileContentPreviewParam",
|
||||
)
|
||||
.also {
|
||||
// Check that classes are actually found
|
||||
@@ -82,8 +82,7 @@ class KonsistClassNameTest {
|
||||
.removeSuffix("?")
|
||||
.replace(".", "")
|
||||
val name = klass.name
|
||||
name.endsWith("Provider") &&
|
||||
name.endsWith("PreviewProvider").not() &&
|
||||
name.endsWith("PreviewParam") &&
|
||||
name.contains(providedType)
|
||||
}
|
||||
}
|
||||
@@ -104,6 +103,7 @@ class KonsistClassNameTest {
|
||||
"FakeImageLoader",
|
||||
"FakeKeyStore",
|
||||
"FakeListenableFuture",
|
||||
"FakeParentNode",
|
||||
)
|
||||
.assertTrue {
|
||||
val interfaceName = it.name
|
||||
|
||||
@@ -23,24 +23,6 @@ class KonsistLicenseTest {
|
||||
\*/
|
||||
""".trimIndent().toRegex()
|
||||
|
||||
private val enterpriseLicense = """
|
||||
/\*
|
||||
\* © 20\d\d((, |-)20\d\d)? Element Creations Ltd\.
|
||||
(?:.*\n)* \*
|
||||
\* Element Creations Ltd, Element Software SARL, Element Software Inc\.,
|
||||
\* and Element Software GmbH \(the "Element Group"\) only make this file available
|
||||
\* under a proprietary license model\.
|
||||
\*
|
||||
\* Without a proprietary license with us, you cannot use this file\. The terms of
|
||||
\* the proprietary license agreement between you and any member of the Element Group
|
||||
\* shall always apply to your use of this file\. Unauthorised use, copying, distribution,
|
||||
\* or modification of this file, via any medium, is strictly prohibited\.
|
||||
\*
|
||||
\* For details about the licensing terms, you must either visit our website or contact
|
||||
\* a member of our sales team\.
|
||||
\*/
|
||||
""".trimIndent().toRegex()
|
||||
|
||||
@Test
|
||||
fun `assert that FOSS files have the correct license header`() {
|
||||
Konsist
|
||||
@@ -60,19 +42,6 @@ class KonsistLicenseTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `assert that Enterprise files have the correct license header`() {
|
||||
Konsist
|
||||
.scopeFromProject()
|
||||
.files
|
||||
.filter {
|
||||
it.moduleName.startsWith("enterprise")
|
||||
}
|
||||
.assertTrue {
|
||||
enterpriseLicense.containsMatchIn(it.text)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `assert that files do not have double license header`() {
|
||||
Konsist
|
||||
|
||||
@@ -98,6 +98,7 @@ class KonsistPreviewTest {
|
||||
"HomeTopBarSpaceFiltersSelectedPreview",
|
||||
"HomeTopBarSpacesPreview",
|
||||
"HomeTopBarWithIndicatorPreview",
|
||||
"HomeTopBarWithStatusPreview",
|
||||
"IconsOtherPreview",
|
||||
"MarkdownTextComposerEditPreview",
|
||||
"MatrixBadgeAtomInfoPreview",
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2026 Element Creations Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.tests.testutils
|
||||
|
||||
import com.google.common.truth.Subject
|
||||
|
||||
/**
|
||||
* A helper class to assert expected results in tests. It can be used to assert either the type of result or its value.
|
||||
*/
|
||||
data class ExpectedResult<T : Any>(
|
||||
val resultClass: Class<out T>,
|
||||
val result: T? = null,
|
||||
) {
|
||||
constructor(result: T) : this(result::class.java, result)
|
||||
}
|
||||
|
||||
fun <T : Any> Subject.match(expectedResult: ExpectedResult<T>) {
|
||||
if (expectedResult.result != null) {
|
||||
isEqualTo(expectedResult.result)
|
||||
} else {
|
||||
isInstanceOf(expectedResult.resultClass)
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2026 Element Creations Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.tests.testutils.node
|
||||
|
||||
import com.bumble.appyx.core.node.Node
|
||||
import io.element.android.libraries.architecture.AssistedNodeFactory
|
||||
import io.element.android.libraries.architecture.NodeFactoriesBindings
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
class FakeNodeFactoriesBindings(
|
||||
private val nodeFactories: Map<KClass<out Node>, AssistedNodeFactory<*>>,
|
||||
) : NodeFactoriesBindings {
|
||||
override fun nodeFactories() = nodeFactories
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2026 Element Creations Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.tests.testutils.node
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import com.bumble.appyx.core.modality.BuildContext
|
||||
import com.bumble.appyx.core.navigation.model.permanent.PermanentNavModel
|
||||
import com.bumble.appyx.core.node.Node
|
||||
import com.bumble.appyx.core.node.ParentNode
|
||||
import com.bumble.appyx.core.node.node
|
||||
import io.element.android.libraries.di.DependencyInjectionGraphOwner
|
||||
|
||||
/**
|
||||
* A Node creates its children using the dependency injection graph of its ancestors, so a Node under test
|
||||
* needs such a parent to be able to create its children.
|
||||
*/
|
||||
class FakeParentNode(
|
||||
override val graph: Any,
|
||||
) : ParentNode<Unit>(
|
||||
navModel = PermanentNavModel(navTargets = setOf(Unit), savedStateMap = null),
|
||||
buildContext = BuildContext.root(savedStateMap = null),
|
||||
),
|
||||
DependencyInjectionGraphOwner {
|
||||
override fun resolve(navTarget: Unit, buildContext: BuildContext): Node = node(buildContext) {}
|
||||
|
||||
@Composable
|
||||
override fun View(modifier: Modifier) = Unit
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.tests.testutils
|
||||
package io.element.android.tests.testutils.presenter
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2026 Element Creations Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.tests.testutils.presenter
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import io.element.android.libraries.architecture.Presenter
|
||||
|
||||
/**
|
||||
* A presenter that cannot be used, util for testing Nodes.
|
||||
*/
|
||||
class NotUsedPresenter<T> : Presenter<T> {
|
||||
@Composable
|
||||
override fun present(): T = error("Not used")
|
||||
}
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user