Last active
August 17, 2022 18:48
-
-
Save veena14cs/8b26545ffb7f16d0487fe473603e6046 to your computer and use it in GitHub Desktop.
Create bitmap in test class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val displayLocale = createDisplayLocaleImpl(EGYPT_ARABIC_CONTEXT) | |
val width: Int = context.resources.displayMetrics.widthPixels | |
val height: Int = context.resources.displayMetrics.heightPixels | |
val conf = Bitmap.Config.ARGB_8888 | |
val bmp = Bitmap.createBitmap(width, height, conf) | |
val canvas = Canvas(bmp) | |
val paint = Paint() | |
canvas.drawBitmap(bmp, Matrix(), paint); | |
val shadowCanvas = shadowOf(canvas) | |
shadowCanvas.setWidth(960) | |
val x = 960 | |
val dir = -1 | |
bulletSpan0.drawLeadingMargin( | |
canvas, paint, x, dir, 0, 0, 96, htmlResult, | |
htmlResult.getSpanStart(bulletSpan0), | |
htmlResult.getSpanEnd(bulletSpan0), | |
true, | |
mock(Layout::class.java) | |
) | |
assertThat(shadowCanvas.getDrawnCircle(0).centerX).isWithin(1e-5f).of(-73.0f) | |
assertThat(shadowCanvas.getDrawnCircle(0).centerY).isWithin(1e-5f).of(48.0f) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment