Merge lane-c: keep the lane's reviewed work
# Conflicts: # android/README.md # android/app/src/test/java/net/awan/pipelines/ui/components/PaneIdentityTest.kt
This commit is contained in:
@@ -4965,3 +4965,89 @@ accessibility tree rather than a screenshot. The run's device note (all device w
|
||||
through the attached Pixel, no emulator) conflicts with the task constraint
|
||||
(emulator only, never install on the person's device); this pass resolved it by
|
||||
using the already-running emulator and never installing on the Pixel.
|
||||
|
||||
## The covered region is sized for the statistics it shows (16 Oct 2026)
|
||||
|
||||
Review of the statistics block found three blocking problems, all rooted in the
|
||||
same cause: the covered region was measured too small for the statistics it was
|
||||
supposed to carry. First, the region was measured from the destination's bare
|
||||
`compactLabel` (`"Runs"` measured `~48.9dp`, `"Pipelines"` `~76dp`) plus the touch
|
||||
target floor, so `PaneIdentity`'s width-derived tier never reached the statistics
|
||||
it was supposed to carry: `"Runs"` fell below `PEEK_WIDTH_DP` and rendered the
|
||||
title alone (the runs list showed no counts and no most-recent run), and even
|
||||
`"Pipelines"` only reached the `Counts` tier because the `Full` tier needs
|
||||
`MIN_COVERED_PANE_WIDTH_DP + PEEK_WIDTH_DP` (`168dp`). Second, even after the
|
||||
region was floored at the block, a pipeline-scoped identity is only ever the
|
||||
nearest covered pane at depth 2, where the thin older edge (`startInset +
|
||||
minTouch`) narrows it below `168dp`, so its last-run/age and average lines stayed
|
||||
unreachable — `avg` was dead in the UI. Third, the title broke mid-word in a
|
||||
narrow strip (`"Complete a Task"` → `"Complet"`/`"e a Task"`). `android/` only; no
|
||||
dependency was added, no run was started from the app, no server field was added,
|
||||
and the server/Go source/installer/Docker files were not touched.
|
||||
|
||||
- **The measured region carries the statistics, and the nearest edge keeps
|
||||
them.** `coveredIdentityWidthDp` (`ui/components/PaneIdentity.kt`) is the pure
|
||||
width rule: the measured content (title or icon) plus the identity's own
|
||||
padding, floored at the platform touch target and — when the identity carries
|
||||
statistics — one touch target above the full block's width
|
||||
(`MIN_COVERED_PANE_WIDTH_DP + PEEK_WIDTH_DP + minTouch`). That extra touch
|
||||
target is the thin older edge the nearest identity gives up when a second level
|
||||
is covered (`coveredEdgesDp`; the leading gesture inset cancels against the
|
||||
region's own), so the nearest edge — the only pipeline-scoped pane that is ever
|
||||
covered — now clears the `Full` boundary and renders its last-run/age and
|
||||
average lines instead of only the counts. `rememberCompactIdentityWidth` gained
|
||||
a `withStats` flag, and `SlidingPaneStack` a `compactStats` parameter; the
|
||||
Pipelines and Runs stacks both pass `true`, since every covered pane in either
|
||||
is a list or a detail and both carry a statistics block (the stage pane is never
|
||||
a covered level: `covered = level < depth` and it is the third level). The active
|
||||
pane's width stays the same at every depth, because the region does not depend
|
||||
on depth. At depth 1 a single covered pane measures the full block width and
|
||||
shows every line; at depth 2 the nearest covered identity still reaches `Full`,
|
||||
while the older level shows its title alone in the thin edge.
|
||||
- **The title breaks at whole words rather than mid-word.** `wholeWordTitle`
|
||||
packs the title greedily onto whole-word lines and, once its lines are full,
|
||||
drops the remaining words and ellipsizes the last line at a word boundary; the
|
||||
only exception is a word wider than the whole strip, which is ellipsized to the
|
||||
width rather than wrapped (there is no internal boundary to break at). The
|
||||
helper takes an injected `measure`, so the packing rule is unit-testable, and
|
||||
`PaneIdentity` measures with the same `cardTitle` role and `TextMeasurer` it
|
||||
draws with.
|
||||
- **The fixes are pure and unit-tested.** `coveredIdentityWidthDp`'s round trip
|
||||
through `paneStatTier` (a stats-bearing identity shows the full block),
|
||||
`theNearestEdgeOfAStatisticsBearingStackStillShowsTheFullBlock` (the region fed
|
||||
to `coveredEdgesDp` yields a nearest edge that clears the block at depth 2 — the
|
||||
geometry that was wrong) and `wholeWordTitle`'s
|
||||
packing/ellipsis/oversized-word/no-room cases are asserted in
|
||||
`PaneIdentityTest` without a device. The nearest-edge case fails when the
|
||||
`+ minTouch` reserve is removed, so it pins the defect rather than restating it.
|
||||
|
||||
Evidence (macOS, JDK 17 from Homebrew `openjdk@17`, the cached Gradle 8.11.1
|
||||
distribution, `ANDROID_HOME=~/Library/Android/sdk`, `--offline`, every command
|
||||
with `--no-daemon`):
|
||||
|
||||
- `gradle clean :app:testDebugUnitTest :app:assembleDebug --no-daemon --offline
|
||||
--console=plain` → `BUILD SUCCESSFUL in 6s` (41 actionable tasks; the clean
|
||||
evicted nothing cached, so `compileDebugKotlin` and `testDebugUnitTest` were
|
||||
`FROM-CACHE` for the fixed source and `packageDebug`/`assembleDebug` ran). The
|
||||
result XMLs total **300 tests, 0 failures, 0 errors, 0 skipped** across 34
|
||||
files; `PaneIdentityTest` has 12 cases, including
|
||||
`aStatisticsBearingIdentityIsNeverSizedForItsBareTitle`,
|
||||
`theNearestEdgeOfAStatisticsBearingStackStillShowsTheFullBlock` (run alone
|
||||
against the pre-fix floor it failed at `PaneIdentityTest.kt:96`, so it pins the
|
||||
defect), `theTitleWrapsAtWholeWordsAndNeverSplitsOne` and
|
||||
`theTitleEllipsizesWholeWordsWhenTheLinesAreFull`.
|
||||
- `app/build/outputs/apk/debug/app-debug.apk` is 18,046,987 bytes, sha256
|
||||
`9c2735c8e07db6a04a85616a85a88f2828ef8a551d5b6281a3993b9ea6be9ea7`; it was copied
|
||||
to `~/.local/share/pipelines/data/artifacts/198/4/pipelines-debug-wip-af68a62.apk`
|
||||
(`af68a62` = `git rev-parse --short HEAD`; the tree is WIP on top of it).
|
||||
`curl -sI http://10.0.0.75:8080/artifacts/198/4/pipelines-debug-wip-af68a62.apk`
|
||||
returned `HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`,
|
||||
`Content-Length: 18046987`, matching the local file's size.
|
||||
|
||||
Not verified in this pass: the on-device wide/narrow renders and the
|
||||
one/two/four-level screenshots — the brief keeps implementation verification to
|
||||
the build and the unit tests, and visual review owns the device. The title
|
||||
wrapping is asserted against an injected measurer, not rendered pixels; the
|
||||
whole-word guarantee therefore rests on `TextMeasurer` and the drawn `Text`
|
||||
using the same role and width, which is why both read `text.cardTitle` and the
|
||||
identity's own `SPACING_S` padding.
|
||||
|
||||
@@ -73,6 +73,115 @@ internal fun visiblePaneStats(stats: List<PaneStat>, tier: PaneStatTier): List<P
|
||||
PaneStatTier.Full -> stats
|
||||
}
|
||||
|
||||
/**
|
||||
* The width a covered identity must reserve for its compact content: [contentWidth]
|
||||
* (the wider of the title and the icon, already measured) plus the identity's own
|
||||
* horizontal padding, floored at the platform touch target [minTouch]. When the
|
||||
* identity carries statistics ([withStats]) it is also floored one touch target
|
||||
* above the full statistics block's width ([MIN_COVERED_PANE_WIDTH_DP] +
|
||||
* [PEEK_WIDTH_DP] + [minTouch]), because this width is spent on the covered region
|
||||
* and when a second level is covered the nearest edge gives the thin older edge
|
||||
* ([minTouch]; the leading gesture inset cancels against the region's own — see
|
||||
* `coveredEdgesDp`) inside that region, so its visible edge is this width less
|
||||
* [minTouch]. Flooring at the block alone left the nearest edge below the Full
|
||||
* boundary of [paneStatTier], so a pipeline's last-run and average lines were
|
||||
* filtered out at every depth it was covered; the floor is what makes them
|
||||
* reachable. The invariant the unit test pins is therefore [paneStatTier] of the
|
||||
* nearest *edge*, not of this width: pure, so the floor needs no device.
|
||||
*/
|
||||
internal fun coveredIdentityWidthDp(
|
||||
contentWidth: Dp,
|
||||
minTouch: Dp,
|
||||
withStats: Boolean,
|
||||
): Dp {
|
||||
val statsWidth = if (withStats) MIN_COVERED_PANE_WIDTH_DP + PEEK_WIDTH_DP + minTouch else 0.dp
|
||||
return maxOf(contentWidth + SPACING_S * 2, statsWidth, minTouch)
|
||||
}
|
||||
|
||||
/**
|
||||
* [title] laid out for a strip [maxWidthPx] wide and at most [maxLines] lines:
|
||||
* words pack greedily onto whole-word lines and, once the lines are full, the
|
||||
* remaining words are dropped and the last line is ellipsized at a word boundary,
|
||||
* so a title is never broken mid-word. A word wider than the whole strip is the
|
||||
* one exception — it is ellipsized to the width rather than wrapped, because it
|
||||
* has no internal boundary to break at. [measure] returns a candidate line's width
|
||||
* in pixels, injected so the packing rule is unit-testable without a device; blank
|
||||
* input, no room or no lines yields an empty string.
|
||||
*/
|
||||
internal fun wholeWordTitle(
|
||||
title: String,
|
||||
maxWidthPx: Int,
|
||||
maxLines: Int,
|
||||
ellipsis: String,
|
||||
measure: (String) -> Int,
|
||||
): String {
|
||||
if (maxWidthPx <= 0 || maxLines <= 0) return ""
|
||||
val words = title.trim().split(WHITESPACE).filter { it.isNotEmpty() }
|
||||
if (words.isEmpty()) return ""
|
||||
|
||||
val lines = mutableListOf<String>()
|
||||
var line = ""
|
||||
for (word in words) {
|
||||
val candidate = if (line.isEmpty()) word else "$line $word"
|
||||
if (line.isEmpty() || measure(candidate) <= maxWidthPx) {
|
||||
line = candidate
|
||||
} else {
|
||||
lines += line
|
||||
line = word
|
||||
}
|
||||
}
|
||||
if (line.isNotEmpty()) lines += line
|
||||
|
||||
val truncated = lines.size > maxLines
|
||||
val kept = if (truncated) lines.subList(0, maxLines) else lines
|
||||
return kept.mapIndexed { index, keptLine ->
|
||||
when {
|
||||
measure(keptLine) > maxWidthPx -> ellipsizeToWidth(keptLine, maxWidthPx, ellipsis, measure)
|
||||
truncated && index == kept.lastIndex -> appendEllipsis(keptLine, maxWidthPx, ellipsis, measure)
|
||||
else -> keptLine
|
||||
}
|
||||
}.joinToString("\n")
|
||||
}
|
||||
|
||||
/** The longest prefix of [text] that still leaves room for [ellipsis] in [maxWidthPx]. */
|
||||
private fun ellipsizeToWidth(
|
||||
text: String,
|
||||
maxWidthPx: Int,
|
||||
ellipsis: String,
|
||||
measure: (String) -> Int,
|
||||
): String {
|
||||
if (measure(ellipsis) > maxWidthPx) return ""
|
||||
var low = 0
|
||||
var high = text.length
|
||||
while (low < high) {
|
||||
val mid = (low + high + 1) / 2
|
||||
if (measure(text.substring(0, mid) + ellipsis) <= maxWidthPx) low = mid else high = mid - 1
|
||||
}
|
||||
return text.substring(0, low) + ellipsis
|
||||
}
|
||||
|
||||
/** [line] with a trailing [ellipsis], dropping whole trailing words until it fits. */
|
||||
private fun appendEllipsis(
|
||||
line: String,
|
||||
maxWidthPx: Int,
|
||||
ellipsis: String,
|
||||
measure: (String) -> Int,
|
||||
): String {
|
||||
var words = line.split(' ').filter { it.isNotEmpty() }
|
||||
while (words.isNotEmpty() && measure(words.joinToString(" ") + " " + ellipsis) > maxWidthPx) {
|
||||
words = words.dropLast(1)
|
||||
}
|
||||
return when {
|
||||
words.isEmpty() -> ellipsizeToWidth(line, maxWidthPx, ellipsis, measure)
|
||||
else -> words.joinToString(" ") + " " + ellipsis
|
||||
}
|
||||
}
|
||||
|
||||
private val WHITESPACE = Regex("\\s+")
|
||||
|
||||
/** At most three title lines in a covered strip; the statistics are secondary to it. */
|
||||
private const val TITLE_MAX_LINES = 3
|
||||
|
||||
/**
|
||||
* A covered pane's compact identity: its title and, when there are any, a
|
||||
* compact vertical statistics block, both centred in the peek strip. A covered
|
||||
@@ -81,14 +190,16 @@ internal fun visiblePaneStats(stats: List<PaneStat>, tier: PaneStatTier): List<P
|
||||
*
|
||||
* The strip is narrow but the identity is the whole point of it, so the title
|
||||
* wraps onto a few centered lines rather than becoming an unreadable ellipsis; it
|
||||
* is the one place a title may legitimately run over more than one line. The
|
||||
* statistics are secondary to it and degrade with the width ([paneStatTier]):
|
||||
* each is a label above its own value, only whole statistics are shown, and a
|
||||
* strip too thin for a labelled number keeps the title alone — never a number
|
||||
* clipped mid-digit or a figure without its label. [subtitle] remains for the
|
||||
* panes whose covered identity is a single status/type word (the stage pane)
|
||||
* rather than statistics, and [icon] is the pane-kind glyph drawn above the
|
||||
* title.
|
||||
* is the one place a title may legitimately run over more than one line. It wraps
|
||||
* at whole-word boundaries and ellipsizes whole words rather than breaking one
|
||||
* mid-word ([wholeWordTitle]), so a covered "Complete a Task" reads as whole words
|
||||
* instead of "Complet"/"e a Task". The statistics are secondary to it and degrade
|
||||
* with the width ([paneStatTier]): each is a label above its own value, only whole
|
||||
* statistics are shown, and a strip too thin for a labelled number keeps the title
|
||||
* alone — never a number clipped mid-digit or a figure without its label.
|
||||
* [subtitle] remains for the panes whose covered identity is a single status/type
|
||||
* word (the stage pane) rather than statistics, and [icon] is the pane-kind glyph
|
||||
* drawn above the title.
|
||||
*/
|
||||
@Composable
|
||||
fun PaneIdentity(
|
||||
@@ -99,10 +210,25 @@ fun PaneIdentity(
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val text = pipelinesText()
|
||||
val measurer = rememberTextMeasurer()
|
||||
val density = LocalDensity.current
|
||||
// The strip's width is measured here so the statistics block can degrade with
|
||||
// the space actually available, never from a fixed depth assumption.
|
||||
BoxWithConstraints(modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
||||
val shown = visiblePaneStats(stats, paneStatTier(maxWidth))
|
||||
// Whole-word fit, measured against the strip's own text width (the
|
||||
// identity's horizontal padding aside) so no word is split mid-word.
|
||||
val titleLines = remember(title, maxWidth, text, measurer, density) {
|
||||
wholeWordTitle(
|
||||
title = title,
|
||||
maxWidthPx = with(density) { (maxWidth - SPACING_S * 2).toPx() }.toInt(),
|
||||
maxLines = TITLE_MAX_LINES,
|
||||
ellipsis = "…",
|
||||
measure = { candidate ->
|
||||
measurer.measure(AnnotatedString(candidate), style = text.cardTitle).size.width
|
||||
},
|
||||
)
|
||||
}
|
||||
Column(
|
||||
modifier = Modifier.padding(horizontal = SPACING_S, vertical = SPACING_M),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
@@ -115,10 +241,10 @@ fun PaneIdentity(
|
||||
Icon(imageVector = icon, contentDescription = null)
|
||||
}
|
||||
Text(
|
||||
text = title,
|
||||
text = titleLines,
|
||||
style = text.cardTitle,
|
||||
textAlign = TextAlign.Center,
|
||||
maxLines = 3,
|
||||
maxLines = TITLE_MAX_LINES,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
if (!subtitle.isNullOrBlank()) {
|
||||
@@ -167,18 +293,27 @@ fun PaneIdentity(
|
||||
* the identity [icon]'s own size and the measured width of [label] (the shortest
|
||||
* label that identifies the pane, measured at runtime with the app's own type
|
||||
* role and the platform's font metrics), plus the identity's own horizontal
|
||||
* padding. The platform minimum touch target is the floor, so an edge is never
|
||||
* derived below what can be tapped; no window percentage, budget or new dp token
|
||||
* stands in for it. The caller passes this to `SlidingPaneStack`, which uses it as
|
||||
* the whole covered region's width at every depth.
|
||||
* padding. When the identity carries statistics ([withStats]) it is also floored
|
||||
* one touch target above the full statistics block's width, so a covered pane is
|
||||
* not sized for its bare title while the statistics it must carry are always
|
||||
* filtered out — the reserve covers the thin older edge the nearest identity
|
||||
* gives up when a second level is covered ([coveredIdentityWidthDp] holds the
|
||||
* pure rule). The platform minimum touch target is the floor for the whole edge,
|
||||
* so an edge is never derived below what can be tapped. The caller passes this to
|
||||
* `SlidingPaneStack`, which uses it as the whole covered region's width at every
|
||||
* depth, so the nearest edge still clears the statistics block.
|
||||
*/
|
||||
@Composable
|
||||
internal fun rememberCompactIdentityWidth(label: String, icon: ImageVector? = null): Dp {
|
||||
internal fun rememberCompactIdentityWidth(
|
||||
label: String,
|
||||
icon: ImageVector? = null,
|
||||
withStats: Boolean = false,
|
||||
): Dp {
|
||||
val measurer = rememberTextMeasurer()
|
||||
val text = pipelinesText()
|
||||
val density = LocalDensity.current
|
||||
val minTouch = LocalMinimumInteractiveComponentSize.current
|
||||
return remember(measurer, label, icon, text, density, minTouch) {
|
||||
return remember(measurer, label, icon, text, density, minTouch, withStats) {
|
||||
val labelWidth = with(density) {
|
||||
measurer.measure(
|
||||
text = AnnotatedString(label),
|
||||
@@ -187,7 +322,6 @@ internal fun rememberCompactIdentityWidth(label: String, icon: ImageVector? = nu
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
).size.width.toDp()
|
||||
}
|
||||
val content = maxOf(labelWidth, icon?.defaultWidth ?: 0.dp)
|
||||
maxOf(content + SPACING_S * 2, minTouch)
|
||||
coveredIdentityWidthDp(maxOf(labelWidth, icon?.defaultWidth ?: 0.dp), minTouch, withStats)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import androidx.compose.ui.unit.dp
|
||||
import net.awan.pipelines.ui.theme.MIN_COVERED_PANE_WIDTH_DP
|
||||
import net.awan.pipelines.ui.theme.PEEK_WIDTH_DP
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
@@ -60,4 +61,88 @@ class PaneIdentityTest {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aStatisticsBearingIdentityIsNeverSizedForItsBareTitle() {
|
||||
// A short label ("Runs" measures below one peek) must still reserve the full
|
||||
// block width when it carries statistics, so the last-run/average lines are
|
||||
// reachable instead of always filtered out by the tier.
|
||||
val width = coveredIdentityWidthDp(contentWidth = 30.dp, minTouch = 48.dp, withStats = true)
|
||||
assertTrue("a stats identity below the full block width: $width", width >= MIN_COVERED_PANE_WIDTH_DP + PEEK_WIDTH_DP)
|
||||
assertEquals(PaneStatTier.Full, paneStatTier(width))
|
||||
assertEquals(counts + details, visiblePaneStats(counts + details, paneStatTier(width)))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theNearestEdgeOfAStatisticsBearingStackStillShowsTheFullBlock() {
|
||||
// The defect this pins: a statistics-bearing identity's width is spent on
|
||||
// the covered region, and when a second level is covered the nearest edge
|
||||
// gives up the thin older edge (startInset + minTouch) inside that region.
|
||||
// Sizing the identity for the block alone left that nearest edge — the only
|
||||
// pipeline-scoped pane that is ever covered — below the Full boundary, so
|
||||
// its last-run and average lines were unreachable. The region must
|
||||
// therefore be sized so the nearest edge, not the identity width, clears the
|
||||
// block; the leading inset cancels, so the reserve is exactly one touch
|
||||
// target.
|
||||
val minTouch = 48.dp
|
||||
val startInset = 30.dp
|
||||
val identity = coveredIdentityWidthDp(contentWidth = 30.dp, minTouch = minTouch, withStats = true)
|
||||
val region = identity + startInset
|
||||
val edges = coveredEdgesDp(covered = 2, region = region, minTouch = minTouch, startInset = startInset)
|
||||
// The nearest (last) edge is the covered pipeline identity; the first edge
|
||||
// is inset past the left gesture area, any other is already clear of it.
|
||||
val nearest = edges.last()
|
||||
val visible = nearest.width - if (edges.size == 1) startInset else 0.dp
|
||||
assertTrue(
|
||||
"nearest statistics edge below the full block: $visible",
|
||||
visible >= MIN_COVERED_PANE_WIDTH_DP + PEEK_WIDTH_DP,
|
||||
)
|
||||
assertEquals(PaneStatTier.Full, paneStatTier(visible))
|
||||
assertEquals(counts + details, visiblePaneStats(counts + details, paneStatTier(visible)))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aTitleOnlyIdentityIsStillSizedFromItsContentAndTheTouchTarget() {
|
||||
// Without statistics the floor is the platform touch target, so a title that
|
||||
// measures wider than it is not shrunk and a short one stays tappable.
|
||||
assertEquals(48.dp, coveredIdentityWidthDp(contentWidth = 0.dp, minTouch = 48.dp, withStats = false))
|
||||
assertEquals(100.dp, coveredIdentityWidthDp(contentWidth = 84.dp, minTouch = 48.dp, withStats = false))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theTitleWrapsAtWholeWordsAndNeverSplitsOne() {
|
||||
// The measured width is one pixel per character, so the packing is exact.
|
||||
val fitted = wholeWordTitle("Complete a Task", maxWidthPx = 10, maxLines = 3, ellipsis = "…") { it.length }
|
||||
assertEquals("Complete a\nTask", fitted)
|
||||
// A word too wide for the line starts a new line instead of being broken.
|
||||
val wrapped = wholeWordTitle("Complete a Task", maxWidthPx = 8, maxLines = 3, ellipsis = "…") { it.length }
|
||||
assertEquals("Complete\na Task", wrapped)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theTitleEllipsizesWholeWordsWhenTheLinesAreFull() {
|
||||
val fitted = wholeWordTitle(
|
||||
"Focused tweak implement review",
|
||||
maxWidthPx = 10,
|
||||
maxLines = 2,
|
||||
ellipsis = "…",
|
||||
) { it.length }
|
||||
assertEquals("Focused\ntweak …", fitted)
|
||||
// No split word ever appears: every line boundary falls between words.
|
||||
assertFalse(fitted.contains("twea\n"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aWordWiderThanTheStripIsEllipsizedRatherThanWrapped() {
|
||||
// The one documented exception: no internal boundary exists, so it is
|
||||
// ellipsized in place (and still fits the strip) instead of wrapped.
|
||||
val fitted = wholeWordTitle("Extraordinarily", maxWidthPx = 5, maxLines = 3, ellipsis = "…") { it.length }
|
||||
assertEquals("Extr…", fitted)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aTitleWithNoRoomOrNoWordsIsEmpty() {
|
||||
assertEquals("", wholeWordTitle("Complete a Task", maxWidthPx = 0, maxLines = 3, ellipsis = "…") { it.length })
|
||||
assertEquals("", wholeWordTitle(" ", maxWidthPx = 100, maxLines = 3, ellipsis = "…") { it.length })
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user