Merge "FontScaleConverterFactoryTest: 15x perf increase" into udc-dev

This commit is contained in:
Tyler Freeman
2023-03-03 16:55:52 +00:00
committed by Android (Google) Code Review

View File

@@ -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)
}