7b39f6c20f56

fix: ghost watermark uses full title not single character — ghostWatermarkText helper, single-line clip overflow; GhostWatermarkTest 2 tests; v2.2.5 (152 tests)

time
2026-06-10 12:19 UTC · 5 months ago
machine
koh2
agent
claude-opus-4-8
session
qa fix sprint v2.2.5
parent
fc0b65bb6ab2
2 files app/src/main/java/com/peachpasswords/ui/vault/EntryDetailScreen.kt+16 −3app/src/test/java/com/peachpasswords/ui/vault/GhostWatermarkTest.kt+21 −0
app/src/main/java/com/peachpasswords/ui/vault/EntryDetailScreen.kt+16 −3
@@ -46,6 +46,7 @@4646 import androidx.compose.ui.Alignment4747 import androidx.compose.ui.Modifier4848 import androidx.compose.ui.draw.clip49+import androidx.compose.ui.draw.clipToBounds4950 import androidx.compose.ui.draw.drawBehind5051 import androidx.compose.ui.geometry.Offset5152 import androidx.compose.ui.geometry.Size@@ -54,6 +55,7 @@5455 import androidx.compose.ui.graphics.graphicsLayer5556 import androidx.compose.ui.platform.LocalContext5657 import androidx.compose.ui.text.TextStyle58+import androidx.compose.ui.text.style.TextOverflow5759 import androidx.compose.ui.unit.dp5860 import androidx.compose.ui.unit.em5961 import androidx.compose.ui.unit.sp@@ -180,12 +182,17 @@180182                 Modifier.fillMaxSize().verticalScroll(rememberScrollState())181183                     .padding(horizontal = 24.dp),182184             ) {183-                // Hero — ghost PeachScript watermark behind the entry name.184-                Box(Modifier.fillMaxWidth()) {185+                // Hero — ghost PeachScript watermark behind the entry name. The full186+                // title is drawn (not just its first letter); a long title overflows187+                // and clips naturally, which is the intended watermark behavior.188+                Box(Modifier.fillMaxWidth().clipToBounds()) {185189                     Text(186-                        text = e.title.firstOrNull()?.uppercase() ?: "P",190+                        text = ghostWatermarkText(e.title),187191                         style = TextStyle(fontFamily = PeachType.Script, fontSize = 140.sp),188192                         color = peachColors.T0.copy(alpha = 0.03f),193+                        maxLines = 1,194+                        softWrap = false,195+                        overflow = TextOverflow.Clip,189196                         modifier = Modifier.align(Alignment.TopCenter).offset(y = (-16).dp),190197                     )191198                     Column(Modifier.fillMaxWidth().padding(top = 18.dp)) {@@ -338,6 +345,12 @@338345         Row(verticalAlignment = Alignment.CenterVertically, content = content)339346     }340347 }348+349+/**350+ * Text for the ghost PeachScript watermark behind the entry name: the full title,351+ * falling back to "P" for a blank title so the hero never renders empty.352+ */353+internal fun ghostWatermarkText(title: String): String = title.ifBlank { "P" }341354 342355 private fun com.peachpasswords.vault.VaultEntry.displayDomain(): String {343356     val raw = url

view file

app/src/test/java/com/peachpasswords/ui/vault/GhostWatermarkTest.kt+21 −0
@@ -0,0 +1,21 @@1+package com.peachpasswords.ui.vault2+3+import org.junit.Assert.assertEquals4+import org.junit.Test5+6+class GhostWatermarkTest {7+8+    /** The watermark is the FULL title, not just its first character (brief Fix 4). */9+    @Test fun entry_detail_ghost_watermark_is_full_title() {10+        assertEquals("GitHub", ghostWatermarkText("GitHub"))11+        assertEquals("My Bank Account", ghostWatermarkText("My Bank Account"))12+        // Multi-byte / emoji titles pass through whole, never truncated to one glyph.13+        assertEquals("日本語メモ", ghostWatermarkText("日本語メモ"))14+    }15+16+    /** A blank title falls back to "P" so the hero never renders empty. */17+    @Test fun blank_title_falls_back_to_p() {18+        assertEquals("P", ghostWatermarkText(""))19+        assertEquals("P", ghostWatermarkText("   "))20+    }21+}

view file