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

Move ImageSemanticsMapper reflection functions into ReflectionUtils #2419

Merged
merged 1 commit into from
Nov 28, 2024

Conversation

ambushwork
Copy link
Member

What does this PR do?

This is a follow up commit of this PR
Move ImageSemanticsMapper reflection functions into ReflectionUtils

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@@ -97,4 +112,39 @@ internal class ReflectionUtils {
fun getClipShape(modifier: Modifier): Shape? {
return ComposeReflection.ClipShapeField?.getSafe(modifier) as? Shape
}

fun getBitmapInVectorPainter(vectorPainter: VectorPainter): Bitmap? {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❔ question: ‏ Do you have tests for these functions that you moved here ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, reflection functions are tricky to test, they heavily depend on runtime environment. That's why I move all the reflection functions into this single class, and we are able to mock it and ensure the other parts by unit test.

@codecov-commenter
Copy link

codecov-commenter commented Nov 28, 2024

Codecov Report

Attention: Patch coverage is 29.26829% with 29 lines in your changes missing coverage. Please review.

Project coverage is 70.20%. Comparing base (223c03d) to head (45c8d46).
Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
...onreplay/compose/internal/utils/ReflectionUtils.kt 0.00% 19 Missing ⚠️
...ionreplay/compose/internal/utils/SemanticsUtils.kt 56.25% 3 Missing and 4 partials ⚠️
...y/compose/internal/reflection/ComposeReflection.kt 0.00% 2 Missing ⚠️
...rnal/mappers/semantics/ImageSemanticsNodeMapper.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2419      +/-   ##
===========================================
+ Coverage    70.09%   70.20%   +0.12%     
===========================================
  Files          768      769       +1     
  Lines        28529    28530       +1     
  Branches      4783     4782       -1     
===========================================
+ Hits         19995    20029      +34     
+ Misses        7194     7163      -31     
+ Partials      1340     1338       -2     
Files with missing lines Coverage Δ
.../sessionreplay/compose/internal/data/BitmapInfo.kt 100.00% <100.00%> (ø)
...rnal/mappers/semantics/ImageSemanticsNodeMapper.kt 8.00% <0.00%> (+4.77%) ⬆️
...y/compose/internal/reflection/ComposeReflection.kt 0.00% <0.00%> (ø)
...ionreplay/compose/internal/utils/SemanticsUtils.kt 75.63% <56.25%> (-3.01%) ⬇️
...onreplay/compose/internal/utils/ReflectionUtils.kt 2.50% <0.00%> (-2.26%) ⬇️

... and 33 files with indirect coverage changes

@ambushwork ambushwork marked this pull request as ready for review November 28, 2024 15:01
@ambushwork ambushwork requested review from a team as code owners November 28, 2024 15:01
@ambushwork ambushwork merged commit 4923861 into develop Nov 28, 2024
24 checks passed
@ambushwork ambushwork deleted the yl/compose/fix-image-mapper branch November 28, 2024 16:07
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.

4 participants