diff --git a/core/tests/coretests/src/android/content/res/FontScaleConverterFactoryTest.kt b/core/tests/coretests/src/android/content/res/FontScaleConverterFactoryTest.kt index ef106bc7cb73b..cd7abeea63d3a 100644 --- a/core/tests/coretests/src/android/content/res/FontScaleConverterFactoryTest.kt +++ b/core/tests/coretests/src/android/content/res/FontScaleConverterFactoryTest.kt @@ -90,9 +90,13 @@ class FontScaleConverterFactoryTest { } .forEach { (table, sp) -> try { - assertWithMessage("convertSpToDp(%s) on table: %s", sp, table) - .that(table.convertSpToDp(sp)) - .isFinite() + // Truth is slow because it creates a bunch of + // objects. Don't use it unless we need to. + if (!table.convertSpToDp(sp).isFinite()) { + assertWithMessage("convertSpToDp(%s) on table: %s", sp, table) + .that(table.convertSpToDp(sp)) + .isFinite() + } } catch (e: Exception) { throw AssertionError("Exception during convertSpToDp($sp) on table: $table", e) }