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) -> .forEach { (table, sp) ->
try { try {
assertWithMessage("convertSpToDp(%s) on table: %s", sp, table) // Truth is slow because it creates a bunch of
.that(table.convertSpToDp(sp)) // objects. Don't use it unless we need to.
.isFinite() if (!table.convertSpToDp(sp).isFinite()) {
assertWithMessage("convertSpToDp(%s) on table: %s", sp, table)
.that(table.convertSpToDp(sp))
.isFinite()
}
} catch (e: Exception) { } catch (e: Exception) {
throw AssertionError("Exception during convertSpToDp($sp) on table: $table", e) throw AssertionError("Exception during convertSpToDp($sp) on table: $table", e)
} }