RUM-6195: Add support for Compose Checkbox#2414
Conversation
33e6311 to
66d7340
Compare
66d7340 to
9d12c72
Compare
0xnm
left a comment
There was a problem hiding this comment.
I briefly went through the production files, didn't cover tests
| val ShapeField = BackgroundElementClass?.getDeclaredFieldSafe("shape") | ||
|
|
||
| val CheckDrawingCacheClass = getClassSafe("androidx.compose.material.CheckDrawingCache") | ||
| val CheckboxKtClass = getClassSafe("androidx.compose.material.CheckboxKt\$CheckboxImpl\$1\$1") |
There was a problem hiding this comment.
+1, updating proguard consumer rules is necessary
9d12c72 to
f23bb5f
Compare
f23bb5f to
8864b27
Compare
4411582 to
a02fc56
Compare
427dafe to
7a92c24
Compare
b35cace to
0da9659
Compare
7f56e9a to
a12c7ad
Compare
0da9659 to
2ef05ac
Compare
2ef05ac to
8b092b1
Compare
0xnm
left a comment
There was a problem hiding this comment.
nice! I left some comments/suggestions, but nothing major.
| } | ||
| } | ||
|
|
||
| if (wireframes.isNotEmpty()) { |
There was a problem hiding this comment.
minor: you probably can just do return wireframes.ifEmpty { createManualCheckedWireframe }
cd5a77c to
11155d6
Compare
| .thenReturn(TextAndInputPrivacy.MASK_ALL_INPUTS) | ||
|
|
||
| // When | ||
| val wireframes = testedMapper.map( |
There was a problem hiding this comment.
since return type is SemanticsWireframe should this one be called wireframe? or checkboxWireframe.
Otherwise wireframes.wireframes below looks strange.
| // Then | ||
| assertThat(wireframes.wireframes).hasSize(1) | ||
| val actualWireframe = wireframes.wireframes[0] as MobileSegment.Wireframe.ShapeWireframe | ||
| assertThat(actualWireframe).isNotNull |
There was a problem hiding this comment.
is it possible to have null at all? the type here is MobileSegment.Wireframe.ShapeWireframe, not MobileSegment.Wireframe.ShapeWireframe?
| fun `M return input value W convertRgbaToArgb() { length is less than 8 }`( | ||
| forge: Forge | ||
| ) { | ||
| // Given | ||
| val input = forge.anAsciiString(1) | ||
|
|
||
| // Then | ||
| assertThat(testedUtils.convertRgbaToArgb(input)).isEqualTo(input) | ||
| } |
There was a problem hiding this comment.
so if we pass rgb string, the output will be wrong? Shouldn't we check in the convertRgbaToArgb method that input is exactly 8 characters (or 6 if we want to support rgb?
Otherwise we may have this function trying to compose something for the strings of format we don't expect.
11155d6 to
c1b4f66
Compare
What does this PR do?
Adds support for the Checkbox Semantics role. Resolves the path of the checkbox to a bitmap and sends as an imageWireframe, but if unsuccessful will create a ShapeWireframe approximation. This pr includes:
• Creation of checked/unchecked state for the checkbox.
• Fallback to a manual shape wireframe if we couldn't resolve the checkmark path.
• Caching of the checkmark resourceId in the
ResourcesLruCache.• Generation of a cache key for the checkmark using
PathMeasureon the path to fingerprint it by sampling at intervals. This is bounded by a configurable maximum number of samples.Unchecked state:

Checked state if succesful in resolving the path:

Checked state fallback if path resolution is unsuccessful:

Motivation
Part of the initiative to support Jetpack Compose.
Additional Notes
Anything else we should know when reviewing?
Review checklist (to be filled by reviewers)