assertIsEqualTo

Function

Common
fun Dp.assertIsEqualTo(expected: Dp, subject: String, tolerance: Dp = Dp(.5f))

Asserts that this value is equal to the given expected value.

Performs the comparison with the given tolerance or the default one if none is provided. It is recommended to use tolerance when comparing positions and size coming from the framework as there can be rounding operation performed by individual layouts so the values can be slightly off from the expected ones.

Parameters

expectedThe expected value to which this one should be equal to.
subjectUsed in the error message to identify which item this assertion failed on.
toleranceThe tolerance within which the values should be treated as equal.