Create TextViewCursor without Human Interaction
I’m on Fedora 27 with XFCE, trying to run JUnit tests in Eclipse on Java code for a Writer extension. The tests ran fine in LibreOffice 5.2 with LO SDK version 5.2, but not in LO 5.4 with LO SDK 5.4.
After much poking at my code and eliminating the impossible, I found that the code for obtaining the TextViewCursor returns null unless and until Writer receives input focus.
So, if I put a command such as Thread.sleep(5000) into the test code after the code starts Writer and then click in the Writer window during the sleep so it has focus, the test runs fine.
This is obviously just a wee bit less than ideal.
I’ve already considered automating a click in the Writer window from outside the program, but I was hoping to avoid such a kludge.
Has anyone had any experience with this issue? Maybe even have a programmatic workaround?