diff options
| author | 2023-03-03 16:55:52 +0000 | |
|---|---|---|
| committer | 2023-03-03 16:55:52 +0000 | |
| commit | 6e374e9b2169ec7bd2ea644bce4fc9304522493d (patch) | |
| tree | 55f10c7eb973ba7958edaf1cf110f8d41e7c9f6a | |
| parent | 4c8b08a0868aec9476107ab01da20cbb92401807 (diff) | |
| parent | 9753dd74387884987c6ea801dc146a2baec86001 (diff) | |
Merge "FontScaleConverterFactoryTest: 15x perf increase" into udc-dev
| -rw-r--r-- | core/tests/coretests/src/android/content/res/FontScaleConverterFactoryTest.kt | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/core/tests/coretests/src/android/content/res/FontScaleConverterFactoryTest.kt b/core/tests/coretests/src/android/content/res/FontScaleConverterFactoryTest.kt index ee1b2aa9a259..e48f8a01d738 100644 --- a/core/tests/coretests/src/android/content/res/FontScaleConverterFactoryTest.kt +++ b/core/tests/coretests/src/android/content/res/FontScaleConverterFactoryTest.kt @@ -132,9 +132,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) } |