Accessing main window menus during C++ test run

Miklos Vajna vmiklos at collabora.com
Fri Jun 17 06:28:14 UTC 2022


Hi Colomban,

On Thu, Jun 16, 2022 at 03:09:51PM +0200, Colomban Wendling <cwendling at hypra.fr> wrote:
> Bingo, hooking in there do give me the accessible tree I'm hoping for, as
> with the Python UITest, thanks.

Good, that's partial success. :-)

> Unfortunately, I'm supposed to write in-process tests [1], so that wouldn't
> really be an option.  If really it's the only way I'd bring the discussion
> and see if that requirement can be lifted, but then maybe I should just
> switch to Python directly as it's probably more beginner-friendly as it's
> one of the aims of the work I'm on.  Anyway, for the moment that's not the
> option I'm hoping for :)

Sure, in-process tests are great if you can get them working, because
they are simpler (more reliable) + it's much easier to debug if they
fail.

> > Most of our cppunit tests run in-process, using --headless, so if there
> > would be any dialogs popping up, we would instantly cancel them.
> 
> OK, that's an interesting info.  However, I'm not anywhere close to dealing
> with dialogs or even popups yet, all I'm after is the accessible objects
> representing the menu items.  This shouldn't require anything to actually
> get displayed or pop up.
> I guess however that maybe in headless mode the UI is in a degraded state;
> would it be possible to trigger loading of the missing bits?  Any idea where
> to look?

Hmm, so far you tried out of process + SAL_USE_VCLPLUGIN=svp and
in-process + --headless.

Try experimenting with the in-process + SAL_USE_VCLPLUGIN=svp
combination, perhaps that would give you what you need.

Be aware that in case of in-process tests your test code is running on
the main thread, so if you depend on any idles, you need to manually
spin the main loop with Scheduler::ProcessEventsToIdle() (vs out of
process tests, where this is done for you automatically).

Regards,

Miklos


More information about the LibreOffice mailing list