Add crop coordinate unit test
This commit is contained in:
@@ -0,0 +1,16 @@
|
|||||||
|
package ru.obdai.receipt.crop
|
||||||
|
|
||||||
|
import android.graphics.Rect
|
||||||
|
import org.junit.Assert.assertEquals
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
import org.robolectric.RobolectricTestRunner
|
||||||
|
|
||||||
|
@RunWith(RobolectricTestRunner::class)
|
||||||
|
class CropHelperTest {
|
||||||
|
@Test
|
||||||
|
fun scalesBitmapBoundsToViewBounds() {
|
||||||
|
val result = CropHelper.scaleToView(Rect(100, 200, 500, 600), 1000, 1000, 500, 1000)
|
||||||
|
assertEquals(Rect(50, 200, 250, 600), result)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user