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

Add test for swing interop #737

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add test for swing interop #737

wants to merge 2 commits into from

Conversation

Walingar
Copy link
Contributor

I've added test for z-ordering with SkiaSwingLayer. Also, I checked that test fails with heavy-weight SkiaLayer component

@Walingar Walingar requested a review from igordmn June 29, 2023 10:50
@Walingar
Copy link
Contributor Author

API can be improved when more tests will be written. May be you know some other usecases that we can handle in tests? I thought about resizing, but cannot imagine how to write test for such dynamic behaviour

@igordmn
Copy link
Collaborator

igordmn commented Jun 29, 2023

May be you know some other usecases

I would say, we need to check all cases from SkiaLayerTest. They also applicable to SkiaSwingLayer

@Walingar
Copy link
Contributor Author

Not all, but I agree we can check smth like multiple windows and multiple components. Thank you, will write!

@igordmn
Copy link
Collaborator

igordmn commented Jun 29, 2023

resizing

Resizing needs to be tested for 2 cases:

  • is it able to resize the content (the example of this test is in SkiaLayerTest).
  • if the size of the panel can react on the layout. This test can be tested in integration with Compose in the Compose sources.


private fun fillSkikoView(color: Color = Color.RED): SkikoView = object : SkikoView {
override fun onRender(canvas: Canvas, width: Int, height: Int, nanoTime: Long) {
canvas.drawRect(Rect(0f, 0f, width.toFloat(), height.toFloat()), Paint().apply {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Worth add a semi-transparent green background around the rect, to check blending (to the Swing rect as well)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it is worth adding it only for swing here. Will do

@Walingar Walingar force-pushed the nr/swing-interop-tests branch from 5fc1b37 to a9a040e Compare June 30, 2023 14:12
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