Status Update
Comments
pa...@google.com <pa...@google.com> #2
Hi,
I also see my text cut off when I set maxLines = 2
. Is it the same issue?
Box(
modifier =
Modifier.size(
width = 108dp,
height = 34dp,
),
contentAlignment = Alignment.Center,
) {
BasicText(
text = "text text text",
maxLines = 2,
autoSize = AutoSize.StepBased(minFontSize = 1.sp, maxFontSize = 13.sp, stepSize = 0.2.sp),
)
}
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
Author: Jossi Wolf <
Link:
Fix TextAutoSize bug with maxLines = 1
Expand for full commit details
Fix TextAutoSize bug with maxLines = 1
We were overcaching the paragraphIntrinsics in MultiParagraphLayoutCache when mutating the style. For `AutoSizeStepBased` instances with biased windows (more values smaller/bigger than the optimal), this could result in performing layout with outdated intrinsics, and thus an outdated style and font size, without surfacing this in the TextLayoutResult.
Test: New MultiParagraphLayoutCacheTests and manual testing
Relnote: Fixed a bug in BasicText with TextAutoSize and maxLines set to 1.
Fixes: 376834366
Change-Id: Ic0450c763c5d764492995b44ee1fe570246a9689
Files:
- M
compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/text/modifiers/MultiParagraphLayoutCacheTest.kt
- M
compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/MultiParagraphLayoutCache.kt
Hash: e1b712d78cc60384ed67a56c006148291ba146a6
Date: Tue Jan 07 18:52:26 2025
ap...@google.com <ap...@google.com> #4
#2, yeah, that's the same issue.
tc...@google.com <tc...@google.com> #5
Thanks @jo...@google.com for fixing this! Do you know when the fix would be available for g3 apps?
tc...@google.com <tc...@google.com> #6
Moving the internal discussion offline. The bug is fixed and the fix available in snapshot builds. We will comment on this issue when the bug fix is included in a release.
je...@google.com <je...@google.com> #7
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.foundation:foundation:1.8.0-beta01
androidx.compose.foundation:foundation-android:1.8.0-beta01
androidx.compose.foundation:foundation-jvmstubs:1.8.0-beta01
androidx.compose.foundation:foundation-linuxx64stubs:1.8.0-beta01
je...@google.com <je...@google.com> #8
A workaround that can be used if you encounter this problem in one of your tests, is to pause the clock at the beginning of the test and advance it manually whenever you need to move forward in the animations that are currently running:
@get:Rule
val composeTestRule = createComposeRule()
val clockTestRule get() = composeTestRule.clockTestRule
@Test
fun test() {
clockTestRule.pauseClock()
// ...
runOnIdle {
clockTestRule.advanceClock(1000)
}
// ...
}
ap...@google.com <ap...@google.com> #9
Branch: androidx-main
commit f0649b27c6df6fa151202e3f23913998805fb398
Author: Jelle Fresen <jellefresen@google.com>
Date: Tue Jan 26 12:06:58 2021
Add isInfinite to Animation and VectorizedAnimationSpec
Will be used to facilitate special handling of infinte animations in
tests, so the test framework won't await these animations indefinitely.
Bug: 151940543
Test: IsInfiniteTest.kt
Relnote: "Added `Animation.isInfinite` and
`VectorizedAnimationSpec.isInfinite` that signal if an animation is
infinite or not. This can be used in implementations of animations to
have special handling of such animations. For example, a special \"time
remaining\" message can be shown, or during tests the animation can be
cancelled to prevent waiting for idleness indefinitely."
Change-Id: Iebb05e9d158b4fe81d037ab28e113da4926c50cd
M compose/animation/animation-core/api/current.txt
M compose/animation/animation-core/api/public_plus_experimental_current.txt
M compose/animation/animation-core/api/restricted_current.txt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/Animation.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VectorizedAnimationSpec.kt
A compose/animation/animation-core/src/test/java/androidx/compose/animation/core/IsInfiniteTest.kt
ap...@google.com <ap...@google.com> #10
Branch: androidx-main
commit ae92240e2b212a7c0cfbccdd716efa84f3da34f2
Author: Jelle Fresen <jellefresen@google.com>
Date: Thu Jan 28 17:15:52 2021
Cancel infinite animations in tests
Infinite animations are now started through withInfiniteAnimation, which
checks the InfiniteAnimationPolicy and applies it if present when
withFrameNanos or withFrameMillis is called.
ComposeTestRule installs an InfiniteAnimationPolicy in the
applyCoroutineContext that cancels the coroutine when that policy is
applied.
This enables us to remove special handling of demos with infinite
animations in DemoTest, and we can now remove blinkingCursorEnabled.
Fixes: 151940543
Bug: 168695905
Test: ./gradlew compose:animation:animation-core:test && \
./gradlew compose:animation:animation-core:cC && \
./gradlew compose:ui:ui-test:cC
Relnote: "Introduced an `InfiniteAnimationPolicy` coroutine context
element that will be applied in infinite animations. By default no
policy is installed, except when running tests with `ComposeTestRule`."
Change-Id: I50ec421d7db495459a61c9282dbc2bfbc1f1ad02
M compose/animation/animation-core/api/current.txt
M compose/animation/animation-core/api/public_plus_experimental_current.txt
M compose/animation/animation-core/api/restricted_current.txt
M compose/animation/animation-core/src/androidAndroidTest/kotlin/androidx/compose/animation/core/InfiniteTransitionTest.kt
A compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/InfiniteAnimationPolicy.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/InfiniteTransition.kt
M compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/SuspendAnimation.kt
A compose/animation/animation-core/src/test/java/androidx/compose/animation/core/InfiniteAnimationPolicyTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldCursorTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldCursor.kt
M compose/integration-tests/demos/src/androidTest/java/androidx/compose/integration/demos/test/DemoTest.kt
M compose/integration-tests/src/main/java/androidx/ui/integration/test/core/text/TextFieldToggleTextTestCase.kt
M compose/ui/ui-test-junit4/src/androidMain/kotlin/androidx/compose/ui/test/junit4/AndroidComposeTestRule.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/InfiniteAnimationTest.kt
Description
No description yet.