-
Notifications
You must be signed in to change notification settings - Fork 183
New test for Clipboard #2541
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
New test for Clipboard #2541
Conversation
Test Results 118 files ±0 118 suites ±0 11m 3s ⏱️ + 1m 13s For more details on these failures, see this check. Results for commit 470e3a0. ± Comparison against base commit 52c9fff. ♻️ This comment has been updated with latest results. |
My new test didn't run - I had looked at the test file next to my new test to see if I needed to manually add it to any lists. That was Test_org_eclipse_swt_custom_VerifyKeyListener which is also not running. On further examination I found 10 test classes that are not run in the suite. I assume this is an oversight and I am providing a new PR that adds all of them in. |
Thanks @jonahgraham . All tests are supposed to run so it's definetely an oversight. |
tests/org.eclipse.swt.tests/data/clipboard/ClipboardCommands.java
Outdated
Show resolved
Hide resolved
I have removed the gtk4 label to be sure that tests work fine on gtk3 for now. |
...se.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Clipboard.java
Outdated
Show resolved
Hide resolved
...se.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Clipboard.java
Outdated
Show resolved
Hide resolved
9ab2c51
to
97b848f
Compare
fe05092
to
a00524c
Compare
This is ready to merge. As a few other people have had a look in here I will wait a bit for last minute comments before merging myself |
Testing the Clipboard can be difficult because there are a lot of system issues that can interfere, but of particular concern are: 1. System clipboard managers which may take ownership of the clipboard at unexpected times. 2. Limitations as to when processes can access clipboard, such as on Wayland where only active window can access clipboard. 3. Different behaviour when copying within a single process than between processes. These tests aim to resolve these issues. For the system clipboard manager there are a lot of extra sleep calls to allow clipboard manager to complete operations before continuing tests. In addition, we run all the tests multiple times by default to ensure stability. For the process limitations, we carefully control when the shell is created because we often cannot get focus back when shell ends up in the background. See the openAndFocusShell and openAndFocusRemote methods. For the different behaviours, we spin up a simple Swing app in a new process (the "remote" in openAndFocusRemote above). This app can be directed, over RMI, to access the clipboard. This allows our test to place data on the clipboard and ensure that the remote app can read the data successfully. For now this test only covers basic text (and a little of RTF). Adding Image and other transfers is part of the future work as such functionality is added in GTK4 while working on #2126 For the changes to SwtTestUtil that we required: 1. isGTK4 moved from Test_org_eclipse_swt_widgets_Shell.java to the Utils 2. processEvents was limited to 20 readAndDispatch calls per second due to the ordering of the targetTimestamp check. This change allows full speed readAndDispatching. 3. getPath was refactored to allow better control of source and destination of files extracted. See extracting of class files for remote Swing app in startRemoteClipboardCommands method Part of #2126 Split out of #2538
a00524c
to
470e3a0
Compare
The test failed to get the RMI within 1 second on macOS on GitHub actions one time, so increase the timeout here. Fixup for #2541
Testing the Clipboard can be difficult because there are a lot of system issues that can interfere, but of particular concern are:
These tests aim to resolve these issues.
For the system clipboard manager there are a lot of extra sleep calls to allow clipboard manager to complete operations before continuing tests. In addition, we run all the tests multiple times by default to ensure stability.
For the process limitations, we carefully control when the shell is created because we often cannot get focus back when shell ends up in the background. See the openAndFocusShell and openAndFocusRemote methods.
For the different behaviours, we spin up a simple Swing app in a new process (the "remote" in openAndFocusRemote above). This app can be directed, over RMI, to access the clipboard. This allows our test to place data on the clipboard and ensure that the remote app can read the data successfully.
For now this test only covers basic text (and a little of RTF). Adding Image and other transfers is part of the future work as such functionality is added in GTK4 while working on #2126
For the changes to SwtTestUtil that we required:
Part of #2126
Split out of #2538