Merge "Disable some Indentation fix tests on Android 21/22" into androidx-main
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntegrationIndentationFixTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntegrationIndentationFixTest.kt
index 54aa03d..20fe4e3 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntegrationIndentationFixTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntegrationIndentationFixTest.kt
@@ -65,7 +65,7 @@
         }
     }
 
-    @SdkSuppress(minSdkVersion = 22) // b/269193223
+    @SdkSuppress(minSdkVersion = 23) // b/266743243
     @Test
     fun getLineLeftAndGetLineRight_Ltr_TextIndent() {
         val paragraph = paragraph(
@@ -149,7 +149,7 @@
         }
     }
 
-    @SdkSuppress(minSdkVersion = 22) // b/269193223
+    @SdkSuppress(minSdkVersion = 23) // b/266743243
     @Test
     fun getLineLeftAndGetLineRight_Ltr_TextIndent_sp_letterspacing() {
         val paragraph = paragraph(
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/LineBreakTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/LineBreakTest.kt
index d657f6a..d86dfa9 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/LineBreakTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/LineBreakTest.kt
@@ -215,7 +215,7 @@
         assertThat(brokenLines).isEqualTo(expectedBrokenLines)
     }
 
-    @SdkSuppress(minSdkVersion = 22) // b/269193836
+    @SdkSuppress(minSdkVersion = 23) // b/269193836
     @Test
     fun correct_lineBreak_paragraph_result() {
         val expectedBrokenLines = listOf(
@@ -233,7 +233,7 @@
         assertThat(brokenLines).isEqualTo(expectedBrokenLines)
     }
 
-    @SdkSuppress(minSdkVersion = 22) // b/269193836
+    @SdkSuppress(minSdkVersion = 23) // b/269193836
     @Test
     fun correct_lineBreak_heading_result() {
         val expectedBrokenLines = listOf(
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/TextLineBreaker.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/TextLineBreaker.kt
index 6f3ff165..a0f3c2a 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/TextLineBreaker.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/TextLineBreaker.kt
@@ -16,66 +16,40 @@
 
 package androidx.compose.ui.text.style
 
-import androidx.compose.ui.text.AnnotatedString
-import androidx.compose.ui.text.ExperimentalTextApi
-import androidx.compose.ui.text.MultiParagraph
-import androidx.compose.ui.text.TextLayoutInput
-import androidx.compose.ui.text.TextLayoutResult
+import androidx.compose.ui.text.AndroidParagraph
+import androidx.compose.ui.text.Paragraph
 import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.ceilToInt
 import androidx.compose.ui.text.font.createFontFamilyResolver
 import androidx.compose.ui.unit.Constraints
 import androidx.compose.ui.unit.Density
-import androidx.compose.ui.unit.IntSize
-import androidx.compose.ui.unit.LayoutDirection
-import androidx.compose.ui.unit.constrain
 import androidx.test.platform.app.InstrumentationRegistry
-import kotlin.math.ceil
 
-@OptIn(ExperimentalTextApi::class)
 open class TextLineBreaker {
-    private val defaultDensity = Density(1f)
     private val context = InstrumentationRegistry.getInstrumentation().context
     private val fontFamilyResolver = createFontFamilyResolver(context)
     private val defaultHyphens = Hyphens.None
     private val defaultLineBreak = LineBreak.Simple
+    private val density = Density(density = 1f)
 
-    private fun constructTextLayoutResult(
+    private fun paragraph(
         text: String,
         textStyle: TextStyle,
         maxWidth: Int = Constraints.Infinity
-    ): TextLayoutResult {
-        val constraints = Constraints(maxWidth = maxWidth)
-
-        val input = TextLayoutInput(
-            text = AnnotatedString(text),
-            style = textStyle,
+    ): Paragraph {
+        return AndroidParagraph(
+            text = text,
+            spanStyles = listOf(),
             placeholders = listOf(),
+            style = textStyle,
             maxLines = Int.MAX_VALUE,
-            softWrap = true,
-            overflow = TextOverflow.Visible,
-            density = defaultDensity,
-            layoutDirection = LayoutDirection.Ltr,
-            fontFamilyResolver = fontFamilyResolver,
-            constraints = constraints
-        )
-
-        val paragraph = MultiParagraph(
-            annotatedString = input.text,
-            style = input.style,
-            constraints = input.constraints,
-            density = input.density,
-            fontFamilyResolver = input.fontFamilyResolver
-        )
-
-        return TextLayoutResult(
-            layoutInput = input,
-            multiParagraph = paragraph,
-            size = constraints.constrain(
-                IntSize(
-                    ceil(paragraph.width).toInt(),
-                    ceil(paragraph.height).toInt()
-                )
-            )
+            ellipsis = false,
+            constraints = Constraints(
+                maxWidth = maxWidth,
+                maxHeight = Float.POSITIVE_INFINITY.ceilToInt()
+            ),
+            density = density,
+            fontFamilyResolver = fontFamilyResolver
         )
     }
 
@@ -85,7 +59,7 @@
         lineBreak: LineBreak = defaultLineBreak,
         maxWidth: Int
     ): List<String> {
-        val layoutResult = constructTextLayoutResult(
+        val layoutResult = paragraph(
             text = text,
             textStyle = TextStyle(hyphens = hyphens, lineBreak = lineBreak),
             maxWidth = maxWidth