feat(android): T-AND-007/008 连接页/运行页/关于页 + 骨架叠加

This commit is contained in:
2026-09-14 20:40:16 +08:00
parent 5737a66afd
commit 8f0eeb7697
9 changed files with 1177 additions and 0 deletions
@@ -0,0 +1,76 @@
package com.opendance.studio
import com.opendance.studio.ui.Credits
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
/**
* T-AND-008:开源声明一致性与完整性
*
* 文档 §8.2 列出的最低 10 项必须全部声明;每条都必须有许可证与 https 源链接。
* 客户端「关于」页与 THIRD_PARTY.md、contracts/open-source-credits.md 三处一致。
*/
class CreditsTest {
private val requiredNames = listOf(
"MediaPipe", "Three.js", "@pixiv/three-vrm", "Assimp", "Godot Engine",
"godot-vrm", "NestJS", "TypeORM", "OkHttp", "bvh",
)
@Test
fun coversDocumentedMinimumSet() {
val names = Credits.ENTRIES.map { it.name }
for (required in requiredNames) {
assertTrue("文档要求的开源项目「$required」必须声明", names.contains(required))
}
assertTrue("声明条目不少于 10 项", Credits.entryCount() >= 10)
}
@Test
fun everyEntryHasLicenseAndHttpsLink() {
for (entry in Credits.ENTRIES) {
assertTrue("${entry.name} 有许可证", entry.license.isNotBlank())
assertTrue("${entry.name} 的源链接为 https", entry.url.startsWith("https://"))
assertTrue("${entry.name} 注明了用途", entry.usage.isNotBlank())
}
}
@Test
fun knownLicensesAreCorrect() {
val expected = mapOf(
"MediaPipe" to "Apache License 2.0",
"Godot Engine" to "MIT",
"Assimp" to "BSD-3-Clause",
"OkHttp" to "Apache License 2.0",
"CameraX" to "Apache License 2.0",
"Jetpack Compose" to "Apache License 2.0",
"bvh" to "MIT",
)
for (entry in Credits.ENTRIES) {
expected[entry.name]?.let { license ->
assertEquals("${entry.name} 的许可证", license, entry.license)
}
}
}
@Test
fun thisAppOwnDependenciesAreDeclared() {
// 本端实际引入的运行时依赖必须出现在声明里
val names = Credits.ENTRIES.map { it.name }
for (own in listOf("MediaPipe", "OkHttp", "CameraX", "Jetpack Compose")) {
assertTrue("本端依赖「$own」必须声明", names.contains(own))
}
}
@Test
fun entryNamesAreUnique() {
val names = Credits.ENTRIES.map { it.name }
assertEquals("开源项目名不得重复", names.size, names.toSet().size)
}
@Test
fun contractVersionIsPinned() {
assertEquals("契约版本必须与 opendance-web v0.1.0 对齐", "0.1.0", Credits.CONTRACT_VERSION)
}
}