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

CfW: fix MouseEvent to PointerButton mapping #1274

Merged
merged 6 commits into from
Apr 19, 2024

Conversation

eymar
Copy link
Collaborator

@eymar eymar commented Apr 16, 2024

To run the tests:

  • run them from IDEA
  • or using an extra gradle property: ./gradlew :compose:ui:ui:cleanWasmJsBrowserTest :compose:ui:ui:wasmJsBrowserTest -Pjetbrains.cfw.tests.useChrome=true

It tests the fix for this issue: JetBrains/compose-multiplatform#4134

@eymar eymar requested a review from Schahen April 16, 2024 13:42
MouseEvent.button should be taken into account only for press and release events
MouseEvent.button should be taken into account only for press and release events
@@ -33,6 +40,7 @@ internal val MouseEvent.composeButton get() =
4 -> PointerButton.Forward
else -> PointerButton(-1)
}
}
Copy link
Member

Choose a reason for hiding this comment

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

If it's nullable now we can return null in else section

Copy link
Collaborator Author

@eymar eymar Apr 18, 2024

Choose a reason for hiding this comment

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

actually, there can be more buttons than listed here. Neither -1 nor null are okay.
I'll return else -> PointerButton(button.toInt()) for now. When I have a mouse with more buttons, I'll check it again.

__

wait a second. the tests fail now. :D let me check

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the test failed for another reason (fixed). The above comment remains valid from my point of view.

@eymar eymar changed the title CfW: add tests for mouse events CfW: fix MouseEvent to PointerButton mapping Apr 18, 2024
@eymar eymar merged commit 3fc27e3 into jb-main Apr 19, 2024
6 checks passed
@eymar eymar deleted the ok/add_cfw_mouse_event_tests branch April 19, 2024 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants