[Development] Conditionally use xcb (or Xlib) in tst_qwindow.cpp?

Thiago Macieira thiago.macieira at intel.com
Wed Jan 25 17:52:45 CET 2017


Em quarta-feira, 25 de janeiro de 2017, √†s 17:47:15 PST, Thomas S√łndergaard 
escreveu:
> Hi,
> 
> I can see there is code in tests that depending on e.g. Q_OS_WIN32 and
> Q_OS_UNIX conditionally includes, for the platform, universally available
> headers like <sys/socket.h>. I would like to add a unit test that requires
> checking state on the native window behind QWindow. Doing this on windows
> with Q_OS_WIN32 should be fine, but how do I make the corresponding test
> that requires a bit of XCB/Xlib code?
> 
> Specifically I would like to add a test to tst_qwindow.cpp and perhaps
> tst_qwidget.cpp that check that the window state (minimized, maximized,
> fullscreen) on the native window is what we expect it to be.

Actually, it isn't that easy on Windows either. You cannot assume that the 
test is being run with the "windows" plugin.

You need to query QPA to find out which plugin you're using before using the 
backend native functions on the native handle.

As for linking to the required libraries, you should look into
	src/plugins/platforms/xcb/*.pro

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list