From 1bcab3a7479220930291238eac2c67b412d2bf73 Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Fri, 23 Aug 2013 12:57:03 +0200 Subject: [PATCH] qmltest: Add QTestDefinedVariables QTestDefinedVariables is used by the QTestRootObject to check is a preprocessor variable is defined. Adding QT_OPENGL_ES_2_ANGLE. It can be useful to know if it is defined (Win32 + Angle) while running a test. Change-Id: I2f9ffb1028c94095c711ab64737b53b60c055312 Reviewed-by: Alan Alpert --- src/qmltest/quicktest.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index fd0270f..c210c21 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -75,9 +76,15 @@ class QTestRootObject : public QObject Q_OBJECT Q_PROPERTY(bool windowShown READ windowShown NOTIFY windowShownChanged) Q_PROPERTY(bool hasTestCase READ hasTestCase WRITE setHasTestCase NOTIFY hasTestCaseChanged) + Q_PROPERTY(QObject *defined READ defined) public: QTestRootObject(QObject *parent = 0) - : QObject(parent), hasQuit(false), m_windowShown(false), m_hasTestCase(false) {} + : QObject(parent), hasQuit(false), m_windowShown(false), m_hasTestCase(false) { + m_defined = new QQmlPropertyMap(this); +#if defined(QT_OPENGL_ES_2_ANGLE) + m_defined->insert(QLatin1String("QT_OPENGL_ES_2_ANGLE"), QVariant(true)); +#endif + } static QTestRootObject *instance() { static QPointer object = new QTestRootObject; @@ -94,6 +101,7 @@ public: bool windowShown() const { return m_windowShown; } void setWindowShown(bool value) { m_windowShown = value; emit windowShownChanged(); } + QQmlPropertyMap *defined() const { return m_defined; } void init() { setWindowShown(false); setHasTestCase(false); hasQuit = false; } @@ -107,6 +115,7 @@ private Q_SLOTS: private: bool m_windowShown : 1; bool m_hasTestCase :1; + QQmlPropertyMap *m_defined; }; static QObject *testRootObject(QQmlEngine *engine, QJSEngine *jsEngine) -- 2.7.4