Loading core/tests/coretests/src/android/content/res/FontScaleConverterFactoryTest.kt +5 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.content.res import android.platform.test.annotations.Presubmit import androidx.core.util.forEach import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.LargeTest Loading @@ -27,6 +29,7 @@ import kotlin.math.floor import org.junit.Test import org.junit.runner.RunWith @Presubmit @RunWith(AndroidJUnit4::class) class FontScaleConverterFactoryTest { Loading Loading @@ -79,10 +82,10 @@ class FontScaleConverterFactoryTest { @LargeTest @Test fun allFeasibleScalesAndConversionsDoNotCrash() { generateSequenceOfFractions(-10000f..10000f, step = 0.01f) generateSequenceOfFractions(-10f..10f, step = 0.01f) .mapNotNull{ FontScaleConverterFactory.forScale(it) } .flatMap{ table -> generateSequenceOfFractions(-10000f..10000f, step = 0.01f) generateSequenceOfFractions(-2000f..2000f, step = 0.01f) .map{ Pair(table, it) } } .forEach { (table, sp) -> Loading core/tests/coretests/src/android/content/res/FontScaleConverterTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -16,11 +16,13 @@ package android.content.res import android.platform.test.annotations.Presubmit import androidx.test.ext.junit.runners.AndroidJUnit4 import com.google.common.truth.Truth.assertWithMessage import org.junit.Test import org.junit.runner.RunWith @Presubmit @RunWith(AndroidJUnit4::class) class FontScaleConverterTest { Loading core/tests/coretests/src/android/util/TypedValueTest.kt +3 −3 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.util import android.content.res.FontScaleConverterFactory import android.platform.test.annotations.Presubmit import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.LargeTest import androidx.test.filters.SmallTest Loading @@ -30,6 +31,7 @@ import kotlin.math.abs import kotlin.math.min import kotlin.math.roundToInt @Presubmit @RunWith(AndroidJUnit4::class) class TypedValueTest { @LargeTest Loading Loading @@ -223,7 +225,6 @@ class TypedValueTest { metrics.scaledDensity = 0f listOf( TypedValue.COMPLEX_UNIT_PX, TypedValue.COMPLEX_UNIT_DIP, TypedValue.COMPLEX_UNIT_SP, TypedValue.COMPLEX_UNIT_PT, Loading Loading @@ -257,8 +258,7 @@ class TypedValueTest { TypedValue.COMPLEX_UNIT_MM ) .forEach { dimenType -> // Test for every integer value in the range... for (i: Int in -(1 shl 23) until (1 shl 23)) { for (i: Int in -10000 until 10000) { assertRoundTripIsEqual(i.toFloat(), dimenType, metrics) assertRoundTripIsEqual(i - .1f, dimenType, metrics) assertRoundTripIsEqual(i + .5f, dimenType, metrics) Loading Loading
core/tests/coretests/src/android/content/res/FontScaleConverterFactoryTest.kt +5 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.content.res import android.platform.test.annotations.Presubmit import androidx.core.util.forEach import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.LargeTest Loading @@ -27,6 +29,7 @@ import kotlin.math.floor import org.junit.Test import org.junit.runner.RunWith @Presubmit @RunWith(AndroidJUnit4::class) class FontScaleConverterFactoryTest { Loading Loading @@ -79,10 +82,10 @@ class FontScaleConverterFactoryTest { @LargeTest @Test fun allFeasibleScalesAndConversionsDoNotCrash() { generateSequenceOfFractions(-10000f..10000f, step = 0.01f) generateSequenceOfFractions(-10f..10f, step = 0.01f) .mapNotNull{ FontScaleConverterFactory.forScale(it) } .flatMap{ table -> generateSequenceOfFractions(-10000f..10000f, step = 0.01f) generateSequenceOfFractions(-2000f..2000f, step = 0.01f) .map{ Pair(table, it) } } .forEach { (table, sp) -> Loading
core/tests/coretests/src/android/content/res/FontScaleConverterTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -16,11 +16,13 @@ package android.content.res import android.platform.test.annotations.Presubmit import androidx.test.ext.junit.runners.AndroidJUnit4 import com.google.common.truth.Truth.assertWithMessage import org.junit.Test import org.junit.runner.RunWith @Presubmit @RunWith(AndroidJUnit4::class) class FontScaleConverterTest { Loading
core/tests/coretests/src/android/util/TypedValueTest.kt +3 −3 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.util import android.content.res.FontScaleConverterFactory import android.platform.test.annotations.Presubmit import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.LargeTest import androidx.test.filters.SmallTest Loading @@ -30,6 +31,7 @@ import kotlin.math.abs import kotlin.math.min import kotlin.math.roundToInt @Presubmit @RunWith(AndroidJUnit4::class) class TypedValueTest { @LargeTest Loading Loading @@ -223,7 +225,6 @@ class TypedValueTest { metrics.scaledDensity = 0f listOf( TypedValue.COMPLEX_UNIT_PX, TypedValue.COMPLEX_UNIT_DIP, TypedValue.COMPLEX_UNIT_SP, TypedValue.COMPLEX_UNIT_PT, Loading Loading @@ -257,8 +258,7 @@ class TypedValueTest { TypedValue.COMPLEX_UNIT_MM ) .forEach { dimenType -> // Test for every integer value in the range... for (i: Int in -(1 shl 23) until (1 shl 23)) { for (i: Int in -10000 until 10000) { assertRoundTripIsEqual(i.toFloat(), dimenType, metrics) assertRoundTripIsEqual(i - .1f, dimenType, metrics) assertRoundTripIsEqual(i + .5f, dimenType, metrics) Loading