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

RUM-7216: Add Slider semantics node mapper #2459

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ambushwork
Copy link
Member

What does this PR do?

A brief description of the change being made with this pull request.

Motivation

What inspired you to submit this pull request?

Additional Notes

Anything else we should know when reviewing?

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)

@@ -148,6 +152,8 @@ internal class RootSemanticsNodeMapper(
textFieldSemanticsNodeMapper
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Maybe worth to use when here?

): SemanticsWireframe {
var index = 0
val trackWireframe = resolveTrackWireframe(parentContext, semanticsNode, index++)
val thumbWireframe = resolveThumbWireframe(parentContext, semanticsNode, index)
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Seems like could use 0 and 1 directly instead of index

val globalBounds = resolveBounds(semanticsNode)
val progressBarRangeInfo = semanticsUtils.getProgressBarRangeInfo(semanticsNode)
val progress = progressBarRangeInfo?.let {
it.current / (it.range.endInclusive - it.range.start)
Copy link
Contributor

Choose a reason for hiding this comment

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

Warning

Are you sure that there is no chance for ArithmeticException here?

val thumbHeight = DEFAULT_THUMB_RADIUS.value * 2 * parentContext.density
val yOffset = (globalBounds.height - thumbHeight).toLong() / 2
println("prod thumb - height: ${globalBounds.height}, thumbHeight $thumbHeight")
println("test thumb - yOffset: $yOffset")
Copy link
Contributor

Choose a reason for hiding this comment

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

Note

Debug leftovers?


companion object {
// TODO RUM-7467: Use contrast color of parent color
private const val DEFAULT_COLOR = "#000000FF"
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Probably it's better to put color name into the constant?

val xOffset = fakeProgress * fakeGlobalBounds.width + fakeGlobalBounds.x
val thumbHeight = DEFAULT_THUMB_RADIUS.value * 2 * fakeUiContext.density
val expectedTrackWireframe = MobileSegment.Wireframe.ShapeWireframe(
id = (fakeSemanticsId.toLong() shl 32) + 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Note

It's not clear why we need shift here?

)
)
val yThumbOffset = (fakeGlobalBounds.height - thumbHeight).toLong() / 2
println("test thumb - height: ${fakeGlobalBounds.height}, thumbHeight $thumbHeight")
Copy link
Contributor

Choose a reason for hiding this comment

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

Note

same here, do we need this prints?

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 25.49020% with 38 lines in your changes missing coverage. Please review.

Project coverage is 70.30%. Comparing base (41f157b) to head (bbc6703).
Report is 10 commits behind head on develop.

Files with missing lines Patch % Lines
...nal/mappers/semantics/SliderSemanticsNodeMapper.kt 15.91% 37 Missing ⚠️
...ionreplay/compose/internal/utils/SemanticsUtils.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2459      +/-   ##
===========================================
- Coverage    70.37%   70.30%   -0.07%     
===========================================
  Files          780      781       +1     
  Lines        28850    28901      +51     
  Branches      4835     4839       +4     
===========================================
+ Hits         20301    20317      +16     
- Misses        7205     7233      +28     
- Partials      1344     1351       +7     
Files with missing lines Coverage Δ
...ernal/mappers/semantics/RootSemanticsNodeMapper.kt 76.74% <100.00%> (+1.74%) ⬆️
...ionreplay/compose/internal/utils/SemanticsUtils.kt 75.20% <0.00%> (-0.61%) ⬇️
...nal/mappers/semantics/SliderSemanticsNodeMapper.kt 15.91% <15.91%> (ø)

... and 25 files with indirect coverage changes

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.

3 participants