Skip to content

Add checks for menu position - #3290

Open
janinadavydova wants to merge 17 commits into
jb-mainfrom
davydova/cmp-10602-test-menu-position
Open

Add checks for menu position#3290
janinadavydova wants to merge 17 commits into
jb-mainfrom
davydova/cmp-10602-test-menu-position

Conversation

@janinadavydova

@janinadavydova janinadavydova commented Aug 7, 2026

Copy link
Copy Markdown

Describe proposed changes and the issue being fixed

Fixes CMP-10602 Cover cases like CMP-10315 with iOS instrumented regression test for menu position

Failing case with BTF1 is Ignored until CMP-10315 is fixed.

Release Notes

N/A

@janinadavydova
janinadavydova marked this pull request as ready for review August 10, 2026 09:26
val text = "I am a TextField"
val keyboardOptions = KeyboardOptions(
platformImeOptions = PlatformImeOptions {
usingNativeTextInput(false)

Choose a reason for hiding this comment

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

nit: it's default value, not needed

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

Box(
modifier = Modifier
.fillMaxSize()
.background(Color.White)

Choose a reason for hiding this comment

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

nit: can be omitted

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

val horizontalDistance = menuFrame.horizontalDistanceTo(caretFrame)
val verticalDistance = menuFrame.verticalDistanceTo(caretFrame)
val contextMenu = if (newContextMenuEnabled) "new menu" else "old menu"
val maxDistance = 16.dp

Choose a reason for hiding this comment

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

nit: better to extract into constant

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

BasicTextField2
}

private class TextFieldLayoutInfo(

Choose a reason for hiding this comment

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

If it's possible to wait, then I suggest waiting for that PR to merge, I've made an API for that there

It would be also possible to use UIKitInstrumentedTest.setTextFieldContent (line 934)
instead of the UIKitInstrumentedTest.setOffsetTextFieldContent (line 297)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, thanks, let's wait

verifyContextMenuItemsVisible(listOf("Paste"))

val pasteFrame = findNodeWithLabel("Paste").frame!!
val itemFrames = listOf("Select", "Select All").mapNotNull { label ->

Choose a reason for hiding this comment

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

If the purpose is to find a menu frame and assert that it is not far away from the caret, why not reuse finding_UIEditMenuContainerView (like it is done in waitForContextMenu()) instead of collecting and uniting frames of the items in this menu?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

@janinadavydova
janinadavydova force-pushed the davydova/cmp-10602-test-menu-position branch from c18c734 to d801335 Compare August 17, 2026 13:30
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.

2 participants