aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bower <stevebower@google.com>2023-05-31 09:50:46 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-05-31 12:38:58 +0000
commit65c7f546983a76025bb000ccfbfc280dc0c2a327 (patch)
tree42b0661b71ccb398259005e576d38340718145f7
parent47e07bdbe5e1b2307fc2986e131d7f4eb65661f8 (diff)
downloadsupport-65c7f546983a76025bb000ccfbfc280dc0c2a327.tar.gz
Add default includeFontPadding tests for wear compose material
Copy of aosp/2599298 restricted to just the wear/compose/material changes (cherry picked from https://android-review.googlesource.com/q/commit:42d8f9c1881dbbbc76ea5fdf7f7efca2c4113ad8) Merged-In: I737edd967b9997de5fff260728a760ec0a747028 Change-Id: I737edd967b9997de5fff260728a760ec0a747028
-rw-r--r--wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/TextTest.kt20
-rw-r--r--wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Typography.kt15
2 files changed, 24 insertions, 11 deletions
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/TextTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/TextTest.kt
index 06bf8513575..e96362a4a3b 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/TextTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/TextTest.kt
@@ -62,6 +62,26 @@ class TextTest {
private val TestText = "TestText"
@Test
+ fun testDefaultIncludeFontPadding() {
+ var localTextStyle: TextStyle? = null
+ var display1TextStyle: TextStyle? = null
+ rule.setContent {
+ MaterialTheme {
+ localTextStyle = LocalTextStyle.current
+ display1TextStyle = LocalTypography.current.display1
+ }
+ }
+
+ assertThat(
+ localTextStyle?.platformStyle?.paragraphStyle?.includeFontPadding
+ ).isEqualTo(true)
+
+ assertThat(
+ display1TextStyle?.platformStyle?.paragraphStyle?.includeFontPadding
+ ).isEqualTo(true)
+ }
+
+ @Test
fun validateGreaterMinLinesResultsGreaterSize() {
var size1: Int = 0
var size2: Int = 0
diff --git a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Typography.kt b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Typography.kt
index 28a45ac82f8..420b8345e24 100644
--- a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Typography.kt
+++ b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Typography.kt
@@ -257,20 +257,13 @@ private fun TextStyle.withDefaultFontFamily(default: FontFamily): TextStyle {
return if (fontFamily != null) this else copy(fontFamily = default)
}
-internal val DefaultTextStyle = TextStyle.Default.copy(
- platformStyle = defaultPlatformTextStyle()
-)
-
private const val DefaultIncludeFontPadding = true
-@Suppress("DEPRECATION")
-private val DefaultPlatformTextStyle = PlatformTextStyle(
- includeFontPadding = DefaultIncludeFontPadding
+internal val DefaultTextStyle = TextStyle.Default.copy(
+ platformStyle = PlatformTextStyle(
+ includeFontPadding = DefaultIncludeFontPadding
+ )
)
-/**
- * Returns Default [PlatformTextStyle].
- */
-internal fun defaultPlatformTextStyle(): PlatformTextStyle = DefaultPlatformTextStyle
/**
* This Ambient holds on to the current definition of typography for this application as described