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

drawRect_toCanvas() added #7197

Closed
wants to merge 2 commits into from
Closed

Conversation

Akshay2131
Copy link
Contributor

Overview

Fixed the issue "Bitmap-backed canvas.drawRect fails with paint" #7188

Proposed Changes

Earlier, the test was failing in Robolectric with the issue :

assertThat(bitmap.getPixel(0, 0)).isEqualTo(Color.WHITE); Expected :-1 Actual :-16777216

It was failing with:

canvas.drawRect(0, 0, 10, 10, paint);

It was failing to draw a rectangle on the canvas.
So, bitmap.getPixel(0, 0) was giving the old pixel value.

I changed the statement from:

canvas.drawRect(0, 0, 10, 10, paint);

to this:

canvas.drawRect(new Rect(0, 0, 10, 10), paint);

Now, it is drawing a rectangle on the canvas,
Now, the test is working properly.

I have added the test to ShadowBitmapTest.java file

@utzcoz
Copy link
Member

utzcoz commented Apr 3, 2022

@Akshay2131 It's recommend to squash all your commits locally and push it to this PR for further review and CI checking. :)

@utzcoz
Copy link
Member

utzcoz commented Apr 3, 2022

This PR also has format problem: https://github.com/robolectric/robolectric/runs/5805197715?check_suite_focus=true. It's recommended to follow https://github.com/robolectric/robolectric/wiki/Robolectric's-code-style to format code locally before pushing. And could you squash your commits to one and push it again? Because they do the one thing.

@utzcoz
Copy link
Member

utzcoz commented Apr 3, 2022

@Akshay2131 your new commit message is not recommended. After merged, the Combined push say nothing about it does. What about changing commit message to Support Canvas#drawRect with RectF?

@utzcoz
Copy link
Member

utzcoz commented Apr 3, 2022

@Akshay2131 Looks like there are some changes not related to this PR, and similar other commits on google branch or opening PR, could you remove them?

@Akshay2131
Copy link
Contributor Author

I was having issues to remove extra added files here.. So, i created a new PR that is: Support Canvas#drawRect with RectF #7210
Could you please review that and close this one.

@utzcoz
Copy link
Member

utzcoz commented Apr 4, 2022

Thanks @Akshay2131 . I will close this PR.

@utzcoz utzcoz closed this Apr 4, 2022
@Akshay2131 Akshay2131 deleted the 7188 branch April 4, 2022 05:25
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

Successfully merging this pull request may close these issues.

None yet

3 participants