Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

canvas.drawText() produces empty bitmap #8359

Open
obfusk opened this issue Jul 16, 2023 · 0 comments
Open

canvas.drawText() produces empty bitmap #8359

obfusk opened this issue Jul 16, 2023 · 0 comments

Comments

@obfusk
Copy link

obfusk commented Jul 16, 2023

Description

Drawing a letter on a canvas with .drawText() to produce a bitmap works as expected on Android devices but produces an empty bitmap during unit tests.

This issue seems similar to #7188.

Steps to Reproduce

See code below. Adding assertFalse(bitmap1.sameAs(bitmap2)) makes the test fail; even though the bitmaps should have different colours and letters they are both blank and identical.

Robolectric & Android Version

4.10.3 & N/A

Link to a public git repo demonstrating the problem:

Code that uses .drawText() on a canvas:

https://github.com/CatimaLoyalty/Android/blob/b9d9c8d/app/src/main/java/protect/card_locker/LetterBitmap.java#L93

Test that uses that code and produces an unexpectedly empty transparent bitmap (e.g. when exported via bitmap.compress(Bitmap.CompressFormat.PNG, 100, fileOutputStream):

https://github.com/CatimaLoyalty/Android/blob/b9d9c8d/app/src/test/java/protect/card_locker/ImportExportTest.java#L758

cc @TheLastProject

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant