Skip to content

Commit

Permalink
Fix tst_QGuiApplication for embedded platforms using eglfs QPA
Browse files Browse the repository at this point in the history
Disable input and cursor for QGuiApplication instances used in
autotest to initialize it properly.

Change-Id: I78dc9b776269c082c20f244a51f858289129275d
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
  • Loading branch information
Pasi Petäjäjärvi committed Sep 10, 2015
1 parent c258422 commit 4b2db07
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,7 @@
#include <private/qeventloop_p.h>
#include <private/qthread_p.h>

#ifdef QT_GUI_LIB
#include <QtGui/QGuiApplication>
typedef QGuiApplication TestApplication;
#else
typedef QCoreApplication TestApplication;
#endif

class EventSpy : public QObject
{
Expand Down
16 changes: 16 additions & 0 deletions tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class tst_QGuiApplication: public tst_QCoreApplication
Q_OBJECT

private slots:
void initTestCase();
void cleanup();
void displayName();
void firstWindowTitle();
Expand All @@ -84,6 +85,21 @@ private slots:
void settableStyleHints(); // Needs to run last as it changes style hints.
};

void tst_QGuiApplication::initTestCase()
{
#ifdef QT_QPA_DEFAULT_PLATFORM_NAME
if ((QString::compare(QStringLiteral(QT_QPA_DEFAULT_PLATFORM_NAME),
QStringLiteral("eglfs"), Qt::CaseInsensitive) == 0) ||
(QString::compare(QString::fromLatin1(qgetenv("QT_QPA_PLATFORM")),
QStringLiteral("eglfs"), Qt::CaseInsensitive) == 0)) {
// Set env variables to disable input and cursor because eglfs is single fullscreen window
// and trying to initialize input and cursor will crash test.
qputenv("QT_QPA_EGLFS_DISABLE_INPUT", "1");
qputenv("QT_QPA_EGLFS_HIDECURSOR", "1");
}
#endif
}

void tst_QGuiApplication::cleanup()
{
QVERIFY(QGuiApplication::allWindows().isEmpty());
Expand Down

0 comments on commit 4b2db07

Please sign in to comment.